diff --git a/CHANGELOG.md b/CHANGELOG.md index 93a19fc243..985c512cc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ ## [Unreleased] +### 修复 +- MCP OAuth 对带路径的授权服务器按 RFC 8414 §3.1 发现 metadata,不再拼成 404;授权端点自带查询参数时也会保留并正确追加 OAuth 参数(#2926) + ## [1.0.3b6] - 2026-11-15 ### 新增 diff --git a/dashboard/src/locales/en.json b/dashboard/src/locales/en.json index e4ecedf234..0147e24fb0 100644 --- a/dashboard/src/locales/en.json +++ b/dashboard/src/locales/en.json @@ -7906,6 +7906,14 @@ "notAuthorized": "Not authorized", "remaining": "Remaining", "regionPlaceholder": "Regions (all by default)", + "regionAll": "All regions", + "regionRecent": "Recently used", + "regionAllAreas": "All areas", + "regionOtherArea": "Other areas", + "regionOthers": "Others ({{count}})", + "regionSelectedMulti": "{{name}} +{{count}}", + "regionSelectedTotal": "{{count}} selected", + "regionClear": "Clear filter", "refresh": "Refresh", "renew": "Renew", "manageAuth": "Manage", diff --git a/dashboard/src/locales/zh.json b/dashboard/src/locales/zh.json index bdd15364a7..54b73b2cfc 100644 --- a/dashboard/src/locales/zh.json +++ b/dashboard/src/locales/zh.json @@ -7906,6 +7906,14 @@ "notAuthorized": "未授权", "remaining": "剩余", "regionPlaceholder": "选择地域(默认全部)", + "regionAll": "全部地域", + "regionRecent": "最近访问", + "regionAllAreas": "全部地区", + "regionOtherArea": "其他地区", + "regionOthers": "其它地域({{count}})", + "regionSelectedMulti": "{{name}} 等 {{count}} 个", + "regionSelectedTotal": "已选 {{count}} 个地域", + "regionClear": "清空筛选", "refresh": "刷新", "renew": "续期", "manageAuth": "管理授权", diff --git a/dashboard/src/pages/Control/CloudHosts/components/CloudOverviewBoard.module.less b/dashboard/src/pages/Control/CloudHosts/components/CloudOverviewBoard.module.less index a635c31d5f..403fbdd5e9 100644 --- a/dashboard/src/pages/Control/CloudHosts/components/CloudOverviewBoard.module.less +++ b/dashboard/src/pages/Control/CloudHosts/components/CloudOverviewBoard.module.less @@ -22,7 +22,7 @@ align-items: center; min-height: 34px; padding: 7px 12px; - font-size: 11px; + font-size: 12px; color: #55708f; background: linear-gradient(100deg, #f4f9ff, #f8fbff 52%, #f5f8fd); border: 1px solid #dfe9f7; @@ -75,7 +75,7 @@ align-items: center; justify-content: space-between; margin-bottom: 8px; - font-size: 11px; + font-size: 12px; color: #788190; } @@ -118,14 +118,14 @@ gap: 6px; align-items: center; margin-top: 9px; - font-size: 11px; + font-size: 12px; color: #9aa2af; white-space: nowrap; } .miniTag { padding: 1px 5px; - font-size: 11px; + font-size: 12px; color: #29a17d; background: #eef8f3; border-radius: 4px; @@ -203,7 +203,7 @@ .panelSub { margin: 3px 0 0; - font-size: 11px; + font-size: 12px; color: #9aa2af; } @@ -214,7 +214,7 @@ .count { padding: 1px 5px; font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; color: #a0a8b4; border: 1px solid #e9ecf0; border-radius: 4px; @@ -232,7 +232,7 @@ .segmented button { padding: 4px 10px; - font-size: 11px; + font-size: 12px; line-height: 1.3; color: #8a92a0; white-space: nowrap; @@ -278,7 +278,7 @@ align-items: center; justify-content: space-between; margin-bottom: 8px; - font-size: 11px; + font-size: 12px; color: #677182; } @@ -298,7 +298,7 @@ .regionTotal { font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; color: #a7aeba; white-space: nowrap; } @@ -319,7 +319,7 @@ min-width: 0; padding: 0; font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; cursor: pointer; border: 1px solid transparent; border-radius: 4px; @@ -374,7 +374,7 @@ gap: 11px; align-items: center; padding: 10px 16px; - font-size: 11px; + font-size: 12px; color: #8b94a2; border-top: 1px solid #f0f2f5; } @@ -435,7 +435,7 @@ .trendEmpty { padding: 28px 0; - font-size: 11px; + font-size: 12px; color: var(--fn-text-quaternary); text-align: center; } @@ -444,7 +444,7 @@ display: flex; gap: 13px; padding: 0 16px 6px; - font-size: 11px; + font-size: 12px; color: #8590a0; } @@ -493,7 +493,7 @@ grid-template-columns: 96px minmax(0, 1fr) 42px; gap: 8px; align-items: center; - font-size: 11px; + font-size: 12px; color: #8a94a3; } @@ -515,7 +515,7 @@ .resourceName i { font-style: normal; - font-size: 10px; + font-size: 12px; color: #b0b8c4; } @@ -536,7 +536,7 @@ .resourceNumber { font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; color: #9099a7; text-align: right; } @@ -552,7 +552,7 @@ .alertCount { padding: 2px 6px; - font-size: 11px; + font-size: 12px; font-weight: 600; color: #c64756; background: #fdefef; @@ -567,7 +567,7 @@ .table { width: 100%; min-width: 560px; - font-size: 12px; + font-size: 13px; text-align: left; border-collapse: collapse; } @@ -575,7 +575,7 @@ .table th { height: 28px; padding: 0 10px; - font-size: 11px; + font-size: 12px; font-weight: 400; color: #a0a8b5; background: #fafbfc; @@ -605,7 +605,7 @@ align-items: center; padding: 0; font-family: var(--sc-mono); - font-size: 12px; + font-size: 13px; color: #4e5a6e; cursor: pointer; background: none; @@ -628,7 +628,7 @@ } .cellMain { - font-size: 12px; + font-size: 13px; font-weight: 500; color: #657083; } @@ -636,13 +636,13 @@ .cellSub { margin-top: 1px; font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; color: #adb4bf; } .metricNumber { font-family: var(--sc-mono); - font-size: 12px; + font-size: 13px; color: #7a8495; } @@ -668,7 +668,7 @@ .softBadge { padding: 3px 6px; - font-size: 11px; + font-size: 12px; font-weight: 500; color: #7a8290; background: #f5f6f8; @@ -731,13 +731,13 @@ display: flex; gap: 5px; justify-content: space-between; - font-size: 12px; + font-size: 13px; color: #747f90; } .eventTime { font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; color: #a7afbb; white-space: nowrap; } @@ -745,7 +745,7 @@ .eventDesc { margin-top: 1px; font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; color: #a4acb8; } @@ -758,7 +758,7 @@ gap: 10px; align-items: center; padding: 0 2px 2px; - font-size: 11px; + font-size: 12px; color: #a1a9b6; } @@ -783,7 +783,7 @@ gap: 7px; min-height: 80px; padding: 20px; - font-size: 11px; + font-size: 12px; color: #a0a8b4; grid-column: 1 / -1; } @@ -862,7 +862,7 @@ .summaryBand { flex-wrap: wrap; - font-size: 11px; + font-size: 12px; } .bandTime { diff --git a/dashboard/src/pages/Control/CloudHosts/components/RegionPicker.module.less b/dashboard/src/pages/Control/CloudHosts/components/RegionPicker.module.less new file mode 100644 index 0000000000..bd38c9f43b --- /dev/null +++ b/dashboard/src/pages/Control/CloudHosts/components/RegionPicker.module.less @@ -0,0 +1,246 @@ +/* 地域选择器:触发器沿用工具栏输入框的尺寸,弹层参考腾讯云控制台的 + 「最近访问 + 全部地区」双段式布局。 */ + +.trigger { + display: inline-flex; + flex: 0 0 auto; + gap: 6px; + align-items: center; + min-width: 240px; + max-width: 360px; + height: 32px; + padding: 0 10px; + font-size: 14px; + color: var(--fn-text-primary); + cursor: pointer; + background: var(--fn-bg-primary); + border: 1px solid var(--fn-border-secondary); + border-radius: 8px; + transition: + border-color 0.15s ease, + box-shadow 0.15s ease; +} + +.trigger:hover:not(:disabled) { + border-color: var(--fn-color-brand); +} + +.trigger:focus-visible { + outline: 2px solid var(--fn-color-brand); + outline-offset: 1px; +} + +.triggerDisabled { + cursor: not-allowed; + opacity: 0.55; +} + +.triggerMain { + display: inline-flex; + align-items: baseline; + gap: 2px; + min-width: 0; + font-weight: 500; +} + +.triggerLabel { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +/* 选中地域的节点总数:与地名同色,只有后面那个红点强调"有节点" */ +.triggerCount { + font-size: 12px; + font-variant-numeric: tabular-nums; + color: inherit; +} + +.triggerDot { + flex: 0 0 auto; + align-self: flex-start; + width: 4px; + height: 4px; + margin: 3px 0 0 2px; + background: var(--fn-color-danger); + border-radius: 50%; +} + +.triggerRest { + flex: 0 0 auto; + font-size: 13px; + color: var(--fn-text-tertiary); + white-space: nowrap; +} + +.triggerRest::before { + padding-right: 6px; + color: var(--fn-border-secondary); + content: "|"; +} + +.caret { + flex: 0 0 auto; + margin-left: auto; + color: var(--fn-text-tertiary); + transition: transform 0.15s ease; +} + +.caretOpen { + transform: rotate(180deg); +} + +.popover { + /* 弹层自己控内边距,antd 默认的 12px 会把两段式布局压扁 */ +} + +.popover :global(.ant-popover-inner) { + padding: 0; + border-radius: 12px; + box-shadow: 0 14px 38px + color-mix(in srgb, var(--fn-text-primary) 16%, transparent); +} + +.body { + box-sizing: border-box; + width: min(1060px, calc(100vw - 32px)); + max-height: min(76vh, 680px); + padding: 16px 24px 20px; + overflow: auto; +} + +.section { + padding-bottom: 16px; +} + +.sectionTitle { + margin-bottom: 16px; + font-size: 14px; + font-weight: 600; + color: var(--fn-text-primary); +} + +/* 最近访问与下面的大区共用同一套列宽,视觉上对齐到同一栅格 */ +.recentRow { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); + column-gap: 24px; + row-gap: 8px; +} + +/* 报纸式多栏流:大区块按列往下排,短列表不会独占一整行留白。 + 列宽取 128px 保证最长地名(7 个汉字)不截断。 */ +.areas { + column-width: 128px; + column-gap: 24px; + column-fill: balance; +} + +.area { + margin-bottom: 18px; + break-inside: avoid; + page-break-inside: avoid; +} + +/* 层级对比是"清晰"的关键:地域名用主色,大区标题刻意压浅, + 跟控制台一样靠颜色深浅区分两级,而不是靠字号。 */ +.areaTitle { + margin-bottom: 14px; + font-size: 12px; + font-weight: 400; + color: var(--fn-text-tertiary); +} + +.areaItems { + display: flex; + flex-direction: column; + gap: 6px; +} + +.item { + display: inline-flex; + align-self: flex-start; + align-items: baseline; + max-width: 100%; + padding: 5px 10px; + font-size: 14px; + line-height: 22px; + color: var(--fn-text-primary); + text-align: left; + cursor: pointer; + background: transparent; + border: 0; + border-radius: 6px; + transition: + background 0.12s ease, + color 0.12s ease; +} + +.item:hover { + color: var(--fn-text-primary); + background: var(--fn-bg-hover); +} + +.item:focus-visible { + outline: 2px solid var(--fn-color-brand); + outline-offset: -2px; +} + +.itemActive { + font-weight: 500; + color: var(--fn-text-primary); + background: var(--fn-bg-selected, var(--fn-bg-hover)); +} + +.itemName { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +/* 地域下的节点数:与地名同色(继承父级),红点只用来标记"这个地域有节点" */ +.itemCount { + margin-left: 3px; + font-size: 11px; + font-variant-numeric: tabular-nums; + color: inherit; +} + +.itemDot { + flex: 0 0 auto; + align-self: flex-start; + width: 4px; + height: 4px; + margin: 6px 0 0 3px; + background: var(--fn-color-danger); + border-radius: 50%; +} + +.footer { + display: flex; + gap: 8px; + align-items: center; + justify-content: space-between; + padding: 8px 6px 2px; + margin-top: 6px; + border-top: 1px solid var(--fn-border-primary); +} + +.footerText { + font-size: 12px; + color: var(--fn-text-tertiary); +} + +.clearBtn { + padding: 2px 6px; + font-size: 12px; + color: var(--fn-text-brand); + cursor: pointer; + background: transparent; + border: 0; + border-radius: 4px; +} + +.clearBtn:hover { + background: var(--fn-bg-hover); +} diff --git a/dashboard/src/pages/Control/CloudHosts/components/RegionPicker.tsx b/dashboard/src/pages/Control/CloudHosts/components/RegionPicker.tsx new file mode 100644 index 0000000000..f12764d03d --- /dev/null +++ b/dashboard/src/pages/Control/CloudHosts/components/RegionPicker.tsx @@ -0,0 +1,286 @@ +import { useCallback, useMemo, useState } from "react"; +import { Popover } from "antd"; +import cx from "classnames"; +import { ChevronDown } from "lucide-react"; +import { useTranslation } from "react-i18next"; +import styles from "./RegionPicker.module.less"; + +export type CloudRegion = { id: string; name: string }; + +interface RegionPickerProps { + regions: CloudRegion[]; + /** 每个地域的节点数(`region` → 实例数量)。 */ + counts: Record; + /** 已选地域 id,空数组表示"全部地域"。 */ + value: string[]; + onChange: (next: string[]) => void; + disabled?: boolean; +} + +interface RegionItem { + id: string; + short: string; + area: string; + count: number; +} + +const RECENT_KEY = "octop:cloud:recent-regions"; +const RECENT_MAX = 6; + +/** 大区排序:与腾讯云控制台地域选择器一致,未命中的排在末尾。 */ +const AREA_ORDER = [ + "华南地区", + "华东地区", + "华北地区", + "华中地区", + "西南地区", + "西北地区", + "东北地区", + "港澳台地区", + "亚太东南", + "亚太东北", + "亚太南部", + "欧洲地区", + "北美地区", + "南美地区", + "中东地区", + "非洲地区", +]; + +/** "华南地区(广州 OPEN)" → { area: "华南地区", short: "广州 OPEN" } */ +function parseRegionName( + name: string, + id: string, +): { area: string; short: string } { + const match = /^\s*(.+?)\s*[((](.+?)[))]\s*$/.exec(name ?? ""); + if (match) { + return { area: match[1].trim(), short: match[2].trim() }; + } + return { area: "", short: (name || id).trim() }; +} + +function readRecent(): string[] { + try { + const raw = window.localStorage.getItem(RECENT_KEY); + if (!raw) return []; + const parsed = JSON.parse(raw); + return Array.isArray(parsed) + ? parsed.filter((item): item is string => typeof item === "string") + : []; + } catch { + return []; + } +} + +function writeRecent(ids: string[]) { + try { + window.localStorage.setItem(RECENT_KEY, JSON.stringify(ids)); + } catch { + // 隐私模式 / 配额满:只是便利功能,失败不影响筛选 + } +} + +export default function RegionPicker({ + regions, + counts, + value, + onChange, + disabled = false, +}: RegionPickerProps) { + const { t } = useTranslation(); + const [open, setOpen] = useState(false); + const [recent, setRecent] = useState(readRecent); + + const items = useMemo( + () => + regions.map((region) => { + const { area, short } = parseRegionName(region.name, region.id); + return { id: region.id, short, area, count: counts[region.id] ?? 0 }; + }), + [regions, counts], + ); + + const groups = useMemo(() => { + const map = new Map(); + for (const item of items) { + const bucket = map.get(item.area); + if (bucket) bucket.push(item); + else map.set(item.area, [item]); + } + return [...map.entries()] + .map(([area, list]) => ({ + area, + label: area || t("cloud.regionOtherArea", "其他地区"), + items: list, + })) + .sort((a, b) => { + const ia = AREA_ORDER.indexOf(a.area); + const ib = AREA_ORDER.indexOf(b.area); + return ( + (ia < 0 ? AREA_ORDER.length : ia) - (ib < 0 ? AREA_ORDER.length : ib) + ); + }); + }, [items, t]); + + const recentItems = useMemo( + () => + recent + .map((id) => items.find((item) => item.id === id)) + .filter((item): item is RegionItem => Boolean(item)) + .slice(0, RECENT_MAX), + [recent, items], + ); + + const selected = useMemo( + () => items.filter((item) => value.includes(item.id)), + [items, value], + ); + const totalCount = useMemo( + () => items.reduce((sum, item) => sum + item.count, 0), + [items], + ); + const selectedCount = selected.reduce((sum, item) => sum + item.count, 0); + const restCount = Math.max(0, totalCount - selectedCount); + + const toggle = useCallback( + (id: string) => { + const next = value.includes(id) + ? value.filter((item) => item !== id) + : [...value, id]; + onChange(next); + setRecent((prev) => { + const merged = [id, ...prev.filter((item) => item !== id)].slice( + 0, + RECENT_MAX, + ); + writeRecent(merged); + return merged; + }); + }, + [onChange, value], + ); + + const triggerLabel = + selected.length === 0 + ? t("cloud.regionAll", "全部地域") + : selected.length === 1 + ? selected[0].short + : t("cloud.regionSelectedMulti", { + name: selected[0].short, + count: selected.length, + defaultValue: "{{name}} 等 {{count}} 个", + }); + + const renderItem = (item: RegionItem, extraClass?: string) => { + const active = value.includes(item.id); + return ( + + ); + }; + + const body = ( +
+ {recentItems.length > 0 ? ( +
+
+ {t("cloud.regionRecent", "最近访问")} +
+
+ {recentItems.map((item) => renderItem(item, styles.recentItem))} +
+
+ ) : null} + +
+
+ {t("cloud.regionAllAreas", "全部地区")} +
+
+ {groups.map((group) => ( +
+
{group.label}
+
+ {group.items.map((item) => renderItem(item))} +
+
+ ))} +
+
+ + {value.length > 0 ? ( +
+ + {t("cloud.regionSelectedTotal", { + count: value.length, + defaultValue: "已选 {{count}} 个地域", + })} + + +
+ ) : null} +
+ ); + + return ( + setOpen(disabled ? false : next)} + overlayClassName={styles.popover} + content={body} + arrow={false} + > + + + ); +} diff --git a/dashboard/src/pages/Control/CloudHosts/index.module.less b/dashboard/src/pages/Control/CloudHosts/index.module.less index 7370eedd3b..5cdd1957e1 100644 --- a/dashboard/src/pages/Control/CloudHosts/index.module.less +++ b/dashboard/src/pages/Control/CloudHosts/index.module.less @@ -84,7 +84,7 @@ align-items: center; padding: 3px 10px; font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; font-variant-numeric: tabular-nums; color: inherit; cursor: pointer; @@ -167,7 +167,7 @@ .overviewLabel { font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.5; @@ -182,11 +182,13 @@ } .overviewHint { - font-size: 11px; + font-size: 12px; opacity: 0.45; } .sidebar { + /* RailEdgeControl 绝对定位的锚点:折叠手柄骑在右侧分隔线上 */ + position: relative; display: flex; flex: 0 0 196px; flex-direction: column; @@ -201,31 +203,8 @@ flex: 0 0 auto; gap: 4px; align-items: center; - font-size: 11px; - color: var(--fn-text-quaternary); -} - -.railBtn { - display: inline-flex; - flex: 0 0 auto; - align-items: center; - justify-content: center; - width: 24px; - height: 24px; - padding: 0; + font-size: 12px; color: var(--fn-text-quaternary); - cursor: pointer; - background: transparent; - border: 0; - border-radius: 6px; - transition: - background 0.12s ease, - color 0.12s ease; -} - -.railBtn:hover { - color: var(--fn-text-primary); - background: var(--fn-bg-secondary); } .sidebarHead { @@ -234,20 +213,18 @@ align-items: center; } +/* 标签统一走 12px 常规字体,不再用 mono + 全大写 + 低透明度的终端风, + 否则和页面其它文案放在一起显得忽大忽小、忽轻忽重。 */ .sidebarTitle { flex: 1; - font-family: var(--sc-mono); - font-size: 10px; - letter-spacing: 0.1em; - text-transform: uppercase; - opacity: 0.45; + font-size: 12px; + color: var(--fn-text-tertiary); } .sidebarCount { - font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; font-variant-numeric: tabular-nums; - opacity: 0.55; + color: var(--fn-text-tertiary); } .nodeList { @@ -348,7 +325,7 @@ .nodeName { overflow: hidden; - font-size: 12.5px; + font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; @@ -357,16 +334,16 @@ .nodeMeta { overflow: hidden; font-family: var(--sc-mono); - font-size: 10.5px; - opacity: 0.45; + font-size: 12px; + color: var(--fn-text-tertiary); text-overflow: ellipsis; white-space: nowrap; } .nodeEmpty { padding: 16px 4px; - font-size: 11px; - opacity: 0.45; + font-size: 12px; + color: var(--fn-text-tertiary); text-align: center; } @@ -405,7 +382,7 @@ .miniValue { font-family: var(--sc-mono); - font-size: 11px; + font-size: 12px; font-variant-numeric: tabular-nums; opacity: 0.7; } @@ -461,6 +438,8 @@ } .stage { + /* 折叠态下 RailEdgeControl 以此为锚点,手柄停在内容区左边缘 */ + position: relative; display: flex; flex: 1; flex-direction: row; @@ -469,6 +448,19 @@ min-height: 0; } +/* 折叠态:左侧没有独立面板可以挂边线,手柄整体内移几个像素, + 避免被 Workbench 面板的 overflow: hidden 裁掉一半。 */ +.railEdgeClosed { + left: 4px !important; + right: auto !important; + + /* 面板收起后这是唯一的展开入口,常驻可见,不等 hover */ + > button { + opacity: 1; + pointer-events: auto; + } +} + .main { display: flex; flex: 1; @@ -609,11 +601,8 @@ } .kpiLabel { - font-family: var(--sc-mono); - font-size: 10px; - letter-spacing: 0.14em; - text-transform: uppercase; - opacity: 0.5; + font-size: 12px; + color: var(--fn-text-tertiary); } .kpiValue { @@ -636,11 +625,9 @@ } .blockTitle { - font-family: var(--sc-mono); - font-size: 10px; - letter-spacing: 0.14em; - text-transform: uppercase; - opacity: 0.5; + font-size: 13px; + font-weight: 600; + color: var(--fn-text-primary); } .mono { @@ -652,17 +639,14 @@ /* ---- Terminal-flavoured table ---- */ .page :global(.octop-table) { - font-size: 12.5px; + font-size: 13px; } .page :global(.octop-table-thead > tr > th) { - font-family: var(--sc-mono); - font-size: 10px; + font-size: 12px; font-weight: 500; - letter-spacing: 0.1em; - text-transform: uppercase; + color: var(--fn-text-tertiary); background: transparent !important; - opacity: 0.6; } .page :global(.octop-table-tbody > tr > td) { @@ -671,8 +655,6 @@ .page :global(.octop-tag) { margin: 0; - font-family: var(--sc-mono); - font-size: 10px; - letter-spacing: 0.06em; + font-size: 12px; border-radius: 3px; } diff --git a/dashboard/src/pages/Control/CloudHosts/index.tsx b/dashboard/src/pages/Control/CloudHosts/index.tsx index 37233de220..a717ce852e 100644 --- a/dashboard/src/pages/Control/CloudHosts/index.tsx +++ b/dashboard/src/pages/Control/CloudHosts/index.tsx @@ -8,7 +8,6 @@ import { Modal, Popconfirm, Segmented, - Select, Space, Spin, Table, @@ -21,8 +20,6 @@ import { Info, KeyRound, LogIn, - PanelLeftClose, - PanelLeftOpen, PauseCircle, PlayCircle, RefreshCw, @@ -32,6 +29,7 @@ import { } from "lucide-react"; import { request } from "../../../api/request"; import { OctopEmptyMascot } from "../../../components/EmptyState"; +import RailEdgeControl from "../../../components/RailEdgeControl"; import StreamSetupGuide from "../../../components/StreamSetupGuide/StreamSetupGuide"; import { useCvmOpsExpert } from "../../../hooks/useCvmOpsExpert"; import { ALERT_MIN, WARN_MIN, levelTone } from "./theme"; @@ -47,6 +45,7 @@ import CloudOverviewBoard, { type BoardInstance, type TrendPoint, } from "./components/CloudOverviewBoard"; +import RegionPicker from "./components/RegionPicker"; import styles from "./index.module.less"; type CloudStatus = { @@ -187,8 +186,10 @@ function CredentialBadge({ onExpire(); }, [remaining, expiresAt, status?.authorized, onExpire]); + // 未授权时不再渲染「未授权」标签:空状态引导里已有完整说明, + // 工具栏再挂一个灰 Tag 只会干扰视线。 if (!status?.authorized) { - return {t("cloud.notAuthorized")}; + return null; } const critical = remaining <= 60; @@ -747,6 +748,15 @@ export default function CloudHostsPage({ ); }, [instances, keyword]); + // 每个地域的节点数:地域选择器要在名字后带上这个数字 + const regionCounts = useMemo(() => { + const out: Record = {}; + for (const row of instances) { + out[row.region] = (out[row.region] ?? 0) + 1; + } + return out; + }, [instances]); + // KPI 跟随搜索范围,避免"顶部写 486、左侧只剩 2 台"的口径不一致 const runningCount = filteredInstances.filter( (row) => row.state === "RUNNING", @@ -893,17 +903,11 @@ export default function CloudHostsPage({ onExpire={handleExpire} onRenew={() => void refreshCredential()} /> -