fix: update name (#315)

This commit is contained in:
Fine0830 2023-08-31 18:12:22 +08:00 committed by GitHub
parent ce4608ad4b
commit 6b1a2fa9f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,7 @@ limitations under the License. -->
<span class="label">{{ <span class="label">{{
t(dashboardStore.selectedGrid.metricMode === MetricModes.General ? "metrics" : "expressions") t(dashboardStore.selectedGrid.metricMode === MetricModes.General ? "metrics" : "expressions")
}}</span> }}</span>
<SelectSingle :value="currentMetric" :options="metrics" @change="changeMetric" class="selectors" /> <SelectSingle :value="currentMetric" :options="metricList" @change="changeMetric" class="selectors" />
</div> </div>
<div class="item mb-10"> <div class="item mb-10">
<span class="label">{{ t("unit") }}</span> <span class="label">{{ t("unit") }}</span>
@ -71,8 +71,8 @@ limitations under the License. -->
const m = props.metrics.map((d: string) => { const m = props.metrics.map((d: string) => {
return { label: d, value: d }; return { label: d, value: d };
}); });
const metrics = ref<Option[]>(m.length ? m : [{ label: "", value: "" }]); const metricList = ref<Option[]>(m.length ? m : [{ label: "", value: "" }]);
const currentMetric = ref<string>(metrics.value[0].value); const currentMetric = ref<string>(metricList.value[0].value);
const currentConfig = ref<{ unit: string; calculation: string; label: string }>({ const currentConfig = ref<{ unit: string; calculation: string; label: string }>({
unit: "", unit: "",
calculation: "", calculation: "",
@ -106,7 +106,7 @@ limitations under the License. -->
} }
function changeMetric(val: string) { function changeMetric(val: string) {
currentMetric.value = val; currentMetric.value = val;
const index = metrics.value.findIndex((d: Option) => d.value === val); const index = metricList.value.findIndex((d: Option) => d.value === val);
currentIndex.value = index || 0; currentIndex.value = index || 0;
const config = getMetricConfig.value || []; const config = getMetricConfig.value || [];
@ -123,8 +123,8 @@ limitations under the License. -->
const m = props.metrics.map((d: string) => { const m = props.metrics.map((d: string) => {
return { label: d, value: d }; return { label: d, value: d };
}); });
metrics.value = m.length ? m : [{ label: "", value: "" }]; metricList.value = m.length ? m : [{ label: "", value: "" }];
currentMetric.value = metrics.value[0].value; currentMetric.value = metricList.value[0].value;
const config = getMetricConfig.value || []; const config = getMetricConfig.value || [];
currentIndex.value = 0; currentIndex.value = 0;
currentConfig.value = { currentConfig.value = {