From 9942afafa7016c69fec600e5d00a4aec7edc86eb Mon Sep 17 00:00:00 2001 From: Timi Date: Mon, 13 Apr 2026 17:20:57 +0800 Subject: [PATCH] update DashboardSetting.vue style --- package.json | 2 +- pnpm-lock.yaml | 10 +- .../ServerDashboard/ServerDashboard.vue | 12 +- src/pages/setting/ConnectSetting.vue | 4 +- src/pages/setting/DashboardSetting.vue | 265 ++---------------- src/pages/tabs/SettingsTab.vue | 8 + src/router/index.ts | 3 +- src/store/settingStore.ts | 27 +- 8 files changed, 57 insertions(+), 274 deletions(-) diff --git a/package.json b/package.json index 3d6d007..b1638b9 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "pinia": "^3.0.2", "tdesign-mobile-vue": "^1.13.2", "timi-tdesign-mobile": "0.0.9", - "timi-web": "0.0.17", + "timi-web": "0.0.18", "ts-node": "^10.9.2", "vue": "^3.5.16", "vue-router": "4.5.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fdc0730..a6fc2ba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,8 +30,8 @@ importers: specifier: 0.0.9 version: 0.0.9(typescript@5.8.3) timi-web: - specifier: 0.0.17 - version: 0.0.17 + specifier: 0.0.18 + version: 0.0.18 ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@24.12.0)(typescript@5.8.3) @@ -1832,8 +1832,8 @@ packages: resolution: {integrity: sha512-SV8m/FsLsEabSmJ/NvI650fLyb/JCLz7JUNQrkWeoo5xICElsN4x39L3n4lTzu6ARidjpT6uA+XEmA4wnyQmuA==} engines: {node: '>=16.0.0'} - timi-web@0.0.17: - resolution: {integrity: sha512-6ycsqfnl+zeQkgOICjhhJYHoo3CtCxnhaNFFirNLVfX/VrrTDjW7DiR+/W8bouZzx6AR19fZKyG+UE0BKKBURg==} + timi-web@0.0.18: + resolution: {integrity: sha512-e7QDPZbt7ZVvghtYwgpZrWJ0onIB4WNMhUaODCYyOdeUmi6PGQk4Aax/Gyo1M12MflrjaBUmlCF+9kPAqKGdtQ==} engines: {node: '>=16.0.0'} tinycolor2@1.6.0: @@ -3875,7 +3875,7 @@ snapshots: transitivePeerDependencies: - typescript - timi-web@0.0.17: + timi-web@0.0.18: dependencies: axios: 1.13.5 less: 4.5.1 diff --git a/src/pages/dashboard/ServerDashboard/ServerDashboard.vue b/src/pages/dashboard/ServerDashboard/ServerDashboard.vue index 075656b..5947586 100644 --- a/src/pages/dashboard/ServerDashboard/ServerDashboard.vue +++ b/src/pages/dashboard/ServerDashboard/ServerDashboard.vue @@ -140,14 +140,16 @@ import { useRouter } from "vue-router"; import type { EChartsOption, SeriesOption } from "echarts"; import SystemAPI from "@/api/SystemAPI"; import type { SystemStatusHistoryPoint, SystemStatusSnapshotView } from "@/types/System"; -import type { DashboardHistoryMetric } from "@/store/settingStore"; import { useSettingStore } from "@/store/settingStore"; import { IOSize, type LabelValue, Text, Time } from "timi-web"; import TCellInfo from "@/components/TCellInfo.vue"; import type { ProgressItem } from "@/components/ProgressGroup.vue"; import ProgressGroup from "@/components/ProgressGroup.vue"; -type HistoryMetric = DashboardHistoryMetric; +type HistoryMetric = "cpu" | "memory" | "jvm" | "network"; + +const SERVER_SNAPSHOT_METRICS = ["os", "cpu", "memory", "jvm", "network", "hardware", "storage"] as const; +const SERVER_HISTORY_METRICS = ["cpu", "memory", "jvm", "network"] as const; use([ SVGRenderer, @@ -262,7 +264,7 @@ const historyMetricTabs = computed(() => { network: "网络" }; - return settingStore.dashboard.server.historyMetrics.map((metric) => ({ + return SERVER_HISTORY_METRICS.map((metric) => ({ value: metric, label: labelMap[metric] })); @@ -635,7 +637,7 @@ async function refreshSnapshot(): Promise { } isSnapshotLoading.value = true; try { - const metrics = settingStore.dashboard.server.snapshotMetrics.join(","); + const metrics = SERVER_SNAPSHOT_METRICS.join(","); snapshotView.value = await SystemAPI.getStatus(metrics); } catch (error) { Toast({ @@ -657,7 +659,7 @@ async function refreshHistory(): Promise { } isHistoryLoading.value = true; try { - const metrics = settingStore.dashboard.server.historyMetrics.join(","); + const metrics = SERVER_HISTORY_METRICS.join(","); const historyView = await SystemAPI.getStatusHistory({ window: "1h", metrics diff --git a/src/pages/setting/ConnectSetting.vue b/src/pages/setting/ConnectSetting.vue index 299a2e8..498da7e 100644 --- a/src/pages/setting/ConnectSetting.vue +++ b/src/pages/setting/ConnectSetting.vue @@ -1,6 +1,6 @@