mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-18 18:05:25 +00:00
feat: add legend and metrics
This commit is contained in:
parent
7697157328
commit
f98c5ae62a
@ -95,6 +95,10 @@
|
|||||||
background-color: #a7aebb;
|
background-color: #a7aebb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mb-5 {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.ml-5 {
|
.ml-5 {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
}
|
}
|
||||||
@ -129,11 +133,9 @@
|
|||||||
@keyframes loading {
|
@keyframes loading {
|
||||||
0% {
|
0% {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
to {
|
to {
|
||||||
transform: rotate(1turn);
|
transform: rotate(1turn);
|
||||||
transform: rotate(1turn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,21 +25,13 @@ import { simulationInit, simulationSkip } from "./utils/simulation";
|
|||||||
import nodeElement from "./utils/nodeElement";
|
import nodeElement from "./utils/nodeElement";
|
||||||
import { linkElement, anchorElement, arrowMarker } from "./utils/linkElement";
|
import { linkElement, anchorElement, arrowMarker } from "./utils/linkElement";
|
||||||
// import tool from "./utils/tool";
|
// import tool from "./utils/tool";
|
||||||
// import topoLegend from "./utils/legend";
|
import topoLegend from "./utils/legend";
|
||||||
import { Node, Call } from "@/types/topology";
|
import { Node, Call } from "@/types/topology";
|
||||||
import { useTopologyStore } from "@/store/modules/topology";
|
import { useTopologyStore } from "@/store/modules/topology";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { EntityType } from "../../data";
|
import { EntityType } from "../../data";
|
||||||
|
|
||||||
/*global defineProps, Nullable */
|
/*global Nullable */
|
||||||
// const props = defineProps({
|
|
||||||
// current: {
|
|
||||||
// type: Object as PropType<{ [key: string]: number[] }>,
|
|
||||||
// default: () => ({}),
|
|
||||||
// },
|
|
||||||
// nodes: { type: Array as PropType<Node[]>, default: () => [] },
|
|
||||||
// links: { type: Array as PropType<Call[]>, default: () => [] },
|
|
||||||
// });
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const topologyStore = useTopologyStore();
|
const topologyStore = useTopologyStore();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
@ -55,6 +47,7 @@ const link = ref<any>(null);
|
|||||||
const anchor = ref<any>(null);
|
const anchor = ref<any>(null);
|
||||||
const arrow = ref<any>(null);
|
const arrow = ref<any>(null);
|
||||||
const tools = ref<any>(null);
|
const tools = ref<any>(null);
|
||||||
|
const legend = ref<any>(null);
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await getTopology();
|
await getTopology();
|
||||||
@ -87,6 +80,13 @@ onMounted(async () => {
|
|||||||
// { icon: "ENDPOINT", click: handleGoEndpointDependency },
|
// { icon: "ENDPOINT", click: handleGoEndpointDependency },
|
||||||
// { icon: "" },
|
// { icon: "" },
|
||||||
// ]);
|
// ]);
|
||||||
|
// legend
|
||||||
|
legend.value = graph.value.append("g").attr("class", "topo-legend");
|
||||||
|
topoLegend(legend.value, height.value, width.value);
|
||||||
|
svg.value.on("click", (event: any) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
async function getTopology() {
|
async function getTopology() {
|
||||||
switch (dashboardStore.entity) {
|
switch (dashboardStore.entity) {
|
||||||
@ -173,7 +173,8 @@ function update() {
|
|||||||
dragended: dragended,
|
dragended: dragended,
|
||||||
handleNodeClick: handleNodeClick,
|
handleNodeClick: handleNodeClick,
|
||||||
},
|
},
|
||||||
tip.value
|
tip.value,
|
||||||
|
t
|
||||||
).merge(node.value);
|
).merge(node.value);
|
||||||
// line element
|
// line element
|
||||||
link.value = link.value.data(topologyStore.calls, (d: Call) => d.id);
|
link.value = link.value.data(topologyStore.calls, (d: Call) => d.id);
|
||||||
@ -196,7 +197,7 @@ function update() {
|
|||||||
}</div>
|
}</div>
|
||||||
<div><span class="grey">${t(
|
<div><span class="grey">${t(
|
||||||
"detectPoint"
|
"detectPoint"
|
||||||
)}:</span>${data.detectPoints.join(" | ")}</div>
|
)}: </span>${data.detectPoints.join(" | ")}</div>
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
tip.value
|
tip.value
|
||||||
|
@ -15,9 +15,17 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import icons from "./icons";
|
import icons from "./icons";
|
||||||
|
import { Node } from "@/types/topology";
|
||||||
|
|
||||||
icons["KAFKA-CONSUMER"] = icons.KAFKA;
|
icons["KAFKA-CONSUMER"] = icons.KAFKA;
|
||||||
export default (d3: any, graph: any, tool: any, funcs: any, tip: any) => {
|
export default (
|
||||||
|
d3: any,
|
||||||
|
graph: any,
|
||||||
|
tool: any,
|
||||||
|
funcs: any,
|
||||||
|
tip: any,
|
||||||
|
t: any
|
||||||
|
) => {
|
||||||
const nodeEnter = graph
|
const nodeEnter = graph
|
||||||
.append("g")
|
.append("g")
|
||||||
.call(
|
.call(
|
||||||
@ -27,10 +35,18 @@ export default (d3: any, graph: any, tool: any, funcs: any, tip: any) => {
|
|||||||
.on("drag", funcs.dragged)
|
.on("drag", funcs.dragged)
|
||||||
.on("end", funcs.dragended)
|
.on("end", funcs.dragended)
|
||||||
)
|
)
|
||||||
.on("mouseover", function (event: any, d: { name: string }) {
|
.on("mouseover", function (event: any, d: Node) {
|
||||||
tip
|
tip
|
||||||
.html(() => {
|
.html(() => {
|
||||||
return `<div>${d.name}</div>`;
|
return `
|
||||||
|
<div class="mb-5"><span class="grey">${t("cpm")}: </span>${
|
||||||
|
d.cpm
|
||||||
|
}</div>
|
||||||
|
<div class="mb-5"><span class="grey">${t("latency")}: </span>${
|
||||||
|
d.latency
|
||||||
|
}</div>
|
||||||
|
<div><span class="grey">${t("sla")}: </span>${d.sla}</div>
|
||||||
|
`;
|
||||||
})
|
})
|
||||||
.show(d, this);
|
.show(d, this);
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user