+
{{ t("labelsIndex") }}
({
});
const metricTypes = dashboardStore.selectedGrid.metricTypes || [];
const metricType = ref(metricTypes[props.index]);
+const hasLabel = computed(() => {
+ const graph = dashboardStore.selectedGrid.graph || {};
+ return (
+ ListChartTypes.includes(graph.type) ||
+ metricType.value === "readLabeledMetricsValues"
+ );
+});
const isTopn = computed(() =>
["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index])
);
@@ -121,7 +129,7 @@ function updateConfig(index: number, param: { [key: string]: string }) {
if (!key) {
return;
}
- changeConfigs(index, { key: decodeURIComponent(param[key]) });
+ changeConfigs(index, { [key]: decodeURIComponent(param[key]) });
}
function changeConfigs(
index: number,
@@ -130,7 +138,6 @@ function changeConfigs(
const metricConfig = dashboardStore.selectedGrid.metricConfig || [];
metricConfig[index] = { ...metricConfig[index], ...param };
- currentMetric.value = metricConfig[index];
dashboardStore.selectWidget({
...dashboardStore.selectedGrid,
metricConfig,
diff --git a/src/views/dashboard/graphs/ServiceList.vue b/src/views/dashboard/graphs/ServiceList.vue
index 8147ef0e..00f6fd68 100644
--- a/src/views/dashboard/graphs/ServiceList.vue
+++ b/src/views/dashboard/graphs/ServiceList.vue
@@ -56,7 +56,9 @@ limitations under the License. -->
@@ -276,15 +278,24 @@ function searchList() {
}
function getUnit(index: number) {
const u =
- (props.config.metricConfig &&
- props.config.metricConfig[index] &&
- props.config.metricConfig[index].unit) ||
- "";
+ props.config.metricConfig &&
+ props.config.metricConfig[index] &&
+ props.config.metricConfig[index].unit;
if (u) {
return `(${encodeURIComponent(u)})`;
}
return encodeURIComponent("");
}
+function getLabel(metric: string, index: number) {
+ const label =
+ props.config.metricConfig &&
+ props.config.metricConfig[index] &&
+ props.config.metricConfig[index].label;
+ if (label) {
+ return encodeURIComponent(label);
+ }
+ return encodeURIComponent(metric);
+}
watch(
() => [props.config.metricTypes, props.config.metrics],
() => {