From 981e9557fe00b977751a23d6eadee54d83487e7b Mon Sep 17 00:00:00 2001 From: mac Date: Fri, 17 Jul 2026 19:28:19 +0800 Subject: [PATCH] feat(frontend): make mock panels follow business line --- frontend/src/utils/businessLineMock.ts | 113 ++++++++++++++++++++ frontend/src/views/cluster/ClusterList.vue | 50 +++++++-- frontend/src/views/config/ConfigCenter.vue | 24 +++-- frontend/src/views/dashboard/Index.vue | 50 +++++---- frontend/src/views/monitor/Alert.vue | 98 ++++++----------- frontend/src/views/monitor/Monitor.vue | 68 ++++-------- frontend/src/views/resource/Management.vue | 39 ++++--- frontend/src/views/resource/StatusBoard.vue | 52 ++++----- frontend/src/views/resource/Tenants.vue | 60 +++++++---- frontend/src/views/service/Catalog.vue | 17 ++- frontend/src/views/service/Management.vue | 26 +++-- frontend/src/views/task/TaskCenter.vue | 27 +++-- 12 files changed, 383 insertions(+), 241 deletions(-) create mode 100644 frontend/src/utils/businessLineMock.ts diff --git a/frontend/src/utils/businessLineMock.ts b/frontend/src/utils/businessLineMock.ts new file mode 100644 index 0000000..95d0e1c --- /dev/null +++ b/frontend/src/utils/businessLineMock.ts @@ -0,0 +1,113 @@ +import { computed } from 'vue' +import { useBusinessLineStore } from '@/stores/businessLine' + +export const BUSINESS_LINE_NAMES = ['kodo', 'linxi', 'xinfra', 'las'] as const +export type BusinessLineName = (typeof BUSINESS_LINE_NAMES)[number] + +interface BusinessLineMockProfile { + name: BusinessLineName + clusters: number + nodes: number + physicalMachines: number + virtualMachines: number + cpuAllocated: number + components: number + mysql: number + redis: number + alertsP0: number + alertsP1: number + tasksRunning: number + primaryZone: string + secondaryZone: string + servicePrefix: string +} + +const profiles: Record = { + kodo: { + name: 'kodo', + clusters: 3, + nodes: 128, + physicalMachines: 186, + virtualMachines: 512, + cpuAllocated: 61, + components: 214, + mysql: 38, + redis: 92, + alertsP0: 1, + alertsP1: 5, + tasksRunning: 2, + primaryZone: 'IDC-华北机房', + secondaryZone: 'IDC-华东机房', + servicePrefix: 'kodo', + }, + linxi: { + name: 'linxi', + clusters: 2, + nodes: 74, + physicalMachines: 96, + virtualMachines: 238, + cpuAllocated: 47, + components: 128, + mysql: 21, + redis: 46, + alertsP0: 0, + alertsP1: 2, + tasksRunning: 1, + primaryZone: 'IDC-华东机房', + secondaryZone: '阿里云-华南', + servicePrefix: 'linxi', + }, + xinfra: { + name: 'xinfra', + clusters: 2, + nodes: 52, + physicalMachines: 68, + virtualMachines: 156, + cpuAllocated: 39, + components: 84, + mysql: 12, + redis: 31, + alertsP0: 0, + alertsP1: 1, + tasksRunning: 1, + primaryZone: 'IDC-华北机房', + secondaryZone: '香港 IDC', + servicePrefix: 'xinfra', + }, + las: { + name: 'las', + clusters: 1, + nodes: 34, + physicalMachines: 42, + virtualMachines: 118, + cpuAllocated: 31, + components: 66, + mysql: 8, + redis: 18, + alertsP0: 0, + alertsP1: 3, + tasksRunning: 0, + primaryZone: '七牛-新加坡', + secondaryZone: 'AWS-美国', + servicePrefix: 'las', + }, +} + +export function normalizeBusinessLineName(name?: string | null): BusinessLineName { + const normalized = String(name || '').trim().toLowerCase() + if (BUSINESS_LINE_NAMES.includes(normalized as BusinessLineName)) { + return normalized as BusinessLineName + } + return 'kodo' +} + +export function useBusinessLineMockProfile() { + const businessLineStore = useBusinessLineStore() + const currentName = computed(() => normalizeBusinessLineName(businessLineStore.current?.name)) + const profile = computed(() => profiles[currentName.value]) + + return { + currentName, + profile, + } +} diff --git a/frontend/src/views/cluster/ClusterList.vue b/frontend/src/views/cluster/ClusterList.vue index 80b0536..7f945fe 100644 --- a/frontend/src/views/cluster/ClusterList.vue +++ b/frontend/src/views/cluster/ClusterList.vue @@ -24,7 +24,7 @@ - + {{ cluster.name }} {{ cluster.zone }} ● {{ cluster.status }} @@ -43,7 +43,7 @@
-

rke2-bj-prod-01 · 节点列表(节选)

+

{{ businessLineClusters[0]?.name }} · 节点列表(节选)

node-label 多租户隔离
@@ -60,7 +60,7 @@ - + {{ node.name }} {{ node.ip }} {{ node.label }} @@ -77,7 +77,10 @@