diff --git a/src/hooks/useExpressionsProcessor.ts b/src/hooks/useExpressionsProcessor.ts index da1f575b..3ddf8662 100644 --- a/src/hooks/useExpressionsProcessor.ts +++ b/src/hooks/useExpressionsProcessor.ts @@ -358,7 +358,7 @@ export function useQueryTopologyExpressionsProcessor(metrics: string[], instance serviceInstanceName, endpointName, destServiceName, - destNormal: true, + destNormal: destServiceName ? true : undefined, destServiceInstanceName, destEndpointName, }; diff --git a/src/views/dashboard/related/topology/components/Graph.vue b/src/views/dashboard/related/topology/components/Graph.vue index ffd7c14e..2ca64cf0 100644 --- a/src/views/dashboard/related/topology/components/Graph.vue +++ b/src/views/dashboard/related/topology/components/Graph.vue @@ -397,6 +397,13 @@ limitations under the License. --> if (!legend.length) { return icons.CUBE; } + if (settings.value.metricMode === MetricModes.Expression) { + let c = true; + for (const l of legend) { + c = c && !!Number(d[l.name]); + } + return c && d.isReal ? icons.CUBEERROR : icons.CUBE; + } let c = true; for (const l of legend) { if (l.condition === "<") { diff --git a/src/views/dashboard/related/topology/components/Settings.vue b/src/views/dashboard/related/topology/components/Settings.vue index 01d9426b..fdd0f366 100644 --- a/src/views/dashboard/related/topology/components/Settings.vue +++ b/src/views/dashboard/related/topology/components/Settings.vue @@ -204,33 +204,34 @@ limitations under the License. --> placeholder="Please input a expression" @change="changeLegend(LegendOpt.NAME, $event, index)" size="small" - class="item" - /> - - - + + + + + updateSettings(); } function updateSettings(metricConfig?: { [key: string]: MetricConfigOpt[] }) { - const metrics = legend.value.filter((d: any) => d.name && d.value && d.condition); + let metrics = []; + if (isExpression.value) { + metrics = legend.value.filter((d: any) => d.name); + } else { + metrics = legend.value.filter((d: any) => d.name && d.value && d.condition); + } + const param = { ...dashboardStore.selectedGrid, linkDashboard: states.linkDashboard, @@ -600,6 +607,11 @@ limitations under the License. --> width: 355px; } + .legend-inputs { + margin-top: 8px; + width: 310px; + } + .item { width: 130px; margin-top: 5px;