diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue
index 6e60c63c..ad7c7344 100644
--- a/src/views/dashboard/configuration/Widget.vue
+++ b/src/views/dashboard/configuration/Widget.vue
@@ -16,10 +16,12 @@ limitations under the License. -->
@@ -31,7 +33,11 @@ limitations under the License. -->
v-model="currentMetric.label"
size="small"
placeholder="Please input a name"
- @change="changeConfigs(index, { label: currentMetric.label })"
+ @change="
+ updateConfig(index, {
+ label: encodeURIComponent(currentMetric.label),
+ })
+ "
/>
@@ -42,7 +48,9 @@ limitations under the License. -->
size="small"
placeholder="auto"
@change="
- changeConfigs(index, { labelsIndex: currentMetric.labelsIndex })
+ updateConfig(index, {
+ labelsIndex: encodeURIComponent(currentMetric.labelsIndex),
+ })
"
/>
@@ -108,13 +116,21 @@ const metricType = ref(metricTypes[props.index]);
const isTopn = computed(() =>
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
);
+function updateConfig(index: number, param: { [key: string]: string }) {
+ const key = Object.keys(param)[0];
+ if (!key) {
+ return;
+ }
+ changeConfigs(index, { key: decodeURIComponent(param[key]) });
+}
function changeConfigs(
index: number,
param: { [key: string]: string | number }
) {
const metricConfig = dashboardStore.selectedGrid.metricConfig || [];
- metricConfig[index] = { ...metricConfig[index], ...param };
+ metricConfig[index] = { ...metricConfig[index], ...param };
+ currentMetric.value = metricConfig[index];
dashboardStore.selectWidget({
...dashboardStore.selectedGrid,
metricConfig,
diff --git a/src/views/dashboard/graphs/Card.vue b/src/views/dashboard/graphs/Card.vue
index 2c33eaf0..241dacc1 100644
--- a/src/views/dashboard/graphs/Card.vue
+++ b/src/views/dashboard/graphs/Card.vue
@@ -22,13 +22,14 @@ limitations under the License. -->
>
{{ singleVal.toFixed(2) }}
- {{ metricConfig[0]?.unit }}
+ {{ decodeURIComponent(unit) }}
- No Data
+ {{ t("noData") }}