fix: config

This commit is contained in:
Fine 2023-06-08 14:48:19 +08:00
parent e7a79c4346
commit 31987e978e

View File

@ -34,7 +34,7 @@ limitations under the License. -->
class="input"
v-model="currentMetric.label"
size="small"
placeholder="Please input a name"
placeholder="Please input a label"
@change="
updateConfig(index, {
label: encodeURIComponent(currentMetric.label || ''),
@ -42,13 +42,13 @@ limitations under the License. -->
"
/>
</div>
<div class="item mb-10" v-if="hasLabel && dashboardStore.selectedGrid.metricMode === MetricModes.Expression">
<div class="item mb-10" v-if="isList && isExpression">
<span class="label">{{ t("detailLabel") }}</span>
<el-input
class="input"
v-model="currentMetric.detailLabel"
size="small"
placeholder="Please input a name"
placeholder="Please input a label"
@change="
updateConfig(index, {
detailLabel: encodeURIComponent(currentMetric.detailLabel || ''),
@ -56,13 +56,7 @@ limitations under the License. -->
"
/>
</div>
<div
class="item mb-10"
v-if="
[ProtocolTypes.ReadLabeledMetricsValues].includes(metricType) &&
dashboardStore.selectedGrid.metricMode === MetricModes.General
"
>
<div class="item mb-10" v-if="[ProtocolTypes.ReadLabeledMetricsValues].includes(metricType) && !isExpression">
<span class="label">{{ t("labelsIndex") }}</span>
<el-input
class="input"
@ -150,6 +144,10 @@ limitations under the License. -->
].includes(metricType.value)
);
});
const isList = computed(() => {
const graph = dashboardStore.selectedGrid.graph || {};
return ListChartTypes.includes(graph.type);
});
const isTopn = computed(() =>
[ProtocolTypes.SortMetrics, ProtocolTypes.ReadSampledRecords, ProtocolTypes.ReadRecords].includes(
metricTypes.value[props.index],
@ -176,6 +174,7 @@ limitations under the License. -->
watch(
() => props.currentMetricConfig,
() => {
isExpression.value = dashboardStore.selectedGrid.metricMode === MetricModes.Expression;
currentMetric.value = {
...props.currentMetricConfig,
topN: Number(props.currentMetricConfig.topN) || 10,