From 95a03ff3dfdbe3c1726a87324eb1255da79237c8 Mon Sep 17 00:00:00 2001 From: Fine Date: Sat, 3 Jun 2023 13:59:44 +0800 Subject: [PATCH] fix: list --- .../configuration/widget/metric/Index.vue | 16 ++++++++++++++-- src/views/dashboard/graphs/EndpointList.vue | 7 +++++++ src/views/dashboard/graphs/InstanceList.vue | 7 +++++++ src/views/dashboard/graphs/ServiceList.vue | 9 +++++++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index 1c4a1fef..0b96beb0 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -421,9 +421,15 @@ limitations under the License. --> states.metrics = [""]; states.metricTypes = [""]; states.tips = [""]; + let v = {}; + if (isExpression.value) { + v = { typesOfMQE: states.metricTypes, expressions: states.metrics }; + } else { + v = { metricTypes: states.metricTypes, metrics: states.metrics }; + } dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, - ...{ metricTypes: states.metricTypes, metrics: states.metrics }, + ...v, metricConfig: [], }); return; @@ -433,9 +439,15 @@ limitations under the License. --> states.tips.splice(index, 1); const config = dashboardStore.selectedGrid.metricConfig || []; const metricConfig = config[index] ? config.splice(index, 1) : config; + let p = {}; + if (isExpression.value) { + p = { typesOfMQE: states.metricTypes, expressions: states.metrics }; + } else { + p = { metricTypes: states.metricTypes, metrics: states.metrics }; + } dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, - ...{ metricTypes: states.metricTypes, metrics: states.metrics }, + ...p, metricConfig, }); } diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue index 78153a25..fe61a09e 100644 --- a/src/views/dashboard/graphs/EndpointList.vue +++ b/src/views/dashboard/graphs/EndpointList.vue @@ -157,6 +157,9 @@ limitations under the License. --> return; } endpoints.value = currentPods; + colMetrics.value = []; + metricTypes.value = []; + metricConfig.value = []; } async function queryEndpointExpressions(currentPods: Endpoint[]) { const expressions = props.config.expressions || []; @@ -176,6 +179,9 @@ limitations under the License. --> return; } endpoints.value = currentPods; + colMetrics.value = []; + metricTypes.value = []; + metricConfig.value = []; } function clickEndpoint(scope: any) { const { dashboard } = getDashboard({ @@ -200,6 +206,7 @@ limitations under the License. --> ...(props.config.metrics || []), ...(props.config.metricConfig || []), ...(props.config.expressions || []), + props.config.metricMode, ], (data, old) => { if (JSON.stringify(data) === JSON.stringify(old)) { diff --git a/src/views/dashboard/graphs/InstanceList.vue b/src/views/dashboard/graphs/InstanceList.vue index 4f7107de..8d28e203 100644 --- a/src/views/dashboard/graphs/InstanceList.vue +++ b/src/views/dashboard/graphs/InstanceList.vue @@ -191,6 +191,9 @@ limitations under the License. --> return; } instances.value = currentInstances; + colMetrics.value = []; + metricTypes.value = []; + metricConfig.value = []; } async function queryInstanceExpressions(currentInstances: Instance[]) { @@ -211,6 +214,9 @@ limitations under the License. --> return; } instances.value = currentInstances; + colMetrics.value = []; + metricTypes.value = []; + metricConfig.value = []; } function clickInstance(scope: any) { @@ -251,6 +257,7 @@ limitations under the License. --> ...(props.config.metrics || []), ...(props.config.metricConfig || []), ...(props.config.expressions || []), + props.config.metricMode, ], (data, old) => { if (JSON.stringify(data) === JSON.stringify(old)) { diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue index 251e63f7..53f4c684 100644 --- a/src/views/dashboard/graphs/ServiceList.vue +++ b/src/views/dashboard/graphs/ServiceList.vue @@ -230,6 +230,7 @@ limitations under the License. --> ...props.config, metricConfig: metricConfig.value || [], }); + services.value = data; colMetrics.value = names; metricTypes.value = metricTypesArr; @@ -238,6 +239,10 @@ limitations under the License. --> return; } services.value = currentServices; + colMetrics.value = []; + colMetrics.value = []; + metricTypes.value = []; + metricConfig.value = []; } async function queryServiceExpressions(currentServices: Service[]) { const expressions = props.config.expressions || []; @@ -257,6 +262,9 @@ limitations under the License. --> return; } services.value = currentServices; + colMetrics.value = []; + metricTypes.value = []; + metricConfig.value = []; } function objectSpanMethod(param: any): any { if (!props.config.showGroup) { @@ -294,6 +302,7 @@ limitations under the License. --> ...(props.config.metrics || []), ...(props.config.metricConfig || []), ...(props.config.expressions || []), + props.config.metricMode, ], (data, old) => { if (JSON.stringify(data) === JSON.stringify(old)) {