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