@yuku123/z-team-component 0.2.132 → 0.2.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/{index-BkzBYfhO.js → AdminModuleContent-DjEqlai_.js} +13552 -14053
  2. package/dist/{ChangeLogView-SwacGpsw.js → ChangeLogView-BQCxD0g7.js} +1 -1
  3. package/dist/{ComponentDoc-Dh5YhLCI.js → ComponentDoc-C1yrRq6Y.js} +707 -713
  4. package/dist/{InvitationManagementPage-CjEcLOGB.js → InvitationManagementPage-Bbl_HXlG.js} +1 -1
  5. package/dist/{OnboardingPage-DvNt71kX.js → OnboardingPage-BoYhlfWE.js} +2 -2
  6. package/dist/{ScheduledTasks-COgb4MZJ.js → ScheduledTasks-0FX6xhIs.js} +6 -6
  7. package/dist/SystemShell-DNRHYsgT.js +978 -0
  8. package/dist/{admin-logs-CExsxQ5h.js → admin-logs-OZ3s7ssr.js} +1 -1
  9. package/dist/{api-DXw93E7c.js → api-B0ComkTL.js} +1 -1
  10. package/dist/{api-C9kTgVc2.js → api-BgrPNvTB.js} +1 -1
  11. package/dist/{createWorkspaceWsHandler-BwDUTYXH.js → createWorkspaceWsHandler-CkgJR6Oo.js} +3 -3
  12. package/dist/{index-D2DFKRUf.js → index-9fGksFL5.js} +1 -1
  13. package/dist/{index-mEgmHNRO.js → index-Bbs7DMqZ.js} +1 -1
  14. package/dist/{index-CF3xDZ7q.js → index-Bf-Az5am.js} +4 -4
  15. package/dist/index-Bf57pWxm.js +311 -0
  16. package/dist/{index-D_J1ZCy8.js → index-BiCIEDbX.js} +3 -3
  17. package/dist/{index-DmV6xR7C.js → index-BtCyMeHe.js} +3 -3
  18. package/dist/{index-9rfSVSTh.js → index-C1sQehbP.js} +2 -2
  19. package/dist/index-CHLZ4xCe.js +1176 -0
  20. package/dist/{index-B3uLo8-F.js → index-CM6iVhI3.js} +3 -3
  21. package/dist/{index-DLK7DuCr.js → index-Cg88iPqc.js} +3 -3
  22. package/dist/{index-CXEYA7rt.js → index-Cn2CVr2m.js} +2 -2
  23. package/dist/{index-Ci6_CBwE.js → index-DTKd1x9H.js} +3 -3
  24. package/dist/{index-DM6XeWFk.js → index-DXvw5NUH.js} +2383 -2416
  25. package/dist/{index-ftuPuj0s.js → index-Dg_qr92O.js} +1 -1
  26. package/dist/{index-DMfYPIkB.js → index-Dj88QNYQ.js} +2 -2
  27. package/dist/{index-t2nMJUPu.js → index-Dx6dKBLL.js} +1 -1
  28. package/dist/{index-Bs9odXxd.js → index-DxH2PsDU.js} +6 -6
  29. package/dist/{index-DZ0fYNO9.js → index-Dy5HesOM.js} +11 -11
  30. package/dist/{index-Ceu-yckM.js → index-M_hPRTgh.js} +12 -12
  31. package/dist/{index-BoY7L8C4.js → index-TaAkEm82.js} +3 -2
  32. package/dist/{index-B2Dfbi8J.js → index-dti6XFQV.js} +2 -2
  33. package/dist/{index-BNPq7yBg.js → index-glQgW-8f.js} +2 -2
  34. package/dist/{index-CntZHojY.js → index-mHqvjT5a.js} +2 -2
  35. package/dist/{index-COobH4Vi.js → index-vqAJt3qL.js} +1 -1
  36. package/dist/index.js +1 -1
  37. package/dist/{instance-DD3kbAUh.js → instance-BXN17-Ol.js} +1 -1
  38. package/dist/{menuPermission-v0881tid.js → menuPermission-Bw3hPi8i.js} +3 -3
  39. package/dist/menuTree-Ctcz41N8.js +303 -0
  40. package/dist/pages.js +1 -1
  41. package/dist/{send-default-agent-team-message-Cug0T_7J.js → send-default-agent-team-message-DM0C9VL-.js} +1 -1
  42. package/dist/{sso-user-CnVXqYR7.js → sso-user-F62YVj4w.js} +1 -1
  43. package/dist/{training-BS23m-yy.js → training-Df00Ilsm.js} +1 -1
  44. package/dist/{webide-BPJ1IpZq.js → webide-Iw2coFFL.js} +3 -3
  45. package/dist/z-team-component.css +1 -1
  46. package/package.json +2 -1
  47. package/dist/SystemShell-CSXcsiNp.js +0 -752
  48. package/dist/index-BTJ83JLl.js +0 -1073
  49. package/dist/index-CU6jFFl5.js +0 -112
  50. package/dist/index-CZCKpsry.js +0 -607
  51. package/dist/useSidebarResize--Avuabb1.js +0 -46
@@ -0,0 +1,1176 @@
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { useNavigate as me, useLocation as se, Navigate as W } from "react-router-dom";
3
+ import { Spin as pe, Row as he, Col as M, Card as F, Statistic as B, Space as P, Tag as _, Button as S, Alert as q, Table as ye, Badge as ae, Popconfirm as H, message as k, Select as re, Drawer as ge, Tabs as be, Form as j, Modal as fe, Input as V, InputNumber as X } from "antd";
4
+ import { DownOutlined as xe, RightOutlined as we, DashboardOutlined as Q, ClusterOutlined as K, CloudServerOutlined as z, ContainerOutlined as oe, ReloadOutlined as Y, LockOutlined as ke, UnlockOutlined as ve, PlayCircleOutlined as Se, PauseCircleOutlined as Ie, ClearOutlined as le, SendOutlined as Ce, EyeOutlined as Pe, DeleteOutlined as ce, PlusOutlined as _e, EditOutlined as Re, BranchesOutlined as $e, RocketOutlined as Oe, AlertOutlined as Ne, FileTextOutlined as Ae, DatabaseOutlined as ee, CloudOutlined as Ee, DeploymentUnitOutlined as Te } from "@ant-design/icons";
5
+ import { useState as u, useMemo as Z, useEffect as L, useRef as G } from "react";
6
+ import { P as je, R as Le } from "./index-C1sQehbP.js";
7
+ import { f as De, M as ze } from "./menuPermission-Bw3hPi8i.js";
8
+ import { u as te, a3 as Ge } from "./ComponentDoc-C1yrRq6Y.js";
9
+ import { ListTable as ie } from "@yuku123/z-frontend-common/ui";
10
+ import "./index-DXvw5NUH.js";
11
+ const Fe = "_shell_1jjcx_7", He = "_sidebar_1jjcx_15", Me = "_menuList_1jjcx_37", Be = "_menuGroup_1jjcx_43", Ue = "_menuGroupHeader_1jjcx_47", We = "_menuGroupIcon_1jjcx_65", Ke = "_menuGroupLabel_1jjcx_70", qe = "_menuGroupArrow_1jjcx_74", Je = "_menuSubList_1jjcx_80", Ve = "_menuSubItem_1jjcx_86", Xe = "_menuSubItemActive_1jjcx_103", Ze = "_menuSubItemIcon_1jjcx_110", Qe = "_menuSubItemLabel_1jjcx_115", Ye = "_menuSubItemWrap_1jjcx_119", et = "_main_1jjcx_123", tt = "_empty_1jjcx_134", nt = "_emptyIcon_1jjcx_144", st = "_emptyText_1jjcx_149", w = {
12
+ shell: Fe,
13
+ sidebar: He,
14
+ menuList: Me,
15
+ menuGroup: Be,
16
+ menuGroupHeader: Ue,
17
+ menuGroupIcon: We,
18
+ menuGroupLabel: Ke,
19
+ menuGroupArrow: qe,
20
+ menuSubList: Je,
21
+ menuSubItem: Ve,
22
+ menuSubItemActive: Xe,
23
+ menuSubItemIcon: Ze,
24
+ menuSubItemLabel: Qe,
25
+ menuSubItemWrap: Ye,
26
+ main: et,
27
+ empty: tt,
28
+ emptyIcon: nt,
29
+ emptyText: st
30
+ };
31
+ function at(t, r) {
32
+ for (const l of t)
33
+ if (l.path === r) return l.element;
34
+ for (const l of t)
35
+ if (l.path.includes("*") || l.path.includes(":")) {
36
+ const m = "^" + l.path.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, "[^/]+") + "$";
37
+ if (new RegExp(m).test(r)) return l.element;
38
+ }
39
+ return null;
40
+ }
41
+ function rt({ text: t }) {
42
+ return /* @__PURE__ */ s("div", { className: w.empty, children: [
43
+ /* @__PURE__ */ e("div", { className: w.emptyIcon, children: "⚙️" }),
44
+ /* @__PURE__ */ e("div", { className: w.emptyText, children: t })
45
+ ] });
46
+ }
47
+ function ot({
48
+ groups: t,
49
+ routes: r,
50
+ mode: l,
51
+ emptyText: m,
52
+ activePathOverride: p,
53
+ menuOnly: g = !1
54
+ }) {
55
+ const b = me(), { pathname: d } = se(), I = te((n) => n.currentUser), x = te((n) => n.permissionState), [a, o] = u(
56
+ new Set(t.map((n) => n.title))
57
+ ), i = Z(
58
+ () => x === "failed" ? t : De(t, I),
59
+ [t, I, x]
60
+ ), v = Z(() => {
61
+ const n = p ?? d;
62
+ for (const h of i)
63
+ for (const y of h.items)
64
+ if (y.path === n) return y.key;
65
+ return null;
66
+ }, [i, p, d]), C = (n) => {
67
+ o((h) => {
68
+ const y = new Set(h);
69
+ return y.has(n) ? y.delete(n) : y.add(n), y;
70
+ });
71
+ }, N = (n) => {
72
+ b(`${n.path}?mode=${l}`);
73
+ }, f = Z(() => at(r, d), [r, d]);
74
+ return /* @__PURE__ */ s("div", { className: w.shell, children: [
75
+ /* @__PURE__ */ s("aside", { className: w.sidebar, children: [
76
+ /* @__PURE__ */ e(ze, {}),
77
+ /* @__PURE__ */ e("nav", { className: w.menuList, children: i.map((n) => {
78
+ const h = a.has(n.title);
79
+ return /* @__PURE__ */ s("div", { className: w.menuGroup, children: [
80
+ /* @__PURE__ */ s(
81
+ "div",
82
+ {
83
+ className: w.menuGroupHeader,
84
+ onClick: () => C(n.title),
85
+ children: [
86
+ /* @__PURE__ */ e("span", { className: w.menuGroupIcon, children: n.icon }),
87
+ /* @__PURE__ */ e("span", { className: w.menuGroupLabel, children: n.title }),
88
+ /* @__PURE__ */ e("span", { className: w.menuGroupArrow, children: h ? /* @__PURE__ */ e(xe, {}) : /* @__PURE__ */ e(we, {}) })
89
+ ]
90
+ }
91
+ ),
92
+ h && /* @__PURE__ */ e("ul", { className: w.menuSubList, children: n.items.map((y) => /* @__PURE__ */ s(
93
+ "li",
94
+ {
95
+ className: `${w.menuSubItemWrap} ${w.menuSubItem} ${v === y.key ? w.menuSubItemActive : ""}`,
96
+ onClick: () => N(y),
97
+ children: [
98
+ /* @__PURE__ */ e("span", { className: w.menuSubItemIcon, children: y.icon }),
99
+ /* @__PURE__ */ e("span", { className: w.menuSubItemLabel, children: y.label })
100
+ ]
101
+ },
102
+ y.key
103
+ )) })
104
+ ] }, n.title);
105
+ }) })
106
+ ] }),
107
+ g ? null : /* @__PURE__ */ s("main", { className: w.main, children: [
108
+ /* @__PURE__ */ e(je, {}),
109
+ /* @__PURE__ */ e(Le, { resetKey: d, children: f ?? /* @__PURE__ */ e(rt, { text: m }) })
110
+ ] })
111
+ ] });
112
+ }
113
+ const lt = "/z-team/ops/k8s";
114
+ async function de(t, r) {
115
+ const l = `${lt}${t}`, m = await fetch(l, {
116
+ headers: { "Content-Type": "application/json" },
117
+ ...r
118
+ }), p = m.headers && m.headers.get("content-type") || "";
119
+ if (!/json/i.test(p))
120
+ throw new Error(`数据源不可达:GET ${l} 返回 ${m.status} ${p || "(无 content-type)"},不是 JSON —— 该前缀没有进到后端接口(K8s 管理 API 在 z-ops 仓,z-opc 宿主未注册)`);
121
+ const g = await m.json();
122
+ if (g && g.success === !1)
123
+ throw new Error(`后端 ${l} 返回 success=false:${g.message || "(无 message)"}`);
124
+ return g;
125
+ }
126
+ async function E(t, r) {
127
+ return de(t, r);
128
+ }
129
+ async function ct() {
130
+ return E("/cluster/info");
131
+ }
132
+ async function it() {
133
+ return E("/nodes");
134
+ }
135
+ async function dt(t) {
136
+ return E("/nodes/cordon", {
137
+ method: "POST",
138
+ body: JSON.stringify({ name: t })
139
+ });
140
+ }
141
+ async function ut(t) {
142
+ return E("/nodes/uncordon", {
143
+ method: "POST",
144
+ body: JSON.stringify({ name: t })
145
+ });
146
+ }
147
+ async function mt(t = "*") {
148
+ return E(`/workloads/pods?namespace=${t}`);
149
+ }
150
+ async function pt(t, r, l = 200) {
151
+ return E(`/workloads/pods/${t}/${r}/logs?tailLines=${l}`);
152
+ }
153
+ async function ht(t, r) {
154
+ return E(`/workloads/pods/${t}/${r}/restart`, { method: "POST" });
155
+ }
156
+ async function yt(t, r) {
157
+ return E(`/workloads/pods/${t}/${r}`, { method: "DELETE" });
158
+ }
159
+ async function gt() {
160
+ return E("/namespaces");
161
+ }
162
+ const bt = () => {
163
+ var g, b;
164
+ const [t, r] = u(null), [l, m] = u(!0);
165
+ L(() => {
166
+ p();
167
+ const d = setInterval(p, 1e4);
168
+ return () => clearInterval(d);
169
+ }, []);
170
+ const p = async () => {
171
+ try {
172
+ const d = await ct();
173
+ d.success && r(d.data);
174
+ } catch (d) {
175
+ console.error("Failed to load cluster info", d);
176
+ } finally {
177
+ m(!1);
178
+ }
179
+ };
180
+ return l ? /* @__PURE__ */ e(pe, { size: "large" }) : /* @__PURE__ */ s("div", { style: { padding: 16 }, children: [
181
+ /* @__PURE__ */ s("h2", { style: { marginBottom: 24 }, children: [
182
+ /* @__PURE__ */ e(Q, {}),
183
+ " 运维总览"
184
+ ] }),
185
+ /* @__PURE__ */ s(he, { gutter: [16, 16], children: [
186
+ /* @__PURE__ */ e(M, { xs: 24, sm: 12, lg: 6, children: /* @__PURE__ */ s(F, { children: [
187
+ /* @__PURE__ */ e(
188
+ B,
189
+ {
190
+ title: /* @__PURE__ */ s(P, { children: [
191
+ /* @__PURE__ */ e(K, {}),
192
+ " K8s 节点"
193
+ ] }),
194
+ value: (t == null ? void 0 : t.readyNodes) ?? 0,
195
+ suffix: /* @__PURE__ */ s("span", { style: { color: "#999" }, children: [
196
+ " / ",
197
+ (t == null ? void 0 : t.nodeCount) ?? 0
198
+ ] })
199
+ }
200
+ ),
201
+ /* @__PURE__ */ e(_, { color: (t == null ? void 0 : t.status) === "Healthy" ? "success" : "warning", children: (t == null ? void 0 : t.status) ?? "Unknown" })
202
+ ] }) }),
203
+ /* @__PURE__ */ e(M, { xs: 24, sm: 12, lg: 6, children: /* @__PURE__ */ s(F, { children: [
204
+ /* @__PURE__ */ e(
205
+ B,
206
+ {
207
+ title: /* @__PURE__ */ s(P, { children: [
208
+ /* @__PURE__ */ e(z, {}),
209
+ " CPU"
210
+ ] }),
211
+ value: ((g = t == null ? void 0 : t.usedCpu) == null ? void 0 : g.toFixed(1)) ?? "0",
212
+ suffix: /* @__PURE__ */ s("span", { style: { color: "#999" }, children: [
213
+ " / ",
214
+ (t == null ? void 0 : t.totalCpu) ?? 0,
215
+ " cores"
216
+ ] }),
217
+ precision: 1
218
+ }
219
+ ),
220
+ /* @__PURE__ */ s(_, { color: ((t == null ? void 0 : t.usedCpu) ?? 0) / ((t == null ? void 0 : t.totalCpu) ?? 1) > 0.8 ? "error" : "success", children: [
221
+ (((t == null ? void 0 : t.usedCpu) ?? 0) / ((t == null ? void 0 : t.totalCpu) ?? 1) * 100).toFixed(0),
222
+ "%"
223
+ ] })
224
+ ] }) }),
225
+ /* @__PURE__ */ e(M, { xs: 24, sm: 12, lg: 6, children: /* @__PURE__ */ s(F, { children: [
226
+ /* @__PURE__ */ e(
227
+ B,
228
+ {
229
+ title: /* @__PURE__ */ s(P, { children: [
230
+ /* @__PURE__ */ e(Q, {}),
231
+ " 内存"
232
+ ] }),
233
+ value: ((b = t == null ? void 0 : t.usedMemory) == null ? void 0 : b.toFixed(1)) ?? "0",
234
+ suffix: /* @__PURE__ */ s("span", { style: { color: "#999" }, children: [
235
+ " / ",
236
+ (t == null ? void 0 : t.totalMemory) ?? 0,
237
+ " GB"
238
+ ] }),
239
+ precision: 1
240
+ }
241
+ ),
242
+ /* @__PURE__ */ s(_, { color: ((t == null ? void 0 : t.usedMemory) ?? 0) / ((t == null ? void 0 : t.totalMemory) ?? 1) > 0.8 ? "error" : "success", children: [
243
+ (((t == null ? void 0 : t.usedMemory) ?? 0) / ((t == null ? void 0 : t.totalMemory) ?? 1) * 100).toFixed(0),
244
+ "%"
245
+ ] })
246
+ ] }) }),
247
+ /* @__PURE__ */ e(M, { xs: 24, sm: 12, lg: 6, children: /* @__PURE__ */ s(F, { children: [
248
+ /* @__PURE__ */ e(
249
+ B,
250
+ {
251
+ title: /* @__PURE__ */ s(P, { children: [
252
+ /* @__PURE__ */ e(oe, {}),
253
+ " Pods"
254
+ ] }),
255
+ value: (t == null ? void 0 : t.runningPods) ?? 0,
256
+ suffix: /* @__PURE__ */ s("span", { style: { color: "#999" }, children: [
257
+ " / ",
258
+ (t == null ? void 0 : t.totalPods) ?? 0
259
+ ] })
260
+ }
261
+ ),
262
+ /* @__PURE__ */ s(_, { color: "success", children: [
263
+ (t == null ? void 0 : t.namespaceCount) ?? 0,
264
+ " namespaces"
265
+ ] })
266
+ ] }) })
267
+ ] }),
268
+ /* @__PURE__ */ e(F, { title: "集群信息", style: { marginTop: 16 }, children: /* @__PURE__ */ s(P, { orientation: "vertical", children: [
269
+ /* @__PURE__ */ s("div", { children: [
270
+ /* @__PURE__ */ e("strong", { children: "K8s 版本:" }),
271
+ " ",
272
+ (t == null ? void 0 : t.version) ?? "Unknown"
273
+ ] }),
274
+ /* @__PURE__ */ s("div", { children: [
275
+ /* @__PURE__ */ e("strong", { children: "集群状态:" }),
276
+ " ",
277
+ /* @__PURE__ */ e(_, { color: "success", children: t == null ? void 0 : t.status })
278
+ ] }),
279
+ /* @__PURE__ */ s("div", { children: [
280
+ /* @__PURE__ */ e("strong", { children: "节点数:" }),
281
+ " ",
282
+ t == null ? void 0 : t.nodeCount,
283
+ " (Ready: ",
284
+ t == null ? void 0 : t.readyNodes,
285
+ ")"
286
+ ] }),
287
+ /* @__PURE__ */ s("div", { children: [
288
+ /* @__PURE__ */ e("strong", { children: "CPU 使用率:" }),
289
+ " ",
290
+ (((t == null ? void 0 : t.usedCpu) ?? 0) / ((t == null ? void 0 : t.totalCpu) ?? 1) * 100).toFixed(1),
291
+ "%"
292
+ ] }),
293
+ /* @__PURE__ */ s("div", { children: [
294
+ /* @__PURE__ */ e("strong", { children: "内存使用率:" }),
295
+ " ",
296
+ (((t == null ? void 0 : t.usedMemory) ?? 0) / ((t == null ? void 0 : t.totalMemory) ?? 1) * 100).toFixed(1),
297
+ "%"
298
+ ] })
299
+ ] }) })
300
+ ] });
301
+ }, ft = () => {
302
+ const [t, r] = u([]), [l, m] = u(!1), [p, g] = u("");
303
+ L(() => {
304
+ b();
305
+ }, []);
306
+ const b = async () => {
307
+ m(!0), g("");
308
+ try {
309
+ const a = await it();
310
+ r(Array.isArray(a.data) ? a.data : []);
311
+ } catch (a) {
312
+ r([]), g(String((a == null ? void 0 : a.message) || a));
313
+ } finally {
314
+ m(!1);
315
+ }
316
+ }, d = async (a) => {
317
+ try {
318
+ await dt(a), k.success(`${a} 已封锁(停止调度)`), b();
319
+ } catch {
320
+ k.error("封锁失败");
321
+ }
322
+ }, I = async (a) => {
323
+ try {
324
+ await ut(a), k.success(`${a} 已解封`), b();
325
+ } catch {
326
+ k.error("解封失败");
327
+ }
328
+ };
329
+ return /* @__PURE__ */ s("div", { children: [
330
+ /* @__PURE__ */ e(P, { style: { marginBottom: 16 }, children: /* @__PURE__ */ e(S, { icon: /* @__PURE__ */ e(Y, {}), onClick: b, loading: l, children: "刷新" }) }),
331
+ p && /* @__PURE__ */ e(
332
+ q,
333
+ {
334
+ type: "error",
335
+ showIcon: !0,
336
+ style: { marginBottom: 12 },
337
+ message: "节点列表读取失败",
338
+ description: p
339
+ }
340
+ ),
341
+ /* @__PURE__ */ e(
342
+ ye,
343
+ {
344
+ columns: [
345
+ {
346
+ title: "名称",
347
+ dataIndex: "name",
348
+ key: "name",
349
+ render: (a) => /* @__PURE__ */ e("strong", { children: a })
350
+ },
351
+ {
352
+ title: "IP",
353
+ dataIndex: "ip",
354
+ key: "ip",
355
+ render: (a) => /* @__PURE__ */ e("code", { children: a })
356
+ },
357
+ {
358
+ title: "状态",
359
+ dataIndex: "status",
360
+ key: "status",
361
+ render: (a) => /* @__PURE__ */ e(ae, { status: a === "Ready" ? "success" : "error", text: a })
362
+ },
363
+ {
364
+ title: "角色",
365
+ dataIndex: "roles",
366
+ key: "roles",
367
+ render: (a) => a ? /* @__PURE__ */ e(_, { color: "blue", children: a }) : /* @__PURE__ */ e(_, { children: "worker" })
368
+ },
369
+ {
370
+ title: "CPU",
371
+ key: "cpu",
372
+ render: (a, o) => {
373
+ var C;
374
+ const i = o.cpuUsed, v = i != null && o.cpuCapacity > 0 ? i / o.cpuCapacity * 100 : null;
375
+ return /* @__PURE__ */ s("span", { children: [
376
+ i != null ? i.toFixed(2) : "—",
377
+ " / ",
378
+ ((C = o.cpuCapacity) == null ? void 0 : C.toFixed(0)) ?? 0,
379
+ " cores",
380
+ v != null && /* @__PURE__ */ s(_, { color: v > 80 ? "error" : "success", style: { marginLeft: 4 }, children: [
381
+ v.toFixed(0),
382
+ "%"
383
+ ] })
384
+ ] });
385
+ }
386
+ },
387
+ {
388
+ title: "内存",
389
+ key: "mem",
390
+ render: (a, o) => {
391
+ var C;
392
+ const i = o.memUsed, v = i != null && o.memCapacity > 0 ? i / o.memCapacity * 100 : null;
393
+ return /* @__PURE__ */ s("span", { children: [
394
+ i != null ? i.toFixed(1) : "—",
395
+ " / ",
396
+ ((C = o.memCapacity) == null ? void 0 : C.toFixed(1)) ?? 0,
397
+ " GB",
398
+ v != null && /* @__PURE__ */ s(_, { color: v > 80 ? "error" : "success", style: { marginLeft: 4 }, children: [
399
+ v.toFixed(0),
400
+ "%"
401
+ ] })
402
+ ] });
403
+ }
404
+ },
405
+ { title: "OS", dataIndex: "osImage", key: "osImage", ellipsis: !0, width: 200 },
406
+ { title: "运行时", dataIndex: "containerRuntime", key: "containerRuntime", width: 160 },
407
+ { title: "存活", dataIndex: "age", key: "age", width: 80 },
408
+ {
409
+ title: "操作",
410
+ key: "action",
411
+ width: 150,
412
+ render: (a, o) => /* @__PURE__ */ s(P, { children: [
413
+ /* @__PURE__ */ e(H, { title: `封锁 ${o.name}?`, onConfirm: () => d(o.name), children: /* @__PURE__ */ e(S, { size: "small", icon: /* @__PURE__ */ e(ke, {}), children: "Cordon" }) }),
414
+ /* @__PURE__ */ e(H, { title: `解封 ${o.name}?`, onConfirm: () => I(o.name), children: /* @__PURE__ */ e(S, { size: "small", icon: /* @__PURE__ */ e(ve, {}), children: "Uncordon" }) })
415
+ ] })
416
+ }
417
+ ],
418
+ dataSource: t,
419
+ rowKey: "name",
420
+ loading: l,
421
+ pagination: !1,
422
+ scroll: { x: 1400 },
423
+ size: "middle"
424
+ }
425
+ )
426
+ ] });
427
+ }, xt = ({
428
+ namespace: t,
429
+ podName: r,
430
+ tailLines: l = 200
431
+ }) => {
432
+ const [m, p] = u([]), [g, b] = u(!1), [d, I] = u(!1), x = G(null), a = G(null), o = G(!1);
433
+ L(() => (i(), () => {
434
+ var f;
435
+ (f = x.current) == null || f.close();
436
+ }), [t, r]), L(() => {
437
+ var f;
438
+ d || (f = a.current) == null || f.scrollIntoView({ behavior: "smooth" });
439
+ }, [m, d]);
440
+ const i = () => {
441
+ const f = window.location.protocol === "https:" ? "wss:" : "ws:", n = window.location.host, h = `${f}//${n}/z-team/ops/k8s/ws/logs?namespace=${t}&name=${r}&tailLines=${l}`, y = new WebSocket(h);
442
+ x.current = y, y.onopen = () => {
443
+ b(!0), k.success("日志流已连接");
444
+ }, y.onmessage = (R) => {
445
+ o.current || p((A) => [...A.slice(-1e3), R.data]);
446
+ }, y.onclose = () => {
447
+ b(!1);
448
+ }, y.onerror = () => {
449
+ b(!1), k.error("WebSocket 连接错误");
450
+ };
451
+ };
452
+ return /* @__PURE__ */ s("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
453
+ /* @__PURE__ */ s(P, { style: { marginBottom: 8 }, children: [
454
+ /* @__PURE__ */ e(_, { color: g ? "success" : "error", children: g ? "● 已连接" : "● 已断开" }),
455
+ /* @__PURE__ */ e(
456
+ S,
457
+ {
458
+ size: "small",
459
+ icon: d ? /* @__PURE__ */ e(Se, {}) : /* @__PURE__ */ e(Ie, {}),
460
+ onClick: () => {
461
+ o.current = !o.current, I(o.current);
462
+ },
463
+ children: d ? "继续" : "暂停"
464
+ }
465
+ ),
466
+ /* @__PURE__ */ e(S, { size: "small", icon: /* @__PURE__ */ e(le, {}), onClick: () => {
467
+ p([]);
468
+ }, children: "清空" }),
469
+ /* @__PURE__ */ e(S, { size: "small", onClick: () => {
470
+ var f;
471
+ (f = x.current) == null || f.close(), p([]), i();
472
+ }, children: "重连" })
473
+ ] }),
474
+ /* @__PURE__ */ s("div", { style: {
475
+ flex: 1,
476
+ background: "#1e1e1e",
477
+ borderRadius: 8,
478
+ padding: 12,
479
+ overflow: "auto",
480
+ fontFamily: 'Menlo, Monaco, "Courier New", monospace',
481
+ fontSize: 12,
482
+ lineHeight: 1.5,
483
+ color: "#d4d4d4"
484
+ }, children: [
485
+ m.map((f, n) => /* @__PURE__ */ e("div", { style: {
486
+ color: f.includes("ERROR") ? "#f44336" : f.includes("WARN") ? "#ff9800" : f.includes("INFO") ? "#4caf50" : "#d4d4d4",
487
+ whiteSpace: "pre-wrap",
488
+ wordBreak: "break-all"
489
+ }, children: f }, n)),
490
+ /* @__PURE__ */ e("div", { ref: a })
491
+ ] })
492
+ ] });
493
+ }, wt = ({
494
+ namespace: t,
495
+ podName: r
496
+ }) => {
497
+ const [l, m] = u(!1), [p, g] = u(""), [b, d] = u("sh"), [I, x] = u([]), a = G(null), o = G(null), i = G(null);
498
+ L(() => (t && r && v(), () => {
499
+ var n;
500
+ return (n = a.current) == null ? void 0 : n.close();
501
+ }), [t, r]);
502
+ const v = () => {
503
+ const n = window.location.protocol === "https:" ? "wss:" : "ws:", h = window.location.host, y = `${n}//${h}/z-team/ops/k8s/ws/exec?namespace=${t}&name=${r}&command=${b}`, R = new WebSocket(y);
504
+ a.current = R, R.onopen = () => {
505
+ m(!0), x((A) => [...A, `Connected to ${t}/${r} (${b})`]), k.success("终端已连接");
506
+ }, R.onmessage = (A) => {
507
+ x((J) => [...J.slice(-500), A.data]), setTimeout(() => {
508
+ o.current && (o.current.scrollTop = o.current.scrollHeight);
509
+ }, 50);
510
+ }, R.onclose = () => {
511
+ m(!1), x((A) => [...A, `
512
+ --- 连接已关闭 ---`]);
513
+ }, R.onerror = () => {
514
+ m(!1), k.error("WebSocket 连接错误");
515
+ };
516
+ }, C = () => {
517
+ !p.trim() || !a.current || (a.current.readyState === WebSocket.OPEN ? (a.current.send(p), x((n) => [...n, `$ ${p}`]), g("")) : k.warning("WebSocket 未连接"));
518
+ }, N = (n) => {
519
+ var h;
520
+ n.key === "Enter" && C(), n.key === "Tab" && (n.preventDefault(), ((h = a.current) == null ? void 0 : h.readyState) === WebSocket.OPEN && a.current.send(" "));
521
+ }, f = () => x([]);
522
+ return /* @__PURE__ */ s("div", { style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
523
+ /* @__PURE__ */ s(P, { style: { marginBottom: 8 }, children: [
524
+ /* @__PURE__ */ e(_, { color: l ? "success" : "error", children: l ? "● 已连接" : "● 已断开" }),
525
+ /* @__PURE__ */ e(
526
+ re,
527
+ {
528
+ value: b,
529
+ onChange: d,
530
+ size: "small",
531
+ style: { width: 100 },
532
+ options: ["sh", "bash", "/bin/sh", "/bin/bash"].map((n) => ({ label: n, value: n }))
533
+ }
534
+ ),
535
+ /* @__PURE__ */ e(S, { size: "small", onClick: f, icon: /* @__PURE__ */ e(le, {}), children: "清空" }),
536
+ /* @__PURE__ */ e(S, { size: "small", onClick: () => {
537
+ var n;
538
+ (n = a.current) == null || n.close(), setTimeout(v, 200);
539
+ }, children: "重连" })
540
+ ] }),
541
+ /* @__PURE__ */ s(
542
+ "div",
543
+ {
544
+ ref: o,
545
+ style: {
546
+ flex: 1,
547
+ background: "#1a1a2e",
548
+ borderRadius: 8,
549
+ padding: 12,
550
+ overflow: "auto",
551
+ fontFamily: '"JetBrains Mono", "Fira Code", Menlo, Monaco, "Courier New", monospace',
552
+ fontSize: 13,
553
+ lineHeight: 1.6,
554
+ color: "#00ff88",
555
+ marginBottom: 8,
556
+ minHeight: 300,
557
+ border: "1px solid #333"
558
+ },
559
+ children: [
560
+ I.map((n, h) => /* @__PURE__ */ e("div", { style: {
561
+ whiteSpace: "pre-wrap",
562
+ wordBreak: "break-all",
563
+ color: n.startsWith("$ ") ? "#00bfff" : n.startsWith("---") ? "#666" : n.includes("Error") || n.includes("error") ? "#ff4444" : "#00ff88"
564
+ }, children: n }, h)),
565
+ /* @__PURE__ */ e("span", { ref: i, style: {
566
+ display: "inline-block",
567
+ width: 8,
568
+ height: 16,
569
+ background: "#00ff88",
570
+ animation: "blink 1s step-end infinite",
571
+ verticalAlign: "middle"
572
+ } })
573
+ ]
574
+ }
575
+ ),
576
+ /* @__PURE__ */ s(P.Compact, { style: { width: "100%" }, children: [
577
+ /* @__PURE__ */ s("span", { style: {
578
+ background: "#333",
579
+ color: "#00ff88",
580
+ padding: "4px 10px",
581
+ borderRadius: "8px 0 0 8px",
582
+ fontFamily: "monospace",
583
+ fontSize: 13,
584
+ lineHeight: "22px",
585
+ borderRight: "1px solid #555"
586
+ }, children: [
587
+ "$ ",
588
+ t,
589
+ "/",
590
+ r
591
+ ] }),
592
+ /* @__PURE__ */ e(
593
+ "input",
594
+ {
595
+ value: p,
596
+ onChange: (n) => g(n.target.value),
597
+ onKeyDown: N,
598
+ placeholder: "输入命令后按 Enter...",
599
+ disabled: !l,
600
+ style: {
601
+ flex: 1,
602
+ background: "#1a1a2e",
603
+ color: "#00ff88",
604
+ border: "1px solid #555",
605
+ borderLeft: "none",
606
+ borderRight: "none",
607
+ padding: "4px 10px",
608
+ fontFamily: "monospace",
609
+ fontSize: 13,
610
+ outline: "none"
611
+ }
612
+ }
613
+ ),
614
+ /* @__PURE__ */ e(
615
+ S,
616
+ {
617
+ type: "primary",
618
+ icon: /* @__PURE__ */ e(Ce, {}),
619
+ onClick: C,
620
+ disabled: !l,
621
+ children: "发送"
622
+ }
623
+ )
624
+ ] })
625
+ ] });
626
+ }, kt = (t) => {
627
+ switch (t) {
628
+ case "Running":
629
+ return "success";
630
+ case "Pending":
631
+ return "warning";
632
+ case "Succeeded":
633
+ return "default";
634
+ case "Failed":
635
+ return "error";
636
+ default:
637
+ return "default";
638
+ }
639
+ }, vt = () => {
640
+ const [t, r] = u([]), [l, m] = u(!1), [p, g] = u(""), [b, d] = u("*"), [I, x] = u([]), [a, o] = u(!1), [i, v] = u(null), [C, N] = u("logs"), [f, n] = u("");
641
+ L(() => {
642
+ h();
643
+ }, []), L(() => {
644
+ y();
645
+ }, [b]);
646
+ const h = async () => {
647
+ try {
648
+ const c = await gt();
649
+ x(Array.isArray(c.data) ? ["*", ...c.data] : ["*"]);
650
+ } catch {
651
+ x(["*"]);
652
+ }
653
+ }, y = async () => {
654
+ m(!0), g("");
655
+ try {
656
+ const c = await mt(b);
657
+ r(Array.isArray(c.data) ? c.data : []);
658
+ } catch (c) {
659
+ r([]), g(String((c == null ? void 0 : c.message) || c));
660
+ } finally {
661
+ m(!1);
662
+ }
663
+ }, R = async (c) => {
664
+ var $;
665
+ v(c), N("logs"), o(!0);
666
+ try {
667
+ const T = await pt(c.namespace, c.name, 200);
668
+ n((($ = T == null ? void 0 : T.data) == null ? void 0 : $.logs) ?? "");
669
+ } catch (T) {
670
+ n(`加载日志失败:${String((T == null ? void 0 : T.message) || T)}`);
671
+ }
672
+ }, A = async (c) => {
673
+ try {
674
+ await ht(c.namespace, c.name), k.success(`${c.name} 已重启`), y();
675
+ } catch {
676
+ k.error("重启失败");
677
+ }
678
+ }, J = async (c) => {
679
+ try {
680
+ await yt(c.namespace, c.name), k.success(`${c.name} 已删除`), y();
681
+ } catch {
682
+ k.error("删除失败");
683
+ }
684
+ }, ue = [
685
+ {
686
+ title: "名称",
687
+ dataIndex: "name",
688
+ key: "name",
689
+ render: (c, $) => /* @__PURE__ */ e("a", { onClick: () => R($), children: c })
690
+ },
691
+ { title: "命名空间", dataIndex: "namespace", key: "namespace", width: 120 },
692
+ { title: "节点", dataIndex: "nodeName", key: "nodeName", width: 130 },
693
+ { title: "IP", dataIndex: "ip", key: "ip", width: 120 },
694
+ {
695
+ title: "状态",
696
+ dataIndex: "status",
697
+ key: "status",
698
+ width: 100,
699
+ render: (c) => /* @__PURE__ */ e(ae, { status: kt(c), text: c })
700
+ },
701
+ {
702
+ title: "就绪",
703
+ dataIndex: "ready",
704
+ key: "ready",
705
+ width: 70,
706
+ render: (c) => c ? /* @__PURE__ */ e(_, { color: "success", children: "✓" }) : /* @__PURE__ */ e(_, { color: "error", children: "✗" })
707
+ },
708
+ { title: "重启", dataIndex: "restartCount", key: "restartCount", width: 70 },
709
+ { title: "存活", dataIndex: "age", key: "age", width: 80 },
710
+ {
711
+ title: "操作",
712
+ key: "action",
713
+ width: 200,
714
+ render: (c, $) => /* @__PURE__ */ s(P, { children: [
715
+ /* @__PURE__ */ e(S, { size: "small", icon: /* @__PURE__ */ e(Pe, {}), onClick: () => R($), children: "日志" }),
716
+ /* @__PURE__ */ e(H, { title: "确认重启此 Pod?", onConfirm: () => A($), children: /* @__PURE__ */ e(S, { size: "small", type: "primary", ghost: !0, children: "重启" }) }),
717
+ /* @__PURE__ */ e(H, { title: "确认删除此 Pod?", onConfirm: () => J($), children: /* @__PURE__ */ e(S, { size: "small", danger: !0, icon: /* @__PURE__ */ e(ce, {}), children: "删除" }) })
718
+ ] })
719
+ }
720
+ ];
721
+ return /* @__PURE__ */ s("div", { children: [
722
+ /* @__PURE__ */ s(P, { style: { marginBottom: 16 }, children: [
723
+ /* @__PURE__ */ e("span", { children: "命名空间:" }),
724
+ /* @__PURE__ */ e(
725
+ re,
726
+ {
727
+ value: b,
728
+ onChange: d,
729
+ style: { width: 200 },
730
+ options: I.map((c) => ({ label: c, value: c }))
731
+ }
732
+ ),
733
+ /* @__PURE__ */ e(S, { icon: /* @__PURE__ */ e(Y, {}), onClick: y, loading: l, children: "刷新" })
734
+ ] }),
735
+ p && /* @__PURE__ */ e(
736
+ q,
737
+ {
738
+ type: "error",
739
+ showIcon: !0,
740
+ style: { marginBottom: 12 },
741
+ message: "Pod 列表读取失败",
742
+ description: p
743
+ }
744
+ ),
745
+ /* @__PURE__ */ e(
746
+ ie,
747
+ {
748
+ rows: t,
749
+ columns: ue,
750
+ rowKey: "name",
751
+ loading: l,
752
+ scroll: { x: 1e3 },
753
+ searchKeys: ["name", "namespace", "nodeName"],
754
+ searchPlaceholder: "按 Pod 名 / 命名空间 / 节点过滤",
755
+ emptyTitle: "暂无 Pod",
756
+ emptyDescription: "该命名空间下还没有 Pod。",
757
+ tableProps: { size: "middle" }
758
+ }
759
+ ),
760
+ /* @__PURE__ */ e(
761
+ ge,
762
+ {
763
+ title: i ? `${i.name} (${i.namespace})` : "",
764
+ placement: "right",
765
+ size: "large",
766
+ open: a,
767
+ onClose: () => o(!1),
768
+ children: /* @__PURE__ */ e(
769
+ be,
770
+ {
771
+ activeKey: C,
772
+ onChange: N,
773
+ items: [
774
+ {
775
+ key: "logs",
776
+ label: "实时日志",
777
+ children: i ? /* @__PURE__ */ e(
778
+ xt,
779
+ {
780
+ namespace: i.namespace,
781
+ podName: i.name
782
+ }
783
+ ) : null
784
+ },
785
+ {
786
+ key: "exec",
787
+ label: "终端",
788
+ children: /* @__PURE__ */ e("div", { style: { padding: 20 }, children: /* @__PURE__ */ e(
789
+ wt,
790
+ {
791
+ namespace: (i == null ? void 0 : i.namespace) ?? "",
792
+ podName: (i == null ? void 0 : i.name) ?? ""
793
+ }
794
+ ) })
795
+ }
796
+ ]
797
+ }
798
+ )
799
+ }
800
+ )
801
+ ] });
802
+ };
803
+ async function U(t, r) {
804
+ return de(`/hpa${t}`, r);
805
+ }
806
+ const St = () => {
807
+ const [t, r] = u([]), [l, m] = u(!1), [p, g] = u(""), [b, d] = u(!1), [I, x] = u(!1), [a] = j.useForm();
808
+ L(() => {
809
+ o();
810
+ }, []);
811
+ const o = async () => {
812
+ m(!0), g("");
813
+ try {
814
+ const n = await U("/list?namespace=*");
815
+ r(Array.isArray(n.data) ? n.data : []);
816
+ } catch (n) {
817
+ r([]), g(String((n == null ? void 0 : n.message) || n));
818
+ } finally {
819
+ m(!1);
820
+ }
821
+ }, i = () => {
822
+ x(!1), a.resetFields(), a.setFieldsValue({ minReplicas: 1, maxReplicas: 10, cpuTarget: 80 }), d(!0);
823
+ }, v = (n) => {
824
+ x(!0), a.setFieldsValue({
825
+ name: n.name,
826
+ namespace: n.namespace,
827
+ deploymentName: n.scaleTargetRef,
828
+ minReplicas: n.minReplicas,
829
+ maxReplicas: n.maxReplicas,
830
+ cpuTarget: n.cpuTarget
831
+ }), d(!0);
832
+ }, C = async () => {
833
+ try {
834
+ const n = await a.validateFields();
835
+ I ? (await U("/update", {
836
+ method: "POST",
837
+ body: JSON.stringify({
838
+ namespace: n.namespace,
839
+ name: n.name,
840
+ minReplicas: n.minReplicas,
841
+ maxReplicas: n.maxReplicas
842
+ })
843
+ }), k.success("HPA 更新成功")) : (await U("/create", {
844
+ method: "POST",
845
+ body: JSON.stringify(n)
846
+ }), k.success("HPA 创建成功")), d(!1), o();
847
+ } catch {
848
+ k.error("操作失败");
849
+ }
850
+ }, N = async (n) => {
851
+ try {
852
+ await U(`/delete/${n.namespace}/${n.name}`, { method: "DELETE" }), k.success("HPA 已删除"), o();
853
+ } catch {
854
+ k.error("删除失败");
855
+ }
856
+ };
857
+ return /* @__PURE__ */ s("div", { children: [
858
+ /* @__PURE__ */ s(P, { style: { marginBottom: 16 }, children: [
859
+ /* @__PURE__ */ e(S, { type: "primary", icon: /* @__PURE__ */ e(_e, {}), onClick: i, children: "新建 HPA" }),
860
+ /* @__PURE__ */ e(S, { icon: /* @__PURE__ */ e(Y, {}), onClick: o, loading: l, children: "刷新" })
861
+ ] }),
862
+ p && /* @__PURE__ */ e(
863
+ q,
864
+ {
865
+ type: "error",
866
+ showIcon: !0,
867
+ style: { marginBottom: 12 },
868
+ message: "HPA 列表读取失败",
869
+ description: p
870
+ }
871
+ ),
872
+ /* @__PURE__ */ e(
873
+ ie,
874
+ {
875
+ rows: t,
876
+ columns: [
877
+ { title: "名称", dataIndex: "name", key: "name", render: (n) => /* @__PURE__ */ e("strong", { children: n }) },
878
+ { title: "命名空间", dataIndex: "namespace", key: "namespace" },
879
+ { title: "目标 Deployment", dataIndex: "scaleTargetRef", key: "target" },
880
+ {
881
+ title: "副本范围",
882
+ key: "replicas",
883
+ render: (n, h) => /* @__PURE__ */ s("span", { children: [
884
+ h.minReplicas,
885
+ " ~ ",
886
+ h.maxReplicas,
887
+ " (当前: ",
888
+ h.currentReplicas ?? "-",
889
+ ")"
890
+ ] })
891
+ },
892
+ {
893
+ title: "CPU 目标",
894
+ dataIndex: "cpuTarget",
895
+ key: "cpuTarget",
896
+ render: (n) => n ? /* @__PURE__ */ s(_, { color: "blue", children: [
897
+ n,
898
+ "%"
899
+ ] }) : "-"
900
+ },
901
+ {
902
+ title: "期望副本",
903
+ dataIndex: "desiredReplicas",
904
+ key: "desired",
905
+ render: (n) => n ? /* @__PURE__ */ e(_, { color: "green", children: n }) : "-"
906
+ },
907
+ { title: "存活", dataIndex: "age", key: "age" },
908
+ {
909
+ title: "操作",
910
+ key: "action",
911
+ width: 150,
912
+ render: (n, h) => /* @__PURE__ */ s(P, { children: [
913
+ /* @__PURE__ */ e(S, { size: "small", icon: /* @__PURE__ */ e(Re, {}), onClick: () => v(h), children: "编辑" }),
914
+ /* @__PURE__ */ e(H, { title: `删除 HPA ${h.name}?`, onConfirm: () => N(h), children: /* @__PURE__ */ e(S, { size: "small", danger: !0, icon: /* @__PURE__ */ e(ce, {}), children: "删除" }) })
915
+ ] })
916
+ }
917
+ ],
918
+ rowKey: "name",
919
+ loading: l,
920
+ searchKeys: ["name", "namespace", "scaleTargetRef"],
921
+ searchPlaceholder: "按 HPA 名 / 命名空间 / 目标 Deployment 过滤",
922
+ emptyTitle: "暂无 HPA",
923
+ emptyDescription: "该集群还没有配置水平弹性伸缩,HPA 会自动扩缩容目标 Deployment。",
924
+ tableProps: { size: "middle" }
925
+ }
926
+ ),
927
+ /* @__PURE__ */ e(
928
+ fe,
929
+ {
930
+ title: I ? "编辑 HPA" : "新建 HPA",
931
+ open: b,
932
+ onOk: C,
933
+ onCancel: () => d(!1),
934
+ children: /* @__PURE__ */ s(j, { form: a, layout: "vertical", children: [
935
+ /* @__PURE__ */ e(j.Item, { name: "namespace", label: "命名空间", rules: [{ required: !0 }], children: /* @__PURE__ */ e(V, { disabled: I }) }),
936
+ /* @__PURE__ */ e(j.Item, { name: "name", label: "HPA 名称", rules: [{ required: !0 }], children: /* @__PURE__ */ e(V, { disabled: I }) }),
937
+ /* @__PURE__ */ e(j.Item, { name: "deploymentName", label: "目标 Deployment", rules: [{ required: !0 }], children: /* @__PURE__ */ e(V, { disabled: I, placeholder: "namespace/deploymentName" }) }),
938
+ /* @__PURE__ */ s(P, { children: [
939
+ /* @__PURE__ */ e(j.Item, { name: "minReplicas", label: "最小副本", rules: [{ required: !0 }], children: /* @__PURE__ */ e(X, { min: 0, max: 100 }) }),
940
+ /* @__PURE__ */ e(j.Item, { name: "maxReplicas", label: "最大副本", rules: [{ required: !0 }], children: /* @__PURE__ */ e(X, { min: 1, max: 100 }) })
941
+ ] }),
942
+ /* @__PURE__ */ e(j.Item, { name: "cpuTarget", label: "CPU 目标 (%)", children: /* @__PURE__ */ e(X, { min: 1, max: 100 }) })
943
+ ] })
944
+ }
945
+ )
946
+ ] });
947
+ }, It = [
948
+ {
949
+ title: "DevOps 运维",
950
+ icon: /* @__PURE__ */ e(K, {}),
951
+ items: [
952
+ {
953
+ key: "devops-dashboard",
954
+ label: "运维总览",
955
+ icon: /* @__PURE__ */ e(Q, {}),
956
+ path: "/ops/devops/dashboard",
957
+ desc: "集群概览与资源统计"
958
+ },
959
+ {
960
+ key: "devops-nodes",
961
+ label: "节点管理",
962
+ icon: /* @__PURE__ */ e(K, {}),
963
+ path: "/ops/devops/nodes",
964
+ desc: "K8s 节点列表与状态"
965
+ },
966
+ {
967
+ key: "devops-pods",
968
+ label: "Pod 管理",
969
+ icon: /* @__PURE__ */ e(oe, {}),
970
+ path: "/ops/devops/pods",
971
+ desc: "Pod 列表、日志、终端"
972
+ },
973
+ {
974
+ key: "devops-hpa",
975
+ label: "弹性伸缩",
976
+ icon: /* @__PURE__ */ e(z, {}),
977
+ path: "/ops/devops/hpa",
978
+ desc: "HPA 自动扩缩容策略"
979
+ },
980
+ {
981
+ key: "devops-registry",
982
+ label: "镜像仓库",
983
+ icon: /* @__PURE__ */ e(z, {}),
984
+ path: "/ops/devops/registry",
985
+ desc: "容器镜像统一管理"
986
+ },
987
+ {
988
+ key: "devops-pipeline",
989
+ label: "流水线",
990
+ icon: /* @__PURE__ */ e($e, {}),
991
+ path: "/ops/devops/pipeline",
992
+ desc: "CI/CD 流水线编排"
993
+ },
994
+ {
995
+ key: "devops-release",
996
+ label: "发布管理",
997
+ icon: /* @__PURE__ */ e(Oe, {}),
998
+ path: "/ops/devops/release",
999
+ desc: "应用发布与回滚"
1000
+ },
1001
+ {
1002
+ key: "devops-monitor",
1003
+ label: "监控告警",
1004
+ icon: /* @__PURE__ */ e(Ne, {}),
1005
+ path: "/ops/devops/monitor",
1006
+ desc: "Prometheus/Grafana 监控"
1007
+ },
1008
+ {
1009
+ key: "devops-logs",
1010
+ label: "日志管理",
1011
+ icon: /* @__PURE__ */ e(Ae, {}),
1012
+ path: "/ops/devops/logs",
1013
+ desc: "Loki 集中日志查询"
1014
+ },
1015
+ {
1016
+ key: "devops-dba",
1017
+ label: "DBA 工单",
1018
+ icon: /* @__PURE__ */ e(ee, {}),
1019
+ path: "/ops/devops/dba",
1020
+ desc: "数据库运维工单"
1021
+ }
1022
+ ]
1023
+ },
1024
+ {
1025
+ title: "基础设施",
1026
+ icon: /* @__PURE__ */ e(K, {}),
1027
+ items: [
1028
+ {
1029
+ key: "ops-channel",
1030
+ label: "渠道管理",
1031
+ icon: /* @__PURE__ */ e(Ee, {}),
1032
+ path: "/ops/channel",
1033
+ desc: "部署渠道配置与管理"
1034
+ },
1035
+ {
1036
+ key: "ops-env",
1037
+ label: "环境管理",
1038
+ icon: /* @__PURE__ */ e(z, {}),
1039
+ path: "/ops/delivery",
1040
+ desc: "运行环境配置与管理"
1041
+ },
1042
+ {
1043
+ key: "ops-deploy",
1044
+ label: "部署管理",
1045
+ icon: /* @__PURE__ */ e(Te, {}),
1046
+ path: "/ops/deployment",
1047
+ desc: "应用部署与发布管理"
1048
+ },
1049
+ {
1050
+ key: "ops-repo",
1051
+ label: "仓库管理",
1052
+ icon: /* @__PURE__ */ e(ee, {}),
1053
+ path: "/ops/repo-mgmt",
1054
+ desc: "代码仓库与镜像管理"
1055
+ }
1056
+ ]
1057
+ },
1058
+ {
1059
+ title: "资源管理",
1060
+ icon: /* @__PURE__ */ e(z, {}),
1061
+ items: [
1062
+ {
1063
+ key: "resource",
1064
+ label: "资源管理",
1065
+ icon: /* @__PURE__ */ e(z, {}),
1066
+ path: "/resource/domain",
1067
+ desc: "域名、ECS、RDS、OSS 管理"
1068
+ }
1069
+ ]
1070
+ }
1071
+ ];
1072
+ function D({ label: t }) {
1073
+ return /* @__PURE__ */ s("div", { style: { padding: 40, textAlign: "center", color: "#999" }, children: [
1074
+ /* @__PURE__ */ s("h2", { children: [
1075
+ "🚧 ",
1076
+ t
1077
+ ] }),
1078
+ /* @__PURE__ */ e("p", { children: "功能开发中..." })
1079
+ ] });
1080
+ }
1081
+ function Ct({ label: t, reason: r, message: l = "该页面未孵化,因为后端接口尚不可用" }) {
1082
+ return /* @__PURE__ */ s("div", { style: { padding: 40, maxWidth: 720, margin: "0 auto" }, children: [
1083
+ /* @__PURE__ */ s("h2", { style: { textAlign: "center" }, children: [
1084
+ "🧪 ",
1085
+ t
1086
+ ] }),
1087
+ /* @__PURE__ */ e(
1088
+ q,
1089
+ {
1090
+ type: "warning",
1091
+ showIcon: !0,
1092
+ message: l,
1093
+ description: r
1094
+ }
1095
+ )
1096
+ ] });
1097
+ }
1098
+ function O({ label: t }) {
1099
+ return /* @__PURE__ */ e(
1100
+ Ct,
1101
+ {
1102
+ label: t,
1103
+ message: "该页面未孵化,因为组件从来不在本仓",
1104
+ reason: "组件从未迁进本仓:z-opc 的 src 目录下没有这个组件,历史上也没有任何提交 import 过它(OPS_ROUTES 里留着一个解析不到的标识符)。要恢复这一页,得先把组件从 z-ops 迁进来并接上它自己的后端;在那之前这里刻意不放假表格。"
1105
+ }
1106
+ );
1107
+ }
1108
+ function ne() {
1109
+ const { pathname: t } = se();
1110
+ return /* @__PURE__ */ e(W, { to: t, replace: !0 });
1111
+ }
1112
+ const Pt = [...Ge, "/script"], _t = [
1113
+ // ─── 运维中心 ───
1114
+ // ⚠ 这一族路由的组件从来没有从 z-ops 迁进来(见 UnmigratedPage 注释)。原先直接写
1115
+ // <ChannelPage/> 之类会在**模块求值期**抛 ReferenceError 并白屏整个前端,不是只坏这一页。
1116
+ { path: "/ops", element: /* @__PURE__ */ e(W, { to: "/ops/devops", replace: !0 }) },
1117
+ { path: "/ops/channel", element: /* @__PURE__ */ e(O, { label: "渠道管理" }) },
1118
+ { path: "/ops/delivery", element: /* @__PURE__ */ e(O, { label: "环境管理" }) },
1119
+ { path: "/ops/deployment", element: /* @__PURE__ */ e(O, { label: "部署管理" }) },
1120
+ { path: "/ops/deployment/:id", element: /* @__PURE__ */ e(O, { label: "部署管理" }) },
1121
+ { path: "/ops/repo-mgmt", element: /* @__PURE__ */ e(O, { label: "仓库管理" }) },
1122
+ { path: "/ops/git-platform", element: /* @__PURE__ */ e(O, { label: "仓库管理" }) },
1123
+ // ─── DevOps 子路由(K8s 管理面:2026-11-09 复活,数据源改由主壳 OpsK8sController 提供)───
1124
+ // ⚠ 历史:这 4 条曾挂真组件,但 API_BASE '/z-team/ops/k8s' 的 handler 只在 z-ops 仓的
1125
+ // z-ops-web 里,主壳 boot jar 的 BOOT-INF/lib 里 0 个 z-ops-* ⇒ 实测 GET /z-team/ops/k8s/nodes
1126
+ // 返回 HTTP 200 + text/html(SPA 兜底页)= 页面把"路不通"渲染成"暂无数据"(假绿)。
1127
+ // 当时改成了占位卡(卡 TASK-20261023-056 · ops-001~004)。
1128
+ //
1129
+ // ⇒ 现在:**主壳自己实现同一份接口**(OpsK8sController,直连 apiserver,字段与 z-ops 逐字对齐)
1130
+ // ⇒ 占位卡换成真组件。为什么不反向代理 z-ops:它的接口走 SSO(实测 302 → /login),
1131
+ // 而两侧 JWT secret 不同(主壳 zgw-jwt/jwt-secret vs z-ops sso-jwt/sso-jwt-secret)⇒ 必被挡;
1132
+ // 给 z-ops 加 @NoLogin 又等于把「删 Pod / 改 HPA」公开到 NodePort 30886。
1133
+ { path: "/ops/devops", element: /* @__PURE__ */ e(W, { to: "/ops/devops/dashboard", replace: !0 }) },
1134
+ { path: "/ops/devops/dashboard", element: /* @__PURE__ */ e(bt, {}) },
1135
+ { path: "/ops/devops/nodes", element: /* @__PURE__ */ e(ft, {}) },
1136
+ { path: "/ops/devops/pods", element: /* @__PURE__ */ e(vt, {}) },
1137
+ { path: "/ops/devops/hpa", element: /* @__PURE__ */ e(St, {}) },
1138
+ { path: "/ops/devops/registry", element: /* @__PURE__ */ e(D, { label: "镜像仓库" }) },
1139
+ { path: "/ops/devops/pipeline", element: /* @__PURE__ */ e(D, { label: "流水线" }) },
1140
+ { path: "/ops/devops/release", element: /* @__PURE__ */ e(D, { label: "发布管理" }) },
1141
+ { path: "/ops/devops/monitor", element: /* @__PURE__ */ e(D, { label: "监控告警" }) },
1142
+ { path: "/ops/devops/logs", element: /* @__PURE__ */ e(D, { label: "日志管理" }) },
1143
+ { path: "/ops/devops/dba", element: /* @__PURE__ */ e(D, { label: "DBA 工单" }) },
1144
+ // ─── 资源管理 ───
1145
+ { path: "/resource", element: /* @__PURE__ */ e(W, { to: "/resource/domain", replace: !0 }) },
1146
+ { path: "/resource/domain", element: /* @__PURE__ */ e(O, { label: "域名管理" }) },
1147
+ { path: "/resource/ecs", element: /* @__PURE__ */ e(O, { label: "ECS 管理" }) },
1148
+ { path: "/resource/rds", element: /* @__PURE__ */ e(O, { label: "RDS 管理" }) },
1149
+ { path: "/resource/oss", element: /* @__PURE__ */ e(O, { label: "OSS 管理" }) },
1150
+ // ─── 已迁到中间件面的前缀 → 旧深链交还中间件面 ───
1151
+ // ⚠ 必须排在最后:matchWorkbenchPath 先全表精确、再全表通配,
1152
+ // 但本面自己的 /ops/* 与 /resource/* 都在前面,不会被这几条吃掉。
1153
+ ...Pt.flatMap((t) => [
1154
+ { path: t, element: /* @__PURE__ */ e(ne, {}) },
1155
+ { path: `${t}/*`, element: /* @__PURE__ */ e(ne, {}) }
1156
+ ])
1157
+ ];
1158
+ function zt({
1159
+ activePathOverride: t,
1160
+ menuOnly: r = !1
1161
+ } = {}) {
1162
+ return /* @__PURE__ */ e(
1163
+ ot,
1164
+ {
1165
+ groups: It,
1166
+ routes: _t,
1167
+ mode: "ops",
1168
+ emptyText: "请从左侧菜单选择运维模块",
1169
+ activePathOverride: t,
1170
+ menuOnly: r
1171
+ }
1172
+ );
1173
+ }
1174
+ export {
1175
+ zt as default
1176
+ };