From 4ace3c682f643bd1a75b4abace63ec30ac3f4ccc Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Sat, 26 Mar 2022 22:05:29 +0800 Subject: [PATCH] update unit --- src/hooks/data.ts | 1 + src/hooks/useProcessor.ts | 3 +++ src/locales/lang/en.ts | 1 + src/locales/lang/zh.ts | 1 + src/types/dashboard.ts | 2 +- .../configuration/widget/graph-styles/Card.vue | 14 ++++++++++++-- .../configuration/widget/metric/Standard.vue | 1 - src/views/dashboard/data.ts | 1 + src/views/dashboard/graphs/Card.vue | 15 ++++++++++----- src/views/dashboard/graphs/EndpointList.vue | 13 ++++++++++++- src/views/dashboard/graphs/InstanceList.vue | 14 +++++++++++++- src/views/dashboard/graphs/ServiceList.vue | 13 ++++++++++++- 12 files changed, 67 insertions(+), 12 deletions(-) diff --git a/src/hooks/data.ts b/src/hooks/data.ts index 45aa326b..5f1fdd88 100644 --- a/src/hooks/data.ts +++ b/src/hooks/data.ts @@ -27,6 +27,7 @@ export enum Calculations { Percentage = "percentage", ByteToKB = "byteToKB", Apdex = "apdex", + Precision = "precision", ConvertSeconds = "convertSeconds", ConvertMilliseconds = "convertMilliseconds", } diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts index b534ebd6..f91f4515 100644 --- a/src/hooks/useProcessor.ts +++ b/src/hooks/useProcessor.ts @@ -330,6 +330,9 @@ export function aggregation(val: number, config: any): number | string { case Calculations.ConvertMilliseconds: data = dayjs.unix(val).format("YYYY-MM-DD HH:mm:ss"); break; + case Calculations.Precision: + data = data.toFixed(2); + break; default: data; break; diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 6c0f4b2a..4bc27589 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -128,6 +128,7 @@ const msg = { textUrl: "Text Hyperlink", textAlign: "Text Align", metricLabel: "Metric Label", + showUnit: "Show Unit", hourTip: "Select Hour", minuteTip: "Select Minute", secondTip: "Select Second", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 9683dd6a..43f09eb6 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -128,6 +128,7 @@ const msg = { textUrl: "文本超链接", textAlign: "文本对齐", metricLabel: "指标标签", + showUnit: "显示单位", hourTip: "选择小时", minuteTip: "选择分钟", secondTip: "选择秒数", diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts index 48be4187..3a1fe7e1 100644 --- a/src/types/dashboard.ts +++ b/src/types/dashboard.ts @@ -96,7 +96,7 @@ export interface AreaConfig { export interface CardConfig { type?: string; fontSize?: number; - showUint?: boolean; + showUnit?: boolean; textAlign?: "center" | "right" | "left"; } diff --git a/src/views/dashboard/configuration/widget/graph-styles/Card.vue b/src/views/dashboard/configuration/widget/graph-styles/Card.vue index 1a5bcb75..6259b141 100644 --- a/src/views/dashboard/configuration/widget/graph-styles/Card.vue +++ b/src/views/dashboard/configuration/widget/graph-styles/Card.vue @@ -26,6 +26,15 @@ limitations under the License. --> @change="updateConfig({ fontSize })" /> +
+ {{ t("showUnit") }} + +