From b6522f45550ba78ce2d90163d80130573ca04145 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Fri, 18 Oct 2024 10:31:17 +0800 Subject: [PATCH] feat: support ranges for Value Mappings (#421) --- src/locales/lang/en.ts | 3 +- src/locales/lang/es.ts | 3 +- src/locales/lang/zh.ts | 3 +- src/types/dashboard.d.ts | 2 +- src/views/dashboard/Widget.vue | 2 +- .../widget/graph-styles/Card.vue | 5 +-- .../widget/graph-styles/Table.vue | 5 +-- ...ntentDecorations.vue => ValueMappings.vue} | 43 +++++++++++-------- src/views/dashboard/graphs/Card.vue | 19 ++++++-- src/views/dashboard/graphs/Table.vue | 18 ++++++-- 10 files changed, 68 insertions(+), 35 deletions(-) rename src/views/dashboard/configuration/widget/graph-styles/components/{ContentDecorations.vue => ValueMappings.vue} (72%) diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 0c6df128..065f32af 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -386,6 +386,7 @@ const msg = { tabExpressions: "Tab Expressions", hierarchyNodeMetrics: "Metrics for Hierarchy Graph Node", hierarchyNodeDashboard: "As dashboard for Hierarchy Graph Node", - contentDecorations: "Content Decorations", + valueMappings: "Value Mappings", + mappingTip: "Notice: The mapping key is a Regex string, for instance, ^-?(0|[1-9][0-9]*|2)(\\.0+)?$", }; export default msg; diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index c643df61..e6408ace 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -386,6 +386,7 @@ const msg = { tabExpressions: "Tab Expressions", hierarchyNodeMetrics: "Metrics for Hierarchy Graph Node", hierarchyNodeDashboard: "As dashboard for Hierarchy Graph Node", - contentDecorations: "Content Decorations", + valueMappings: "Value Mappings", + mappingTip: "Notice: The mapping key is a Regex string, for instance, ^-?(0|[1-9][0-9]*|2)(\\.0+)?$", }; export default msg; diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 1a4ee12f..43b5cadb 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -384,6 +384,7 @@ const msg = { tabExpressions: "Tab表达式", hierarchyNodeMetrics: "层次图节点的指标", hierarchyNodeDashboard: "作为层次图节点的dashboard", - contentDecorations: "内容装饰", + valueMappings: "值映射", + mappingTip: "注意: 映射键是一个正则表达式字符串,比如 ^-?(0|[1-9][0-9]*|2)(\\.0+)?$", }; export default msg; diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.d.ts index 90243c77..ccf98861 100644 --- a/src/types/dashboard.d.ts +++ b/src/types/dashboard.d.ts @@ -123,7 +123,7 @@ export interface CardConfig { fontSize?: number; showUnit?: boolean; textAlign?: "center" | "right" | "left"; - decorations?: { [key: string]: string }; + valueMappings?: { [key: string]: string }; } export interface TextConfig { diff --git a/src/views/dashboard/Widget.vue b/src/views/dashboard/Widget.vue index fc0b00ca..30f02385 100644 --- a/src/views/dashboard/Widget.vue +++ b/src/views/dashboard/Widget.vue @@ -32,7 +32,7 @@ limitations under the License. --> :config="{ i: 0, ...graph, - decorations: graph?.decorations, + valueMappings: graph?.valueMappings, metricConfig: config.metricConfig, expressions: config.expressions || [], typesOfMQE: typesOfMQE || [], diff --git a/src/views/dashboard/configuration/widget/graph-styles/Card.vue b/src/views/dashboard/configuration/widget/graph-styles/Card.vue index b90195f3..9f8398bb 100644 --- a/src/views/dashboard/configuration/widget/graph-styles/Card.vue +++ b/src/views/dashboard/configuration/widget/graph-styles/Card.vue @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. -->