From 6fc4fd3644a41f744cb37ff0aa8d1477828c5815 Mon Sep 17 00:00:00 2001 From: Qiuxia Fan Date: Sat, 19 Feb 2022 15:56:41 +0800 Subject: [PATCH] feat: add topology control --- src/assets/icons/topology.svg | 15 +++ src/locales/lang/en.ts | 2 +- src/locales/lang/zh.ts | 2 +- src/store/data.ts | 52 +++++--- src/store/modules/dashboard.ts | 2 +- src/views/dashboard/Edit.vue | 6 +- .../dashboard/configuration/Topology.vue | 18 +++ .../{ConfigEdit.vue => Widget.vue} | 0 src/views/dashboard/controls/Topology.vue | 113 ++++++++++++++++++ src/views/dashboard/panel/Layout.vue | 3 +- .../related/topology/components/Settings.vue | 2 +- 11 files changed, 189 insertions(+), 26 deletions(-) create mode 100644 src/assets/icons/topology.svg create mode 100644 src/views/dashboard/configuration/Topology.vue rename src/views/dashboard/configuration/{ConfigEdit.vue => Widget.vue} (100%) create mode 100644 src/views/dashboard/controls/Topology.vue diff --git a/src/assets/icons/topology.svg b/src/assets/icons/topology.svg new file mode 100644 index 00000000..7bffd765 --- /dev/null +++ b/src/assets/icons/topology.svg @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 3edcbdb3..59f7662b 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -73,7 +73,7 @@ const msg = { fontSize: "Font Size", showBackground: "Show Background", areaOpacity: "Area Opacity", - editGraph: "Edit Graph Options", + editGraph: "Edit Options", dashboardName: "Select Dashboard Name", linkDashboard: "Dashboard name related with topology calls", linkServerMetrics: "Server metrics related with topology calls", diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index a06216ef..225185aa 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -72,7 +72,7 @@ const msg = { fontSize: "字体大小", showBackground: "显示背景", areaOpacity: "透明度", - editGraph: "编辑图表选项", + editGraph: "选项编辑", dashboardName: "选择仪表板名称", linkDashboard: "拓扑线关联的仪表板名称", linkServerMetrics: "拓扑线服务端关联的指标", diff --git a/src/store/data.ts b/src/store/data.ts index d2bb2805..b99cd3b4 100644 --- a/src/store/data.ts +++ b/src/store/data.ts @@ -101,27 +101,41 @@ export const ConfigData2: any = { }, children: [], }; -export const ConfigData3: any = { - x: 0, - y: 0, - w: 8, - h: 12, - i: "0", - metrics: ["all_heatmap"], - metricTypes: ["readHeatMap"], - type: "Widget", - widget: { - title: "all_heatmap", - tips: "Tooltip", +export const ConfigData3: any = [ + { + x: 0, + y: 0, + w: 2, + h: 6, + i: "1", + type: "Topology", + widget: { + title: "Topology", + tips: "Topology", + }, }, - graph: { - type: "HeatMap", + { + x: 2, + y: 0, + w: 8, + h: 12, + i: "0", + metrics: ["all_heatmap"], + metricTypes: ["readHeatMap"], + type: "Widget", + widget: { + title: "all_heatmap", + tips: "Tooltip", + }, + graph: { + type: "HeatMap", + }, + standard: { + unit: "min", + }, + children: [], }, - standard: { - unit: "min", - }, - children: [], -}; +]; export const ConfigData4: any = { x: 0, y: 0, diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index cf926f83..1a2589f3 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -164,7 +164,7 @@ export const dashboardStore = defineStore({ this.layout = [ConfigData2]; } if (type == "All") { - this.layout = [ConfigData3]; + this.layout = ConfigData3; } if (type == "Service") { this.layout = [ConfigData]; diff --git a/src/views/dashboard/Edit.vue b/src/views/dashboard/Edit.vue index 42a67c99..075b0ec2 100644 --- a/src/views/dashboard/Edit.vue +++ b/src/views/dashboard/Edit.vue @@ -23,7 +23,8 @@ limitations under the License. --> :destroy-on-close="true" @closed="dashboardStore.setConfigPanel(false)" > - + + + + diff --git a/src/views/dashboard/configuration/ConfigEdit.vue b/src/views/dashboard/configuration/Widget.vue similarity index 100% rename from src/views/dashboard/configuration/ConfigEdit.vue rename to src/views/dashboard/configuration/Widget.vue diff --git a/src/views/dashboard/controls/Topology.vue b/src/views/dashboard/controls/Topology.vue new file mode 100644 index 00000000..916fe54e --- /dev/null +++ b/src/views/dashboard/controls/Topology.vue @@ -0,0 +1,113 @@ + + + + diff --git a/src/views/dashboard/panel/Layout.vue b/src/views/dashboard/panel/Layout.vue index 0f1577f3..9c3b6e78 100644 --- a/src/views/dashboard/panel/Layout.vue +++ b/src/views/dashboard/panel/Layout.vue @@ -42,10 +42,11 @@ import { useDashboardStore } from "@/store/modules/dashboard"; import { LayoutConfig } from "@/types/dashboard"; import Widget from "../controls/Widget.vue"; import Tab from "../controls/Tab.vue"; +import Topology from "../controls/Topology.vue"; export default defineComponent({ name: "Layout", - components: { Widget, Tab }, + components: { Widget, Tab, Topology }, setup() { const dashboardStore = useDashboardStore(); function layoutUpdatedEvent(newLayout: LayoutConfig[]) { diff --git a/src/views/dashboard/related/topology/components/Settings.vue b/src/views/dashboard/related/topology/components/Settings.vue index 4a66efe8..3480bd8c 100644 --- a/src/views/dashboard/related/topology/components/Settings.vue +++ b/src/views/dashboard/related/topology/components/Settings.vue @@ -110,7 +110,7 @@ limitations under the License. -->
{{ t("legendSettings") }}
-
{{ t("conditions") }} (&&)
+
{{ t("conditions") }}