mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 23:45:23 +00:00
refactor
This commit is contained in:
parent
5053820860
commit
1ad7cabcd4
@ -113,12 +113,18 @@ export const dashboardStore = defineStore({
|
|||||||
: 3,
|
: 3,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (["Trace", "Profile", "Log", "DemandLog", "Ebpf"].includes(type)) {
|
if (
|
||||||
|
[
|
||||||
|
"Trace",
|
||||||
|
"Profile",
|
||||||
|
"Log",
|
||||||
|
"DemandLog",
|
||||||
|
"Ebpf",
|
||||||
|
"NetworkProfiling",
|
||||||
|
].includes(type)
|
||||||
|
) {
|
||||||
newItem.h = 36;
|
newItem.h = 36;
|
||||||
}
|
}
|
||||||
if (["NetworkProfiling"].includes(type)) {
|
|
||||||
newItem.h = 44;
|
|
||||||
}
|
|
||||||
if (type === "Text") {
|
if (type === "Text") {
|
||||||
newItem.h = 6;
|
newItem.h = 6;
|
||||||
newItem.graph = TextConfig;
|
newItem.graph = TextConfig;
|
||||||
@ -178,12 +184,18 @@ export const dashboardStore = defineStore({
|
|||||||
showDepth: true,
|
showDepth: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (["Trace", "Profile", "Log", "DemandLog", "Ebpf"].includes(type)) {
|
if (
|
||||||
|
[
|
||||||
|
"Trace",
|
||||||
|
"Profile",
|
||||||
|
"Log",
|
||||||
|
"DemandLog",
|
||||||
|
"Ebpf",
|
||||||
|
"NetworkProfiling",
|
||||||
|
].includes(type)
|
||||||
|
) {
|
||||||
newItem.h = 32;
|
newItem.h = 32;
|
||||||
}
|
}
|
||||||
if (["NetworkProfiling"].includes(type)) {
|
|
||||||
newItem.h = 44;
|
|
||||||
}
|
|
||||||
if (type === "Text") {
|
if (type === "Text") {
|
||||||
newItem.h = 6;
|
newItem.h = 6;
|
||||||
newItem.graph = TextConfig;
|
newItem.graph = TextConfig;
|
||||||
|
@ -72,6 +72,8 @@ const arrow = ref<any>(null);
|
|||||||
const oldVal = ref<{ width: number; height: number }>({ width: 0, height: 0 });
|
const oldVal = ref<{ width: number; height: number }>({ width: 0, height: 0 });
|
||||||
const showSettings = ref<boolean>(false);
|
const showSettings = ref<boolean>(false);
|
||||||
const config = ref<any>({});
|
const config = ref<any>({});
|
||||||
|
const diff = ref<number[]>([220, 200]);
|
||||||
|
const radius = 210;
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init();
|
init();
|
||||||
@ -99,16 +101,24 @@ function drawGraph() {
|
|||||||
width.value = dom.width;
|
width.value = dom.width;
|
||||||
svg.value.attr("height", height.value).attr("width", width.value);
|
svg.value.attr("height", height.value).attr("width", width.value);
|
||||||
tip.value = (d3tip as any)().attr("class", "d3-tip").offset([-8, 0]);
|
tip.value = (d3tip as any)().attr("class", "d3-tip").offset([-8, 0]);
|
||||||
|
const outNodes = networkProfilingStore.nodes.filter(
|
||||||
|
(d: ProcessNode) => d.serviceInstanceId !== selectorStore.currentPod.id
|
||||||
|
);
|
||||||
|
if (!outNodes.length) {
|
||||||
|
diff.value[0] = (dom.width - radius * 2) / 2 + radius;
|
||||||
|
} else {
|
||||||
|
diff.value[0] = (dom.width - radius * 4) / 2 + radius;
|
||||||
|
}
|
||||||
graph.value = svg.value
|
graph.value = svg.value
|
||||||
.append("g")
|
.append("g")
|
||||||
.attr("class", "svg-graph")
|
.attr("class", "svg-graph")
|
||||||
.attr("transform", `translate(220, 200)`);
|
.attr("transform", `translate(${diff.value[0]}, ${diff.value[1]})`);
|
||||||
graph.value.call(tip.value);
|
graph.value.call(tip.value);
|
||||||
node.value = graph.value.append("g").selectAll(".topo-node");
|
node.value = graph.value.append("g").selectAll(".topo-node");
|
||||||
link.value = graph.value.append("g").selectAll(".topo-call");
|
link.value = graph.value.append("g").selectAll(".topo-call");
|
||||||
anchor.value = graph.value.append("g").selectAll(".topo-line-anchor");
|
anchor.value = graph.value.append("g").selectAll(".topo-line-anchor");
|
||||||
arrow.value = graph.value.append("g").selectAll(".topo-line-arrow");
|
arrow.value = graph.value.append("g").selectAll(".topo-line-arrow");
|
||||||
svg.value.call(zoom(d3, graph.value, [220, 200]));
|
svg.value.call(zoom(d3, graph.value, diff.value));
|
||||||
svg.value.on("click", (event: any) => {
|
svg.value.on("click", (event: any) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -167,7 +177,7 @@ function createLayout() {
|
|||||||
}
|
}
|
||||||
const p = {
|
const p = {
|
||||||
count: 1,
|
count: 1,
|
||||||
radius: 210, // layout hexagons radius 300
|
radius, // layout hexagons radius 300
|
||||||
};
|
};
|
||||||
const polygon = createPolygon(p.radius, 6, 0);
|
const polygon = createPolygon(p.radius, 6, 0);
|
||||||
const origin = [0, 0];
|
const origin = [0, 0];
|
||||||
|
Loading…
Reference in New Issue
Block a user