mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-13 00:08:56 +00:00
revert: remove legend
This commit is contained in:
parent
ddd24fa769
commit
ad6c75d281
@ -592,6 +592,9 @@ export const topologyStore = defineStore({
|
|||||||
},
|
},
|
||||||
async queryHierarchyNodeExpressions(expressions: string[], layer: string) {
|
async queryHierarchyNodeExpressions(expressions: string[], layer: string) {
|
||||||
const nodes = this.hierarchyServiceNodes.filter((n: Node) => n.layer === layer);
|
const nodes = this.hierarchyServiceNodes.filter((n: Node) => n.layer === layer);
|
||||||
|
if (!nodes.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!expressions.length) {
|
if (!expressions.length) {
|
||||||
this.setHierarchyNodeMetricValue({}, layer);
|
this.setHierarchyNodeMetricValue({}, layer);
|
||||||
return;
|
return;
|
||||||
|
@ -24,7 +24,7 @@ limitations under the License. -->
|
|||||||
@change="changeLayer"
|
@change="changeLayer"
|
||||||
class="inputs"
|
class="inputs"
|
||||||
/>
|
/>
|
||||||
<div class="label" v-if="currentConfig.layer">
|
<div class="label mb-5" v-if="currentConfig.layer">
|
||||||
<span>{{ t("nodeMetrics") }}</span>
|
<span>{{ t("nodeMetrics") }}</span>
|
||||||
<el-popover placement="left" :width="400" trigger="click">
|
<el-popover placement="left" :width="400" trigger="click">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
@ -50,7 +50,6 @@ limitations under the License. -->
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import type { HierarchyServicesConfig, MetricConfigOpt } from "@/types/dashboard";
|
import type { HierarchyServicesConfig, MetricConfigOpt } from "@/types/dashboard";
|
||||||
import type { Node } from "@/types/topology";
|
|
||||||
import type { Option } from "@/types/app";
|
import type { Option } from "@/types/app";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import { useTopologyStore } from "@/store/modules/topology";
|
import { useTopologyStore } from "@/store/modules/topology";
|
||||||
@ -63,7 +62,9 @@ limitations under the License. -->
|
|||||||
const topologyStore = useTopologyStore();
|
const topologyStore = useTopologyStore();
|
||||||
const selectorStore = useSelectorStore();
|
const selectorStore = useSelectorStore();
|
||||||
const hierarchyServicesConfig = dashboardStore.selectedGrid.hierarchyServicesConfig || [];
|
const hierarchyServicesConfig = dashboardStore.selectedGrid.hierarchyServicesConfig || [];
|
||||||
const currentConfig = reactive<HierarchyServicesConfig>(hierarchyServicesConfig[0] || {});
|
const currentConfig = reactive<HierarchyServicesConfig>(
|
||||||
|
hierarchyServicesConfig[0] || { layer: dashboardStore.layerId, nodeExpressions: [] },
|
||||||
|
);
|
||||||
const layers = ref<Option[]>([]);
|
const layers = ref<Option[]>([]);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -99,7 +100,7 @@ limitations under the License. -->
|
|||||||
config[index] = JSON.parse(JSON.stringify(currentConfig));
|
config[index] = JSON.parse(JSON.stringify(currentConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
const hierarchyServicesConfig = config.filter((d: HierarchyServicesConfig) => d.layer && d.nodeExpressions);
|
const hierarchyServicesConfig = config.filter((d: HierarchyServicesConfig) => d.layer && d.nodeExpressions.length);
|
||||||
const param = {
|
const param = {
|
||||||
...dashboardStore.selectedGrid,
|
...dashboardStore.selectedGrid,
|
||||||
hierarchyServicesConfig,
|
hierarchyServicesConfig,
|
||||||
@ -134,6 +135,6 @@ limitations under the License. -->
|
|||||||
|
|
||||||
.inputs {
|
.inputs {
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
width: 270px;
|
width: 250px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -80,13 +80,13 @@ limitations under the License. -->
|
|||||||
<div>
|
<div>
|
||||||
<img :src="icons.CUBE" />
|
<img :src="icons.CUBE" />
|
||||||
<span>
|
<span>
|
||||||
{{ settings.description ? settings.description.healthy || "" : "" }}
|
{{ (settings.hierarchyServicesDesc && settings.hierarchyServicesDesc.healthy) || "" }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<img :src="icons.CUBEERROR" />
|
<img :src="icons.CUBEERROR" />
|
||||||
<span>
|
<span>
|
||||||
{{ settings.description ? settings.description.unhealthy || "" : "" }}
|
{{ (settings.hierarchyServicesDesc && settings.hierarchyServicesDesc.unhealthy) || "" }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -106,19 +106,16 @@ limitations under the License. -->
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import * as d3 from "d3";
|
import * as d3 from "d3";
|
||||||
import type { Node } from "@/types/topology";
|
import type { Node } from "@/types/topology";
|
||||||
import { useSelectorStore } from "@/store/modules/selectors";
|
|
||||||
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, MetricModes } from "@/views/dashboard/data";
|
import { EntityType } from "@/views/dashboard/data";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import type { Service } from "@/types/selector";
|
|
||||||
import { useAppStoreWithOut } from "@/store/modules/app";
|
import { useAppStoreWithOut } from "@/store/modules/app";
|
||||||
// import getDashboard from "@/hooks/useDashboardsSession";
|
// import getDashboard from "@/hooks/useDashboardsSession";
|
||||||
import type { MetricConfigOpt } from "@/types/dashboard";
|
import type { MetricConfigOpt } from "@/types/dashboard";
|
||||||
import { aggregation } from "@/hooks/useMetricsProcessor";
|
import { aggregation } from "@/hooks/useMetricsProcessor";
|
||||||
import icons from "@/assets/img/icons";
|
import icons from "@/assets/img/icons";
|
||||||
import { useQueryTopologyMetrics } from "@/hooks/useMetricsProcessor";
|
|
||||||
import { layout, changeNode, computeLevels } from "./utils/layout";
|
import { layout, changeNode, computeLevels } from "./utils/layout";
|
||||||
import zoom from "@/views/dashboard/related/components/utils/zoom";
|
import zoom from "@/views/dashboard/related/components/utils/zoom";
|
||||||
import { useQueryTopologyExpressionsProcessor } from "@/hooks/useExpressionsProcessor";
|
import { useQueryTopologyExpressionsProcessor } from "@/hooks/useExpressionsProcessor";
|
||||||
@ -133,7 +130,6 @@ limitations under the License. -->
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const selectorStore = useSelectorStore();
|
|
||||||
const topologyStore = useTopologyStore();
|
const topologyStore = useTopologyStore();
|
||||||
const dashboardStore = useDashboardStore();
|
const dashboardStore = useDashboardStore();
|
||||||
const appStore = useAppStoreWithOut();
|
const appStore = useAppStoreWithOut();
|
||||||
@ -183,7 +179,6 @@ limitations under the License. -->
|
|||||||
|
|
||||||
async function update() {
|
async function update() {
|
||||||
topologyStore.queryHierarchyNodeExpressions(settings.value.hierarchyServicesConfig || []);
|
topologyStore.queryHierarchyNodeExpressions(settings.value.hierarchyServicesConfig || []);
|
||||||
// await initLegendMetrics();
|
|
||||||
draw();
|
draw();
|
||||||
popover.value = d3.select("#popover");
|
popover.value = d3.select("#popover");
|
||||||
}
|
}
|
||||||
@ -219,48 +214,14 @@ limitations under the License. -->
|
|||||||
dashboardStore.selectWidget(props.config);
|
dashboardStore.selectWidget(props.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initLegendMetrics() {
|
|
||||||
if (!topologyStore.nodes.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (settings.value.metricMode === MetricModes.Expression) {
|
|
||||||
const expression = props.config.legendMQE && props.config.legendMQE.expression;
|
|
||||||
if (!expression) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const { getExpressionQuery } = useQueryTopologyExpressionsProcessor([expression], topologyStore.nodes);
|
|
||||||
const param = getExpressionQuery();
|
|
||||||
const res = await topologyStore.getNodeExpressionValue(param);
|
|
||||||
if (res.errors) {
|
|
||||||
ElMessage.error(res.errors);
|
|
||||||
} else {
|
|
||||||
topologyStore.setLegendValues([expression], res.data);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const names = props.config.legend.map((d: any) => d.name);
|
|
||||||
if (!names.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const ids = topologyStore.nodes.map((d: Node) => d.id);
|
|
||||||
if (ids.length) {
|
|
||||||
const param = await useQueryTopologyMetrics(names, ids);
|
|
||||||
const res = await topologyStore.getLegendMetrics(param);
|
|
||||||
if (res.errors) {
|
|
||||||
ElMessage.error(res.errors);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getNodeStatus(d: any) {
|
function getNodeStatus(d: any) {
|
||||||
const { legendMQE } = settings.value;
|
const item =
|
||||||
if (!legendMQE) {
|
(settings.value.hierarchyServicesConfig || []).find((i: { layer: string }) => d.layer === i.layer) || {};
|
||||||
|
|
||||||
|
if (!item.legendMQE) {
|
||||||
return icons.CUBE;
|
return icons.CUBE;
|
||||||
}
|
}
|
||||||
if (!legendMQE.expression) {
|
return Number(d[item.legendMQE]) && d.isReal ? icons.CUBEERROR : icons.CUBE;
|
||||||
return icons.CUBE;
|
|
||||||
}
|
|
||||||
return Number(d[legendMQE.expression]) && d.isReal ? icons.CUBEERROR : icons.CUBE;
|
|
||||||
}
|
}
|
||||||
function showNodeTip(event: MouseEvent, data: Node) {
|
function showNodeTip(event: MouseEvent, data: Node) {
|
||||||
const config: HierarchyServicesConfig =
|
const config: HierarchyServicesConfig =
|
||||||
@ -373,8 +334,8 @@ limitations under the License. -->
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 40px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
width: 300px;
|
width: 280px;
|
||||||
height: 400px;
|
height: 420px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 0 15px;
|
padding: 0 15px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
|
Loading…
Reference in New Issue
Block a user