From 538287b53913030972f3828b863e3fb32748b599 Mon Sep 17 00:00:00 2001 From: Fine Date: Tue, 29 Nov 2022 13:11:28 +0800 Subject: [PATCH] refactor --- .../configuration/widget/metric/Index.vue | 14 ++++++-------- .../configuration/widget/metric/Standard.vue | 13 ++++++++++--- src/views/dashboard/data.ts | 9 +++++++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/views/dashboard/configuration/widget/metric/Index.vue b/src/views/dashboard/configuration/widget/metric/Index.vue index 6c66f056..2d3bc28f 100644 --- a/src/views/dashboard/configuration/widget/metric/Index.vue +++ b/src/views/dashboard/configuration/widget/metric/Index.vue @@ -60,7 +60,10 @@ limitations under the License. --> /> { const graph = dashboardStore.selectedGrid.graph || {}; return ( ListChartTypes.includes(graph.type) || - ["readLabeledMetricsValues", "readMetricsValues"].includes(metricType.value) + [ + ProtocolTypes.ReadLabeledMetricsValues, + ProtocolTypes.ReadMetricsValues, + ].includes(metricType.value) ); }); const isTopn = computed(() => - ["sortMetrics", "readSampledRecords"].includes(metricTypes[props.index]) + [ + ProtocolTypes.SortMetrics, + ProtocolTypes.ReadSampledRecords, + ProtocolTypes.ReadRecords, + ].includes(metricTypes[props.index]) ); function updateConfig(index: number, param: { [key: string]: string }) { const key = Object.keys(param)[0]; diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts index b386e28a..f5a0a05d 100644 --- a/src/views/dashboard/data.ts +++ b/src/views/dashboard/data.ts @@ -47,6 +47,15 @@ export const MetricChartType: any = { readSampledRecords: [{ label: "Top List", value: "TopList" }], readRecords: [{ label: "Top List", value: "TopList" }], }; +export enum ProtocolTypes { + ReadRecords = "readRecords", + ReadSampledRecords = "readSampledRecords", + SortMetrics = "sortMetrics", + ReadLabeledMetricsValues = "readLabeledMetricsValues", + ReadHeatMap = "readHeatMap", + ReadMetricsValues = "readMetricsValues", + ReadMetricsValue = "readMetricsValue", +} export const DefaultGraphConfig: { [key: string]: any } = { Bar: { type: "Bar",