mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-12 15:52:57 +00:00
fix: update
This commit is contained in:
parent
24cca12430
commit
2c0d03cbd2
@ -144,7 +144,10 @@ export const topologyStore = defineStore({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.hierarchyInstanceCalls = callList;
|
this.hierarchyInstanceCalls = callList;
|
||||||
this.hierarchyInstanceNodes = Array.from(nodesMap).flat();
|
this.hierarchyInstanceNodes = [];
|
||||||
|
for (const d of nodesMap.values()) {
|
||||||
|
this.hierarchyInstanceNodes.push(d);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setHierarchyServiceTopology(data: ServiceHierarchy) {
|
setHierarchyServiceTopology(data: ServiceHierarchy) {
|
||||||
const relations = data.relations || [];
|
const relations = data.relations || [];
|
||||||
@ -154,22 +157,29 @@ export const topologyStore = defineStore({
|
|||||||
for (const relation of relations) {
|
for (const relation of relations) {
|
||||||
const upperId = relation.upperService.id;
|
const upperId = relation.upperService.id;
|
||||||
const lowerId = relation.lowerService.id;
|
const lowerId = relation.lowerService.id;
|
||||||
if (!nodesMap.get(upperId)) {
|
const lowerKey = `${lowerId}-${relation.lowerService.layer}`;
|
||||||
nodesMap.set(upperId, relation.upperService);
|
const upperKey = `${upperId}-${relation.upperService.layer}`;
|
||||||
|
const lowerObj = { ...relation.lowerService, key: lowerId, id: lowerKey };
|
||||||
|
const upperObj = { ...relation.upperService, key: upperId, id: upperKey };
|
||||||
|
if (!nodesMap.get(upperKey)) {
|
||||||
|
nodesMap.set(upperKey, upperObj);
|
||||||
}
|
}
|
||||||
if (!nodesMap.get(lowerId)) {
|
if (!nodesMap.get(lowerKey)) {
|
||||||
nodesMap.set(lowerId, relation.lowerService);
|
nodesMap.set(lowerKey, lowerObj);
|
||||||
}
|
}
|
||||||
callList.push({
|
callList.push({
|
||||||
source: upperId,
|
source: lowerKey,
|
||||||
target: lowerId,
|
target: upperKey,
|
||||||
id: `${upperId}->${lowerId}`,
|
id: `${upperKey}->${lowerKey}`,
|
||||||
sourceObj: relation.upperService,
|
sourceObj: upperObj,
|
||||||
targetObj: relation.lowerService,
|
targetObj: lowerObj,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.hierarchyServiceCalls = callList;
|
this.hierarchyServiceCalls = callList;
|
||||||
this.hierarchyServiceNodes = Array.from(nodesMap).flat();
|
this.hierarchyServiceNodes = [];
|
||||||
|
for (const d of nodesMap.values()) {
|
||||||
|
this.hierarchyServiceNodes.push(d);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setHierarchyNodeMetricValue(m: MetricVal) {
|
setHierarchyNodeMetricValue(m: MetricVal) {
|
||||||
this.hierarchyNodeMetrics = m;
|
this.hierarchyNodeMetrics = m;
|
||||||
@ -180,6 +190,9 @@ export const topologyStore = defineStore({
|
|||||||
setLinkClientMetrics(m: MetricVal) {
|
setLinkClientMetrics(m: MetricVal) {
|
||||||
this.linkClientMetrics = m;
|
this.linkClientMetrics = m;
|
||||||
},
|
},
|
||||||
|
setNodeMetricValue(m: MetricVal) {
|
||||||
|
this.nodeMetricValue = m;
|
||||||
|
},
|
||||||
setNodeValue(m: MetricVal) {
|
setNodeValue(m: MetricVal) {
|
||||||
this.nodeMetricValue = m;
|
this.nodeMetricValue = m;
|
||||||
},
|
},
|
||||||
|
@ -147,7 +147,7 @@ limitations under the License. -->
|
|||||||
const popover = ref<Nullable<any>>(null);
|
const popover = ref<Nullable<any>>(null);
|
||||||
const graphWidth = ref<number>(100);
|
const graphWidth = ref<number>(100);
|
||||||
const currentNode = ref<Nullable<Node>>(null);
|
const currentNode = ref<Nullable<Node>>(null);
|
||||||
const diff = computed(() => [(width.value - graphWidth.value) / 2, 0]);
|
const diff = computed(() => [(width.value - graphWidth.value - 120) / 2, 0]);
|
||||||
const radius = 8;
|
const radius = 8;
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
@ -166,17 +166,11 @@ limitations under the License. -->
|
|||||||
svg.value = d3.select(".hierarchy-services-svg");
|
svg.value = d3.select(".hierarchy-services-svg");
|
||||||
graph.value = d3.select(".hierarchy-services-graph");
|
graph.value = d3.select(".hierarchy-services-graph");
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const json = await selectorStore.fetchServices(dashboardStore.layerId);
|
|
||||||
if (json.errors) {
|
|
||||||
ElMessage.error(json.errors);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await freshNodes();
|
await freshNodes();
|
||||||
svg.value.call(zoom(d3, graph.value, diff.value));
|
svg.value.call(zoom(d3, graph.value, diff.value));
|
||||||
}
|
}
|
||||||
async function freshNodes() {
|
async function freshNodes() {
|
||||||
topologyStore.setHierarchyServiceNode(null);
|
topologyStore.setHierarchyServiceNode(null);
|
||||||
// const resp = await getTopology();
|
|
||||||
const resp = await topologyStore.getHierarchyServiceTopology();
|
const resp = await topologyStore.getHierarchyServiceTopology();
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|
||||||
@ -257,8 +251,7 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getNodeStatus(d: any) {
|
function getNodeStatus(d: any) {
|
||||||
const { legend, legendMQE } = settings.value;
|
const { legendMQE } = settings.value;
|
||||||
if (settings.value.metricMode === MetricModes.Expression) {
|
|
||||||
if (!legendMQE) {
|
if (!legendMQE) {
|
||||||
return icons.CUBE;
|
return icons.CUBE;
|
||||||
}
|
}
|
||||||
@ -267,22 +260,6 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
return Number(d[legendMQE.expression]) && d.isReal ? icons.CUBEERROR : icons.CUBE;
|
return Number(d[legendMQE.expression]) && d.isReal ? icons.CUBEERROR : icons.CUBE;
|
||||||
}
|
}
|
||||||
if (!legend) {
|
|
||||||
return icons.CUBE;
|
|
||||||
}
|
|
||||||
if (!legend.length) {
|
|
||||||
return icons.CUBE;
|
|
||||||
}
|
|
||||||
let c = true;
|
|
||||||
for (const l of legend) {
|
|
||||||
if (l.condition === "<") {
|
|
||||||
c = c && d[l.name] < Number(l.value);
|
|
||||||
} else {
|
|
||||||
c = c && d[l.name] > Number(l.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return c && d.isReal ? icons.CUBEERROR : icons.CUBE;
|
|
||||||
}
|
|
||||||
function showNodeTip(event: MouseEvent, data: Node) {
|
function showNodeTip(event: MouseEvent, data: Node) {
|
||||||
const nodeMetrics: string[] =
|
const nodeMetrics: string[] =
|
||||||
(settings.value.metricMode === MetricModes.Expression
|
(settings.value.metricMode === MetricModes.Expression
|
||||||
|
@ -447,7 +447,6 @@ limitations under the License. -->
|
|||||||
}
|
}
|
||||||
async function handleHierarchyRelatedServices() {
|
async function handleHierarchyRelatedServices() {
|
||||||
hierarchyRelated.value = true;
|
hierarchyRelated.value = true;
|
||||||
handleInspect();
|
|
||||||
}
|
}
|
||||||
async function handleInspect() {
|
async function handleInspect() {
|
||||||
const id = topologyStore.node.id;
|
const id = topologyStore.node.id;
|
||||||
|
Loading…
Reference in New Issue
Block a user