fix metrics

This commit is contained in:
Fine 2022-08-15 10:48:34 +08:00
parent 21778fb399
commit b359b03402

View File

@ -179,12 +179,16 @@ const setVisTypes = computed(() => {
async function setMetricType(chart?: any) { async function setMetricType(chart?: any) {
const g = chart || dashboardStore.selectedGrid.graph || {}; const g = chart || dashboardStore.selectedGrid.graph || {};
const json = await dashboardStore.fetchMetricList(); let arr: any[] = states.metricList;
if (json.errors) { if (!chart) {
ElMessage.error(json.errors); const json = await dashboardStore.fetchMetricList();
return; if (json.errors) {
ElMessage.error(json.errors);
return;
}
arr = json.data.metrics;
} }
states.metricList = (json.data.metrics || []).filter( states.metricList = (arr || []).filter(
(d: { catalog: string; type: string }) => { (d: { catalog: string; type: string }) => {
if (states.isList) { if (states.isList) {
if (d.type === MetricsType.REGULAR_VALUE) { if (d.type === MetricsType.REGULAR_VALUE) {