diff --git a/src/hooks/useExpressionsProcessor.ts b/src/hooks/useExpressionsProcessor.ts index 023ef055..debc048e 100644 --- a/src/hooks/useExpressionsProcessor.ts +++ b/src/hooks/useExpressionsProcessor.ts @@ -198,7 +198,7 @@ export async function useExpressionsQueryPodsMetrics( const names: string[] = []; const metricConfigArr: MetricConfigOpt[] = []; const metricTypesArr: string[] = []; - const data = pods.map((d: Instance & Indexable, idx: number) => { + const data = pods.map((d: any, idx: number) => { config.expressions.map((exp: string, index: number) => { const c: any = (config.metricConfig && config.metricConfig[index]) || {}; const k = "expression" + idx + index; diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index 536e393f..57e54f99 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -166,6 +166,8 @@ limitations under the License. --> states.isList = ListChartTypes.includes(graph.value.type); const defaultLen = ref(states.isList ? 5 : 20); + const backupMetricConfig = ref([]); + setDashboards(); setMetricType(); @@ -461,11 +463,14 @@ limitations under the License. --> } function changeMetricMode() { states.metrics = metrics.value.length ? metrics.value : [""]; - (states.metricTypes = metricTypes.value.length ? metricTypes.value : [""]), - dashboardStore.selectWidget({ - ...dashboardStore.selectedGrid, - metricMode: isExpression.value ? "Expression" : "General", - }); + states.metricTypes = metricTypes.value.length ? metricTypes.value : [""]; + const config = dashboardStore.selectedGrid.metricTypes; + dashboardStore.selectWidget({ + ...dashboardStore.selectedGrid, + metricMode: isExpression.value ? "Expression" : "General", + metricTypes: backupMetricConfig.value, + }); + backupMetricConfig.value = config; } async function changeExpression(event: any, index: number) { const params = event.target.textContent;