fix: list

This commit is contained in:
Fine 2023-06-03 13:59:44 +08:00
parent b23660f0c9
commit 95a03ff3df
4 changed files with 37 additions and 2 deletions

View File

@ -421,9 +421,15 @@ limitations under the License. -->
states.metrics = [""]; states.metrics = [""];
states.metricTypes = [""]; states.metricTypes = [""];
states.tips = [""]; 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.selectWidget({
...dashboardStore.selectedGrid, ...dashboardStore.selectedGrid,
...{ metricTypes: states.metricTypes, metrics: states.metrics }, ...v,
metricConfig: [], metricConfig: [],
}); });
return; return;
@ -433,9 +439,15 @@ limitations under the License. -->
states.tips.splice(index, 1); states.tips.splice(index, 1);
const config = dashboardStore.selectedGrid.metricConfig || []; const config = dashboardStore.selectedGrid.metricConfig || [];
const metricConfig = config[index] ? config.splice(index, 1) : config; 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.selectWidget({
...dashboardStore.selectedGrid, ...dashboardStore.selectedGrid,
...{ metricTypes: states.metricTypes, metrics: states.metrics }, ...p,
metricConfig, metricConfig,
}); });
} }

View File

@ -157,6 +157,9 @@ limitations under the License. -->
return; return;
} }
endpoints.value = currentPods; endpoints.value = currentPods;
colMetrics.value = [];
metricTypes.value = [];
metricConfig.value = [];
} }
async function queryEndpointExpressions(currentPods: Endpoint[]) { async function queryEndpointExpressions(currentPods: Endpoint[]) {
const expressions = props.config.expressions || []; const expressions = props.config.expressions || [];
@ -176,6 +179,9 @@ limitations under the License. -->
return; return;
} }
endpoints.value = currentPods; endpoints.value = currentPods;
colMetrics.value = [];
metricTypes.value = [];
metricConfig.value = [];
} }
function clickEndpoint(scope: any) { function clickEndpoint(scope: any) {
const { dashboard } = getDashboard({ const { dashboard } = getDashboard({
@ -200,6 +206,7 @@ limitations under the License. -->
...(props.config.metrics || []), ...(props.config.metrics || []),
...(props.config.metricConfig || []), ...(props.config.metricConfig || []),
...(props.config.expressions || []), ...(props.config.expressions || []),
props.config.metricMode,
], ],
(data, old) => { (data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) { if (JSON.stringify(data) === JSON.stringify(old)) {

View File

@ -191,6 +191,9 @@ limitations under the License. -->
return; return;
} }
instances.value = currentInstances; instances.value = currentInstances;
colMetrics.value = [];
metricTypes.value = [];
metricConfig.value = [];
} }
async function queryInstanceExpressions(currentInstances: Instance[]) { async function queryInstanceExpressions(currentInstances: Instance[]) {
@ -211,6 +214,9 @@ limitations under the License. -->
return; return;
} }
instances.value = currentInstances; instances.value = currentInstances;
colMetrics.value = [];
metricTypes.value = [];
metricConfig.value = [];
} }
function clickInstance(scope: any) { function clickInstance(scope: any) {
@ -251,6 +257,7 @@ limitations under the License. -->
...(props.config.metrics || []), ...(props.config.metrics || []),
...(props.config.metricConfig || []), ...(props.config.metricConfig || []),
...(props.config.expressions || []), ...(props.config.expressions || []),
props.config.metricMode,
], ],
(data, old) => { (data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) { if (JSON.stringify(data) === JSON.stringify(old)) {

View File

@ -230,6 +230,7 @@ limitations under the License. -->
...props.config, ...props.config,
metricConfig: metricConfig.value || [], metricConfig: metricConfig.value || [],
}); });
services.value = data; services.value = data;
colMetrics.value = names; colMetrics.value = names;
metricTypes.value = metricTypesArr; metricTypes.value = metricTypesArr;
@ -238,6 +239,10 @@ limitations under the License. -->
return; return;
} }
services.value = currentServices; services.value = currentServices;
colMetrics.value = [];
colMetrics.value = [];
metricTypes.value = [];
metricConfig.value = [];
} }
async function queryServiceExpressions(currentServices: Service[]) { async function queryServiceExpressions(currentServices: Service[]) {
const expressions = props.config.expressions || []; const expressions = props.config.expressions || [];
@ -257,6 +262,9 @@ limitations under the License. -->
return; return;
} }
services.value = currentServices; services.value = currentServices;
colMetrics.value = [];
metricTypes.value = [];
metricConfig.value = [];
} }
function objectSpanMethod(param: any): any { function objectSpanMethod(param: any): any {
if (!props.config.showGroup) { if (!props.config.showGroup) {
@ -294,6 +302,7 @@ limitations under the License. -->
...(props.config.metrics || []), ...(props.config.metrics || []),
...(props.config.metricConfig || []), ...(props.config.metricConfig || []),
...(props.config.expressions || []), ...(props.config.expressions || []),
props.config.metricMode,
], ],
(data, old) => { (data, old) => {
if (JSON.stringify(data) === JSON.stringify(old)) { if (JSON.stringify(data) === JSON.stringify(old)) {