mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 16:27:33 +00:00
merge
This commit is contained in:
commit
c9a66e35e1
@ -35,9 +35,10 @@ limitations under the License. -->
|
|||||||
size="small"
|
size="small"
|
||||||
v-model="tags"
|
v-model="tags"
|
||||||
class="trace-new-tag"
|
class="trace-new-tag"
|
||||||
@input="searchTags"
|
@input="inputTags"
|
||||||
@blur="visible = false"
|
@blur="visible = false"
|
||||||
@focus="visible = true"
|
@focus="visible = true"
|
||||||
|
@change="addTags"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
@ -92,7 +93,7 @@ const tagsList = ref<string[]>([]);
|
|||||||
const tagArr = ref<string[]>([]);
|
const tagArr = ref<string[]>([]);
|
||||||
const tagList = ref<string[]>([]);
|
const tagList = ref<string[]>([]);
|
||||||
const tagKeys = ref<string[]>([]);
|
const tagKeys = ref<string[]>([]);
|
||||||
const keyList = ref<string[]>([]);
|
const keysList = ref<string[]>([]);
|
||||||
const visible = ref<boolean>(false);
|
const visible = ref<boolean>(false);
|
||||||
const tipsMap = {
|
const tipsMap = {
|
||||||
LOG: "logTagsTip",
|
LOG: "logTagsTip",
|
||||||
@ -138,7 +139,7 @@ async function fetchTagKeys() {
|
|||||||
}
|
}
|
||||||
tagArr.value = resp.data.tagKeys;
|
tagArr.value = resp.data.tagKeys;
|
||||||
tagKeys.value = resp.data.tagKeys;
|
tagKeys.value = resp.data.tagKeys;
|
||||||
keyList.value = resp.data.tagKeys;
|
keysList.value = resp.data.tagKeys;
|
||||||
searchTags();
|
searchTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,13 +160,37 @@ async function fetchTagValues() {
|
|||||||
searchTags();
|
searchTags();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function inputTags() {
|
||||||
|
if (!tags.value) {
|
||||||
|
tagArr.value = keysList.value;
|
||||||
|
tagKeys.value = keysList.value;
|
||||||
|
tagList.value = tagArr.value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let search = "";
|
||||||
|
if (tags.value.includes("=")) {
|
||||||
|
search = tags.value.split("=")[1];
|
||||||
|
fetchTagValues();
|
||||||
|
} else {
|
||||||
|
search = tags.value;
|
||||||
|
}
|
||||||
|
tagList.value = tagArr.value.filter((d: string) => d.includes(search));
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTags() {
|
||||||
|
if (!tags.value.includes("=")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
addLabels();
|
||||||
|
tagArr.value = tagKeys.value;
|
||||||
|
searchTags();
|
||||||
|
}
|
||||||
|
|
||||||
function selectTag(item: string) {
|
function selectTag(item: string) {
|
||||||
if (tags.value.includes("=")) {
|
if (tags.value.includes("=")) {
|
||||||
const key = tags.value.split("=")[0];
|
const key = tags.value.split("=")[0];
|
||||||
tags.value = key + "=" + item;
|
tags.value = key + "=" + item;
|
||||||
addLabels();
|
addTags();
|
||||||
tagArr.value = tagKeys.value;
|
|
||||||
searchTags();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tags.value = item + "=";
|
tags.value = item + "=";
|
||||||
@ -173,11 +198,6 @@ function selectTag(item: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function searchTags() {
|
function searchTags() {
|
||||||
if (!tags.value) {
|
|
||||||
tagList.value = keyList.value;
|
|
||||||
tagKeys.value = keyList.value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let search = "";
|
let search = "";
|
||||||
if (tags.value.includes("=")) {
|
if (tags.value.includes("=")) {
|
||||||
search = tags.value.split("=")[1];
|
search = tags.value.split("=")[1];
|
||||||
|
@ -90,6 +90,7 @@ import {
|
|||||||
reactive,
|
reactive,
|
||||||
watch,
|
watch,
|
||||||
computed,
|
computed,
|
||||||
|
nextTick,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import * as d3 from "d3";
|
import * as d3 from "d3";
|
||||||
@ -149,6 +150,14 @@ const graphConfig = computed(() => props.config.graph || {});
|
|||||||
const depth = ref<number>(graphConfig.value.depth || 2);
|
const depth = ref<number>(graphConfig.value.depth || 2);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
await nextTick();
|
||||||
|
const dom = document.querySelector(".topology")?.getBoundingClientRect() || {
|
||||||
|
height: 40,
|
||||||
|
width: 0,
|
||||||
|
};
|
||||||
|
height.value = dom.height - 40;
|
||||||
|
width.value = dom.width;
|
||||||
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const json = await selectorStore.fetchServices(dashboardStore.layerId);
|
const json = await selectorStore.fetchServices(dashboardStore.layerId);
|
||||||
if (json.errors) {
|
if (json.errors) {
|
||||||
@ -157,18 +166,13 @@ onMounted(async () => {
|
|||||||
}
|
}
|
||||||
const resp = await getTopology();
|
const resp = await getTopology();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|
||||||
if (resp && resp.errors) {
|
if (resp && resp.errors) {
|
||||||
ElMessage.error(resp.errors);
|
ElMessage.error(resp.errors);
|
||||||
}
|
}
|
||||||
topologyStore.getLinkClientMetrics(settings.value.linkClientMetrics || []);
|
topologyStore.getLinkClientMetrics(settings.value.linkClientMetrics || []);
|
||||||
topologyStore.getLinkServerMetrics(settings.value.linkServerMetrics || []);
|
topologyStore.getLinkServerMetrics(settings.value.linkServerMetrics || []);
|
||||||
topologyStore.queryNodeMetrics(settings.value.nodeMetrics || []);
|
topologyStore.queryNodeMetrics(settings.value.nodeMetrics || []);
|
||||||
const dom = document.querySelector(".topology")?.getBoundingClientRect() || {
|
|
||||||
height: 40,
|
|
||||||
width: 0,
|
|
||||||
};
|
|
||||||
height.value = dom.height - 40;
|
|
||||||
width.value = dom.width;
|
|
||||||
window.addEventListener("resize", resize);
|
window.addEventListener("resize", resize);
|
||||||
svg.value = d3.select(chart.value).append("svg").attr("class", "topo-svg");
|
svg.value = d3.select(chart.value).append("svg").attr("class", "topo-svg");
|
||||||
await initLegendMetrics();
|
await initLegendMetrics();
|
||||||
@ -733,4 +737,8 @@ watch(
|
|||||||
stroke-dashoffset: 0;
|
stroke-dashoffset: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-loading-spinner {
|
||||||
|
top: 30%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -29,13 +29,13 @@ export default class TraceUtil {
|
|||||||
return Array.from(new Set(data.map((span: Span) => span.serviceCode)));
|
return Array.from(new Set(data.map((span: Span) => span.serviceCode)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static changeTree(data: Span[], cureentTraceId: string) {
|
public static changeTree(data: Span[], currentTraceId: string) {
|
||||||
const segmentIdList: Span[] = [];
|
const segmentIdList: Span[] = [];
|
||||||
const traceTreeRef: any = this.changeTreeCore(data);
|
const traceTreeRef: any = this.changeTreeCore(data);
|
||||||
traceTreeRef.segmentIdGroup.forEach((segmentId: string) => {
|
traceTreeRef.segmentIdGroup.forEach((segmentId: string) => {
|
||||||
if (traceTreeRef.segmentMap.get(segmentId).refs) {
|
if (traceTreeRef.segmentMap.get(segmentId).refs) {
|
||||||
traceTreeRef.segmentMap.get(segmentId).refs.forEach((ref: Ref) => {
|
traceTreeRef.segmentMap.get(segmentId).refs.forEach((ref: Ref) => {
|
||||||
if (ref.traceId === cureentTraceId) {
|
if (ref.traceId === currentTraceId) {
|
||||||
this.traverseTree(
|
this.traverseTree(
|
||||||
traceTreeRef.segmentMap.get(ref.parentSegmentId) as Span,
|
traceTreeRef.segmentMap.get(ref.parentSegmentId) as Span,
|
||||||
ref.parentSpanId,
|
ref.parentSpanId,
|
||||||
@ -144,7 +144,7 @@ export default class TraceUtil {
|
|||||||
spanId: parentSpanId,
|
spanId: parentSpanId,
|
||||||
parentSpanId: parentSpanId > -1 ? 0 : -1,
|
parentSpanId: parentSpanId > -1 ? 0 : -1,
|
||||||
};
|
};
|
||||||
if (lodash.find(fixSpans, fixSpanKeyContent)) {
|
if (!lodash.find(fixSpans, fixSpanKeyContent)) {
|
||||||
fixSpans.push({
|
fixSpans.push({
|
||||||
...fixSpanKeyContent,
|
...fixSpanKeyContent,
|
||||||
refs: [],
|
refs: [],
|
||||||
@ -255,11 +255,11 @@ export default class TraceUtil {
|
|||||||
private static collapse(span: Span) {
|
private static collapse(span: Span) {
|
||||||
if (span.children) {
|
if (span.children) {
|
||||||
let dur = span.endTime - span.startTime;
|
let dur = span.endTime - span.startTime;
|
||||||
span.children.forEach((chlid: Span) => {
|
span.children.forEach((child: Span) => {
|
||||||
dur -= chlid.endTime - chlid.startTime;
|
dur -= child.endTime - child.startTime;
|
||||||
});
|
});
|
||||||
span.dur = dur < 0 ? 0 : dur;
|
span.dur = dur < 0 ? 0 : dur;
|
||||||
span.children.forEach((chlid) => this.collapse(chlid));
|
span.children.forEach((child) => this.collapse(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user