fix: update style and set labels (#50)

This commit is contained in:
Fine0830
2022-04-01 13:27:49 +08:00
committed by GitHub
parent b51e423c2b
commit 63d21becde
8 changed files with 65 additions and 41 deletions

View File

@@ -44,7 +44,9 @@ limitations under the License. -->
</el-table-column>
<el-table-column
v-for="(metric, index) in colMetrics"
:label="`${metric} ${decodeURIComponent(getUnit(index))}`"
:label="`${decodeURIComponent(
getLabel(metric, index)
)} ${decodeURIComponent(getUnit(index))}`"
:key="metric + index"
>
<template #default="scope">
@@ -234,16 +236,26 @@ 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],
() => {