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