From 61449f4b172a143d96cca139bed50839f5f2a5d6 Mon Sep 17 00:00:00 2001 From: Fine0830 Date: Tue, 15 Oct 2024 16:25:21 +0800 Subject: [PATCH] feat: add content decorations to Table and Card widgets (#419) --- src/locales/lang/en.ts | 1 + src/locales/lang/es.ts | 1 + src/locales/lang/zh.ts | 1 + src/types/dashboard.d.ts | 1 + src/views/dashboard/Widget.vue | 1 + src/views/dashboard/configuration/Widget.vue | 3 +- .../widget/graph-styles/Card.vue | 7 +- .../widget/graph-styles/Table.vue | 5 + .../components/ContentDecorations.vue | 100 ++++++++++++++++++ src/views/dashboard/graphs/Card.vue | 4 +- src/views/dashboard/graphs/Table.vue | 8 +- 11 files changed, 128 insertions(+), 4 deletions(-) create mode 100644 src/views/dashboard/configuration/widget/graph-styles/components/ContentDecorations.vue diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 4d816ad7..0c6df128 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -386,5 +386,6 @@ const msg = { tabExpressions: "Tab Expressions", hierarchyNodeMetrics: "Metrics for Hierarchy Graph Node", hierarchyNodeDashboard: "As dashboard for Hierarchy Graph Node", + contentDecorations: "Content Decorations", }; export default msg; diff --git a/src/locales/lang/es.ts b/src/locales/lang/es.ts index fbf22826..c643df61 100644 --- a/src/locales/lang/es.ts +++ b/src/locales/lang/es.ts @@ -386,5 +386,6 @@ const msg = { tabExpressions: "Tab Expressions", hierarchyNodeMetrics: "Metrics for Hierarchy Graph Node", hierarchyNodeDashboard: "As dashboard for Hierarchy Graph Node", + contentDecorations: "Content Decorations", }; export default msg; diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 0a2d5c0f..1a4ee12f 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -384,5 +384,6 @@ const msg = { tabExpressions: "Tab表达式", hierarchyNodeMetrics: "层次图节点的指标", hierarchyNodeDashboard: "作为层次图节点的dashboard", + contentDecorations: "内容装饰", }; export default msg; diff --git a/src/types/dashboard.d.ts b/src/types/dashboard.d.ts index 5a24e53d..90243c77 100644 --- a/src/types/dashboard.d.ts +++ b/src/types/dashboard.d.ts @@ -123,6 +123,7 @@ export interface CardConfig { fontSize?: number; showUnit?: boolean; textAlign?: "center" | "right" | "left"; + decorations?: { [key: string]: string }; } export interface TextConfig { diff --git a/src/views/dashboard/Widget.vue b/src/views/dashboard/Widget.vue index a2f01a42..fc0b00ca 100644 --- a/src/views/dashboard/Widget.vue +++ b/src/views/dashboard/Widget.vue @@ -32,6 +32,7 @@ limitations under the License. --> :config="{ i: 0, ...graph, + decorations: graph?.decorations, metricConfig: config.metricConfig, expressions: config.expressions || [], typesOfMQE: typesOfMQE || [], diff --git a/src/views/dashboard/configuration/Widget.vue b/src/views/dashboard/configuration/Widget.vue index 62248e94..dc36d47f 100644 --- a/src/views/dashboard/configuration/Widget.vue +++ b/src/views/dashboard/configuration/Widget.vue @@ -32,7 +32,8 @@ limitations under the License. --> :data="states.source" :config="{ ...graph, - legend: (dashboardStore.selectedGrid.graph || {}).legend, + decorations: dashboardStore.selectedGrid.graph?.decorations, + legend: dashboardStore.selectedGrid.graph?.legend, i: dashboardStore.selectedGrid.i, metricConfig: dashboardStore.selectedGrid.metricConfig, relatedTrace: dashboardStore.selectedGrid.relatedTrace, diff --git a/src/views/dashboard/configuration/widget/graph-styles/Card.vue b/src/views/dashboard/configuration/widget/graph-styles/Card.vue index 79a43992..b90195f3 100644 --- a/src/views/dashboard/configuration/widget/graph-styles/Card.vue +++ b/src/views/dashboard/configuration/widget/graph-styles/Card.vue @@ -13,6 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->