diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts index 12267ccb..92dd7754 100644 --- a/src/locales/lang/en.ts +++ b/src/locales/lang/en.ts @@ -239,6 +239,7 @@ const msg = { defaultOrder: "Default Order", chartType: "Chart Type", currentDepth: "Current Depth", + showDepth: "Show Depth Selector", defaultDepth: "Default Depth", traceTagsTip: `Only tags defined in the core/default/searchableTracesTags are searchable. Check more details on the Configuration Vocabulary page`, diff --git a/src/locales/lang/zh.ts b/src/locales/lang/zh.ts index 752649b4..19fd397e 100644 --- a/src/locales/lang/zh.ts +++ b/src/locales/lang/zh.ts @@ -89,6 +89,7 @@ const msg = { backgroundColors: "背景颜色", fontColors: "字体颜色", iconTheme: "图标主题", + showDepth: "展示深度选择器", hourTip: "选择小时", minuteTip: "选择分钟", secondTip: "选择秒数", diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index d19ee349..178e504a 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -92,6 +92,7 @@ export const dashboardStore = defineStore({ iconTheme: true, content: "Topology", fontSize: 18, + showDepth: true, }; } this.layout = this.layout.map((d: LayoutConfig) => { diff --git a/src/store/modules/topology.ts b/src/store/modules/topology.ts index d517cd53..9de0316e 100644 --- a/src/store/modules/topology.ts +++ b/src/store/modules/topology.ts @@ -35,7 +35,6 @@ interface TopologyState { nodeMetrics: MetricVal; linkServerMetrics: MetricVal; linkClientMetrics: MetricVal; - defaultDepth: string; } export const topologyStore = defineStore({ @@ -48,7 +47,6 @@ export const topologyStore = defineStore({ nodeMetrics: {}, linkServerMetrics: {}, linkClientMetrics: {}, - defaultDepth: "2", }), actions: { setNode(node: Node) { @@ -114,9 +112,6 @@ export const topologyStore = defineStore({ setLinkClientMetrics(m: { id: string; value: unknown }[]) { this.linkClientMetrics = m; }, - setDefaultDepth(val: number) { - this.defaultDepth = val; - }, async getDepthServiceTopology(serviceIds: string[], depth: number) { const res = await this.getServicesTopology(serviceIds); if (depth > 1) { diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts index 5a2d0220..b8c0544e 100644 --- a/src/types/dashboard.ts +++ b/src/types/dashboard.ts @@ -120,4 +120,5 @@ export interface TopologyConfig { content?: string; fontSize?: number; depth?: string; + showDepth?: boolean; } diff --git a/src/views/dashboard/configuration/graph-styles/TopologyItem.vue b/src/views/dashboard/configuration/graph-styles/TopologyItem.vue index 2563ecc3..52f73ea9 100644 --- a/src/views/dashboard/configuration/graph-styles/TopologyItem.vue +++ b/src/views/dashboard/configuration/graph-styles/TopologyItem.vue @@ -67,6 +67,15 @@ limitations under the License. --> />
+ {{ t("showDepth") }} + +
+
{{ t("defaultDepth") }} (selectedGrid.graph.content); const fontSize = ref(selectedGrid.graph.fontSize); const depth = ref(selectedGrid.graph.depth || "2"); +const showDepth = ref(selectedGrid.graph.showDepth); const colors = [ { label: "Green", @@ -107,7 +115,6 @@ const colors = [ { label: "Black", value: "black" }, { label: "Orange", value: "orange" }, ]; -topologyStore.setDefaultDepth(depth.value); function changeConfig(param: { [key: string]: unknown }) { const { selectedGrid } = dashboardStore; const graph = { @@ -118,7 +125,6 @@ function changeConfig(param: { [key: string]: unknown }) { } function changeDepth(opt: Option[]) { const val = opt[0].value; - topologyStore.setDefaultDepth(val); changeConfig({ depth: val }); } diff --git a/src/views/dashboard/related/topology/components/Graph.vue b/src/views/dashboard/related/topology/components/Graph.vue index 22c42a5b..d62607d0 100644 --- a/src/views/dashboard/related/topology/components/Graph.vue +++ b/src/views/dashboard/related/topology/components/Graph.vue @@ -23,14 +23,16 @@ limitations under the License. -->
- {{ t("currentDepth") }} - + + {{ t("currentDepth") }} + + @@ -108,7 +110,7 @@ const items = ref< { id: "inspect", title: "Inspect", func: handleInspect }, { id: "alarm", title: "Alarm", func: handleGoAlarm }, ]); -const depth = ref(topologyStore.defaultDepth); +const depth = ref(dashboardStore.selectedGrid.depth || "2"); onMounted(async () => { loading.value = true; diff --git a/src/views/dashboard/related/topology/components/PodTopology.vue b/src/views/dashboard/related/topology/components/PodTopology.vue index 66073168..9ca7e14b 100644 --- a/src/views/dashboard/related/topology/components/PodTopology.vue +++ b/src/views/dashboard/related/topology/components/PodTopology.vue @@ -14,7 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. -->