fix: import dashboard templates (#363)

This commit is contained in:
Fine0830
2024-01-16 18:23:55 +08:00
committed by GitHub
parent 5061b19cf7
commit a46b91d1cf
3 changed files with 22 additions and 13 deletions

View File

@@ -110,11 +110,6 @@ limitations under the License. -->
return m.length ? m : [{ label: "", value: "" }];
});
const currentMetric = ref<string>(metricList.value[0].value);
const currentConfig = ref<{ unit: string; calculation: string; label: string }>({
unit: "",
calculation: "",
label: "",
});
const currentIndex = ref<number>(0);
const getMetricConfig = computed(() => {
if (props.type === "hierarchyServicesConfig") {
@@ -125,7 +120,12 @@ limitations under the License. -->
},
ConfigFieldTypes.ISDEFAULT,
);
return (dashboard && dashboard.expressionsConfig) || [];
if (!dashboard) {
return [];
}
const config = dashboard.expressionsConfig || [];
return config || [];
}
let config = [];
@@ -143,6 +143,14 @@ limitations under the License. -->
return config || [];
});
const currentConfig = ref<{ unit: string; calculation: string; label: string }>(
getMetricConfig.value[0] || {
unit: "",
calculation: "",
label: "",
},
);
function changeConfigs(param: { [key: string]: string }) {
const metricConfig = getMetricConfig.value || [];
metricConfig[currentIndex.value] = {