fix: icons display in trace tree diagram (#324)

This commit is contained in:
zhourunjie1988 2023-09-26 17:20:05 +08:00 committed by GitHub
parent 102436ca51
commit e42734ba80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ limitations under the License. -->
import type { PropType } from "vue"; import type { PropType } from "vue";
import type { Span } from "@/types/trace"; import type { Span } from "@/types/trace";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { ref, onMounted } from "vue"; import { ref, computed } from "vue";
/* global defineProps */ /* global defineProps */
const props = defineProps({ const props = defineProps({
@ -53,12 +53,9 @@ limitations under the License. -->
traceId: { type: String, default: "" }, traceId: { type: String, default: "" },
}); });
const { t } = useI18n(); const { t } = useI18n();
const list = ref<string[]>([]); const list = computed(() => Array.from(new Set(props.data.map((i: Span) => i.serviceCode))));
const charts = ref<any>(null); const charts = ref<any>(null);
onMounted(() => {
list.value = Array.from(new Set(props.data.map((i: Span) => i.serviceCode)));
});
function computedScale(i: number) { function computedScale(i: number) {
const sequentialScale = d3 const sequentialScale = d3
.scaleSequential() .scaleSequential()
@ -76,7 +73,7 @@ limitations under the License. -->
.trace-tree-btn { .trace-tree-btn {
display: inline-block; display: inline-block;
border-radius: 4px; border-radius: 4px;
padding: 0px 7px; padding: 0 7px;
background-color: #40454e; background-color: #40454e;
color: #eee; color: #eee;
font-size: 11px; font-size: 11px;