@yuku123/z-mist-component 0.1.0 → 0.1.1

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/pages.js CHANGED
@@ -1,19 +1,20 @@
1
- import { j as e, S as ce, A as de, a as he, M as pe } from "./MistApp-CBRpXRAw.js";
2
- import { UserOutlined as se, LockOutlined as G, RiseOutlined as xe, KeyOutlined as ne, ThunderboltOutlined as ue, WarningOutlined as me, CheckCircleOutlined as ge, ArrowLeftOutlined as Y, HistoryOutlined as ye, CopyOutlined as Q, EyeInvisibleOutlined as je, EyeOutlined as fe, RollbackOutlined as we, SwapOutlined as Ie, UnlockOutlined as be, ReloadOutlined as W, PlusOutlined as Se, PlayCircleOutlined as Ce, EditOutlined as Te, DeleteOutlined as ke, SearchOutlined as ve, HomeOutlined as Oe, DashboardOutlined as ze, SafetyOutlined as Ee, AppstoreOutlined as Ae, FileTextOutlined as Re } from "@ant-design/icons";
3
- import { useState as d, useEffect as B } from "react";
4
- import { useNavigate as H, useParams as re } from "react-router-dom";
5
- import { Card as I, Form as x, Input as f, Button as g, message as r, Spin as ae, Row as M, Col as R, Statistic as V, Alert as F, Table as $, Tag as T, Empty as Le, Select as L, Space as K, Descriptions as O, Tabs as Ke, Modal as U, InputNumber as De, Switch as Pe, Typography as Ue } from "antd";
6
- import { request as u } from "@yuku123/z-frontend-common";
7
- function Ze() {
8
- const i = H(), [p, t] = d(!1), b = async (o) => {
9
- t(!0);
1
+ import { j as e, S as xe, A as me, a as ue, M as ge } from "./MistApp-BPKuQySt.js";
2
+ import { UserOutlined as oe, LockOutlined as J, RiseOutlined as ye, KeyOutlined as ce, ThunderboltOutlined as je, WarningOutlined as fe, CheckCircleOutlined as we, ArrowLeftOutlined as Ie, HistoryOutlined as be, CopyOutlined as se, EyeInvisibleOutlined as Te, EyeOutlined as Se, RollbackOutlined as Ce, SwapOutlined as ke, UnlockOutlined as ve, ReloadOutlined as te, PlusOutlined as ze, PlayCircleOutlined as Oe, EditOutlined as Ee, DeleteOutlined as Ae, SearchOutlined as Re, HomeOutlined as Le, DashboardOutlined as Ke, SafetyOutlined as De, AppstoreOutlined as Pe, FileTextOutlined as Ue } from "@ant-design/icons";
3
+ import { useState as i, useEffect as V } from "react";
4
+ import { useNavigate as Q, useParams as de } from "react-router-dom";
5
+ import { Card as S, Form as x, Input as b, Button as T, message as a, Row as Y, Col as L, Statistic as H, Alert as W, Table as $, Tag as v, Select as K, Descriptions as z, Space as N, Tabs as $e, Modal as U, InputNumber as _e, Switch as Fe, Typography as Ne } from "antd";
6
+ import { request as j } from "@yuku123/z-frontend-common";
7
+ import { LoadingState as he, ErrorState as B, EmptyState as F, PageHeader as ne, TableToolbar as pe } from "@yuku123/z-frontend-common/ui";
8
+ function rt() {
9
+ const r = Q(), [c, s] = i(!1), k = async (d) => {
10
+ s(!0);
10
11
  try {
11
- const h = await u.post("/auth/login", o);
12
- h.success && h.data && h.data.token ? (localStorage.setItem("token", h.data.token), localStorage.setItem("username", h.data.username || o.username), r.success(`欢迎 ${h.data.username || o.username}`), i("/z-mist/dashboard")) : r.error(h.message || "登录失败");
13
- } catch (h) {
14
- r.error((h == null ? void 0 : h.message) || "登录失败,请检查网络");
12
+ const g = await j.post("/auth/login", d);
13
+ g.success && g.data && g.data.token ? (localStorage.setItem("token", g.data.token), localStorage.setItem("username", g.data.username || d.username), a.success(`欢迎 ${g.data.username || d.username}`), r("/z-mist/dashboard")) : a.error(g.message || "登录失败");
14
+ } catch (g) {
15
+ a.error((g == null ? void 0 : g.message) || "登录失败,请检查网络");
15
16
  } finally {
16
- t(!1);
17
+ s(!1);
17
18
  }
18
19
  };
19
20
  return /* @__PURE__ */ e.jsx("div", { style: {
@@ -23,7 +24,7 @@ function Ze() {
23
24
  alignItems: "center",
24
25
  background: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)"
25
26
  }, children: /* @__PURE__ */ e.jsxs(
26
- I,
27
+ S,
27
28
  {
28
29
  title: /* @__PURE__ */ e.jsx("div", { style: { textAlign: "center", fontSize: 24 }, children: "z-mist 密钥管理平台" }),
29
30
  style: { width: 400 },
@@ -32,7 +33,7 @@ function Ze() {
32
33
  x,
33
34
  {
34
35
  name: "login",
35
- onFinish: b,
36
+ onFinish: k,
36
37
  autoComplete: "off",
37
38
  children: [
38
39
  /* @__PURE__ */ e.jsx(
@@ -41,9 +42,9 @@ function Ze() {
41
42
  name: "username",
42
43
  rules: [{ required: !0, message: "请输入用户名" }],
43
44
  children: /* @__PURE__ */ e.jsx(
44
- f,
45
+ b,
45
46
  {
46
- prefix: /* @__PURE__ */ e.jsx(se, {}),
47
+ prefix: /* @__PURE__ */ e.jsx(oe, {}),
47
48
  placeholder: "用户名: admin",
48
49
  size: "large"
49
50
  }
@@ -56,9 +57,9 @@ function Ze() {
56
57
  name: "password",
57
58
  rules: [{ required: !0, message: "请输入密码" }],
58
59
  children: /* @__PURE__ */ e.jsx(
59
- f.Password,
60
+ b.Password,
60
61
  {
61
- prefix: /* @__PURE__ */ e.jsx(G, {}),
62
+ prefix: /* @__PURE__ */ e.jsx(J, {}),
62
63
  placeholder: "密码: admin",
63
64
  size: "large"
64
65
  }
@@ -66,11 +67,11 @@ function Ze() {
66
67
  }
67
68
  ),
68
69
  /* @__PURE__ */ e.jsx(x.Item, { children: /* @__PURE__ */ e.jsx(
69
- g,
70
+ T,
70
71
  {
71
72
  type: "primary",
72
73
  htmlType: "submit",
73
- loading: p,
74
+ loading: c,
74
75
  size: "large",
75
76
  block: !0,
76
77
  children: "登录"
@@ -84,88 +85,90 @@ function Ze() {
84
85
  }
85
86
  ) });
86
87
  }
87
- function $e() {
88
- const [i, p] = d(null), [t, b] = d([]), [o, h] = d([]), [j, k] = d([]), [m, S] = d(!0);
89
- B(() => {
90
- a();
88
+ function Be() {
89
+ const [r, c] = i(null), [s, k] = i([]), [d, g] = i([]), [f, I] = i([]), [C, O] = i(!0), [h, m] = i(null);
90
+ V(() => {
91
+ u();
91
92
  }, []);
92
- const a = async () => {
93
- S(!0);
93
+ const u = async () => {
94
+ O(!0);
94
95
  try {
95
- const [c, C, v, n] = await Promise.all([
96
- u.get("/stats/overview"),
97
- u.get("/stats/daily?days=7"),
98
- u.get("/stats/top-secrets?limit=10"),
99
- u.get("/stats/expiring")
96
+ const [l, p, y, t] = await Promise.all([
97
+ j.get("/stats/overview"),
98
+ j.get("/stats/daily?days=7"),
99
+ j.get("/stats/top-secrets?limit=10"),
100
+ j.get("/stats/expiring")
100
101
  ]);
101
- c.success && p(c.data), C.success && b(C.data), v.success && h(v.data), n.success && k(n.data);
102
- } catch (c) {
103
- console.error(c);
102
+ l.success && c(l.data), p.success && k(p.data), y.success && g(y.data), t.success && I(t.data), m(null);
103
+ } catch (l) {
104
+ m(l);
104
105
  } finally {
105
- S(!1);
106
+ O(!1);
106
107
  }
107
108
  };
108
- return m ? /* @__PURE__ */ e.jsx(ae, { size: "large", style: { display: "block", margin: 80 } }) : /* @__PURE__ */ e.jsxs("div", { children: [
109
+ return C ? /* @__PURE__ */ e.jsx(he, { variant: "cards", rows: 4 }) : /* @__PURE__ */ e.jsxs("div", { children: [
109
110
  /* @__PURE__ */ e.jsxs("h2", { style: { marginBottom: 24 }, children: [
110
- /* @__PURE__ */ e.jsx(xe, {}),
111
+ /* @__PURE__ */ e.jsx(ye, {}),
111
112
  " z-mist 密钥管理总览"
112
113
  ] }),
113
- /* @__PURE__ */ e.jsxs(M, { gutter: 16, children: [
114
- /* @__PURE__ */ e.jsx(R, { span: 6, children: /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsx(
115
- V,
114
+ h && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(B, { error: h, title: "加载密钥总览失败", onRetry: () => u() }) }),
115
+ /* @__PURE__ */ e.jsxs(Y, { gutter: 16, children: [
116
+ /* @__PURE__ */ e.jsx(L, { span: 6, children: /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(
117
+ H,
116
118
  {
117
119
  title: "密钥总数",
118
- value: (i == null ? void 0 : i.totalSecrets) || 0,
119
- prefix: /* @__PURE__ */ e.jsx(ne, { style: { color: "#1890ff" } })
120
+ value: (r == null ? void 0 : r.totalSecrets) || 0,
121
+ prefix: /* @__PURE__ */ e.jsx(ce, { style: { color: "#1890ff" } })
120
122
  }
121
123
  ) }) }),
122
- /* @__PURE__ */ e.jsx(R, { span: 6, children: /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsx(
123
- V,
124
+ /* @__PURE__ */ e.jsx(L, { span: 6, children: /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(
125
+ H,
124
126
  {
125
127
  title: "今日操作次数",
126
- value: (i == null ? void 0 : i.todayOps) || 0,
127
- prefix: /* @__PURE__ */ e.jsx(ue, { style: { color: "#52c41a" } })
128
+ value: (r == null ? void 0 : r.todayOps) || 0,
129
+ prefix: /* @__PURE__ */ e.jsx(je, { style: { color: "#52c41a" } })
128
130
  }
129
131
  ) }) }),
130
- /* @__PURE__ */ e.jsx(R, { span: 6, children: /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsx(
131
- V,
132
+ /* @__PURE__ */ e.jsx(L, { span: 6, children: /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(
133
+ H,
132
134
  {
133
135
  title: "今日失败次数",
134
- value: (i == null ? void 0 : i.todayFailed) || 0,
135
- valueStyle: { color: ((i == null ? void 0 : i.todayFailed) || 0) > 0 ? "#cf1322" : "#3f8600" },
136
- prefix: /* @__PURE__ */ e.jsx(me, {})
136
+ value: (r == null ? void 0 : r.todayFailed) || 0,
137
+ valueStyle: { color: ((r == null ? void 0 : r.todayFailed) || 0) > 0 ? "#cf1322" : "#3f8600" },
138
+ prefix: /* @__PURE__ */ e.jsx(fe, {})
137
139
  }
138
140
  ) }) }),
139
- /* @__PURE__ */ e.jsx(R, { span: 6, children: /* @__PURE__ */ e.jsx(I, { children: /* @__PURE__ */ e.jsx(
140
- V,
141
+ /* @__PURE__ */ e.jsx(L, { span: 6, children: /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsx(
142
+ H,
141
143
  {
142
144
  title: "成功率",
143
- value: (i == null ? void 0 : i.successRate) || 100,
145
+ value: (r == null ? void 0 : r.successRate) || 100,
144
146
  precision: 2,
145
147
  suffix: "%",
146
148
  valueStyle: { color: "#3f8600" },
147
- prefix: /* @__PURE__ */ e.jsx(ge, {})
149
+ prefix: /* @__PURE__ */ e.jsx(we, {})
148
150
  }
149
151
  ) }) })
150
152
  ] }),
151
- j && j.length > 0 && /* @__PURE__ */ e.jsx(
152
- F,
153
+ f && f.length > 0 && /* @__PURE__ */ e.jsx(
154
+ W,
153
155
  {
154
156
  style: { marginTop: 16 },
155
- message: `警告: ${j.length} 个密钥将在 7 天内过期`,
157
+ message: `警告: ${f.length} 个密钥将在 7 天内过期`,
156
158
  description: "请及时轮换或延期,避免密钥失效影响业务",
157
159
  type: "warning",
158
160
  showIcon: !0
159
161
  }
160
162
  ),
161
- /* @__PURE__ */ e.jsxs(M, { gutter: 16, style: { marginTop: 16 }, children: [
162
- /* @__PURE__ */ e.jsx(R, { span: 12, children: /* @__PURE__ */ e.jsx(I, { title: "近 7 天访问趋势", children: /* @__PURE__ */ e.jsx(
163
+ /* @__PURE__ */ e.jsxs(Y, { gutter: 16, style: { marginTop: 16 }, children: [
164
+ /* @__PURE__ */ e.jsx(L, { span: 12, children: /* @__PURE__ */ e.jsx(S, { title: "近 7 天访问趋势", children: /* @__PURE__ */ e.jsx(
163
165
  $,
164
166
  {
165
167
  size: "small",
166
168
  pagination: !1,
167
169
  rowKey: "date",
168
- dataSource: t,
170
+ dataSource: s,
171
+ locale: { emptyText: /* @__PURE__ */ e.jsx(F, { title: "暂无访问趋势", description: "近 7 天还没有密钥访问记录", size: "sm" }) },
169
172
  columns: [
170
173
  { title: "日期", dataIndex: "date", width: 110 },
171
174
  { title: "GET 次数", dataIndex: "getCount", width: 100 },
@@ -174,17 +177,17 @@ function $e() {
174
177
  title: "失败",
175
178
  dataIndex: "failedCount",
176
179
  width: 80,
177
- render: (c) => c > 0 ? /* @__PURE__ */ e.jsx(T, { color: "red", children: c }) : /* @__PURE__ */ e.jsx(T, { color: "green", children: "0" })
180
+ render: (l) => l > 0 ? /* @__PURE__ */ e.jsx(v, { color: "red", children: l }) : /* @__PURE__ */ e.jsx(v, { color: "green", children: "0" })
178
181
  },
179
182
  {
180
183
  title: "趋势",
181
- render: (c, C) => {
182
- const v = (C.getCount || 0) + (C.encryptCount || 0), n = Math.min(100, v * 2);
184
+ render: (l, p) => {
185
+ const y = (p.getCount || 0) + (p.encryptCount || 0), t = Math.min(100, y * 2);
183
186
  return /* @__PURE__ */ e.jsx("div", { style: { background: "#f0f0f0", height: 8, borderRadius: 4 }, children: /* @__PURE__ */ e.jsx("div", { style: {
184
187
  background: "#1890ff",
185
188
  height: 8,
186
189
  borderRadius: 4,
187
- width: `${n}%`,
190
+ width: `${t}%`,
188
191
  transition: "width 0.3s"
189
192
  } }) });
190
193
  }
@@ -192,15 +195,15 @@ function $e() {
192
195
  ]
193
196
  }
194
197
  ) }) }),
195
- /* @__PURE__ */ e.jsx(R, { span: 12, children: /* @__PURE__ */ e.jsx(I, { title: "TOP 10 访问密钥(7 天)", children: o.length === 0 ? /* @__PURE__ */ e.jsx(Le, { description: "暂无访问数据" }) : /* @__PURE__ */ e.jsx(
198
+ /* @__PURE__ */ e.jsx(L, { span: 12, children: /* @__PURE__ */ e.jsx(S, { title: "TOP 10 访问密钥(7 天)", children: d.length === 0 ? /* @__PURE__ */ e.jsx(F, { title: "暂无访问数据", description: "近 7 天还没有密钥被访问过", size: "sm" }) : /* @__PURE__ */ e.jsx(
196
199
  $,
197
200
  {
198
201
  size: "small",
199
202
  pagination: !1,
200
203
  rowKey: "secretKey",
201
- dataSource: o,
204
+ dataSource: d,
202
205
  columns: [
203
- { title: "#", render: (c, C, v) => v + 1, width: 40 },
206
+ { title: "#", render: (l, p, y) => y + 1, width: 40 },
204
207
  {
205
208
  title: "密钥标识",
206
209
  dataIndex: "secretKey",
@@ -210,19 +213,20 @@ function $e() {
210
213
  title: "访问次数",
211
214
  dataIndex: "accessCount",
212
215
  width: 100,
213
- render: (c) => /* @__PURE__ */ e.jsx(T, { color: "blue", children: c })
216
+ render: (l) => /* @__PURE__ */ e.jsx(v, { color: "blue", children: l })
214
217
  }
215
218
  ]
216
219
  }
217
220
  ) }) })
218
221
  ] }),
219
- j && j.length > 0 && /* @__PURE__ */ e.jsx(I, { title: "即将过期密钥(7 天内)", style: { marginTop: 16 }, children: /* @__PURE__ */ e.jsx(
222
+ f && f.length > 0 && /* @__PURE__ */ e.jsx(S, { title: "即将过期密钥(7 天内)", style: { marginTop: 16 }, children: /* @__PURE__ */ e.jsx(
220
223
  $,
221
224
  {
222
225
  size: "small",
223
226
  pagination: { pageSize: 5 },
224
227
  rowKey: "id",
225
- dataSource: j,
228
+ dataSource: f,
229
+ locale: { emptyText: /* @__PURE__ */ e.jsx(F, { title: "暂无即将过期的密钥", description: "所有密钥的过期时间都在 7 天以外", size: "sm" }) },
226
230
  columns: [
227
231
  { title: "密钥标识", dataIndex: "secretKey" },
228
232
  { title: "名称", dataIndex: "secretName" },
@@ -232,322 +236,357 @@ function $e() {
232
236
  title: "过期时间",
233
237
  dataIndex: "expireTime",
234
238
  width: 180,
235
- render: (c) => c ? /* @__PURE__ */ e.jsx(T, { color: "orange", children: new Date(c).toLocaleString() }) : "-"
239
+ render: (l) => l ? /* @__PURE__ */ e.jsx(v, { color: "orange", children: new Date(l).toLocaleString() }) : "-"
236
240
  }
237
241
  ]
238
242
  }
239
243
  ) })
240
244
  ] });
241
245
  }
242
- const { Option: P } = L, { TextArea: X } = f;
243
- function Z() {
244
- const i = H(), { id: p } = re(), [t] = x.useForm(), [b, o] = d(!1), h = !!p;
245
- B(() => {
246
- h && j();
247
- }, [p]);
248
- const j = async () => {
246
+ const { Option: D } = K, { TextArea: re } = b;
247
+ function P(r, ...c) {
248
+ if (r) {
249
+ for (const s of c)
250
+ if (r[s] !== void 0 && r[s] !== null) return r[s];
251
+ }
252
+ }
253
+ function ie() {
254
+ const r = Q(), { id: c } = de(), [s] = x.useForm(), [k, d] = i(!1), [g, f] = i(null), I = !!c;
255
+ V(() => {
256
+ I && C();
257
+ }, [c]);
258
+ const C = async () => {
249
259
  try {
250
- const m = await u.get("/secret/list");
251
- if (m.success) {
252
- const S = m.data.find((a) => String(a.id) === String(p));
253
- S && t.setFieldsValue({
254
- ...S,
260
+ const h = await j.get("/secret/list");
261
+ if (h.success) {
262
+ const m = h.data.find((u) => String(u.id) === String(c));
263
+ m && s.setFieldsValue({
264
+ secretName: P(m, "secret_name", "secretName") || "",
265
+ secretKey: P(m, "secret_key", "secretKey") || "",
266
+ group: P(m, "group") || "",
267
+ appName: P(m, "app_name", "appName") || "",
268
+ secretType: P(m, "secret_type", "secretType") || "text",
269
+ encryptAlgorithm: P(m, "encrypt_algorithm", "encryptAlgorithm") || "AES",
270
+ description: P(m, "description") || "",
271
+ // 密文不回填到表单: 免得把密文摊在 DOM 里, 也避免把旧密文原样写回去
255
272
  encryptedValue: ""
256
273
  });
257
274
  }
258
- } catch {
259
- r.error("获取密钥详情失败");
275
+ f(null);
276
+ } catch (h) {
277
+ f(h);
260
278
  }
261
- }, k = async (m) => {
262
- o(!0);
279
+ }, O = async (h) => {
280
+ var m, u;
281
+ d(!0);
263
282
  try {
264
- const S = {
265
- ...m,
266
- secretKey: m.secretKey || `secret_${Date.now()}`
283
+ const l = Number(c), p = {
284
+ id: I && Number.isFinite(l) ? l : void 0,
285
+ secret_key: h.secretKey || `secret_${Date.now()}`,
286
+ secret_name: h.secretName,
287
+ group: h.group,
288
+ app_name: h.appName,
289
+ secret_type: h.secretType,
290
+ encrypted_value: h.encryptedValue,
291
+ encrypt_algorithm: h.encryptAlgorithm,
292
+ description: h.description
267
293
  };
268
- let a;
269
- h ? a = await u.put("/secret", S) : a = await u.post("/secret", S), a.success ? (r.success(h ? "更新成功" : "创建成功"), i("/z-mist/secret")) : r.error(a.message || "操作失败");
270
- } catch {
271
- r.error("操作失败");
294
+ Object.keys(p).forEach((t) => {
295
+ (p[t] === void 0 || p[t] === null) && delete p[t];
296
+ });
297
+ let y;
298
+ I ? y = await j.put("/secret", p) : y = await j.post("/secret", p), y.success ? (a.success(I ? "更新成功" : "创建成功"), r("/z-mist/secret")) : a.error(y.message || "操作失败");
299
+ } catch (l) {
300
+ a.error(((u = (m = l == null ? void 0 : l.response) == null ? void 0 : m.data) == null ? void 0 : u.message) || "操作失败");
272
301
  } finally {
273
- o(!1);
302
+ d(!1);
274
303
  }
275
304
  };
276
305
  return /* @__PURE__ */ e.jsxs("div", { children: [
277
306
  /* @__PURE__ */ e.jsx(
278
- g,
307
+ T,
279
308
  {
280
- icon: /* @__PURE__ */ e.jsx(Y, {}),
281
- onClick: () => i("/z-mist/secret"),
309
+ icon: /* @__PURE__ */ e.jsx(Ie, {}),
310
+ onClick: () => r("/z-mist/secret"),
282
311
  style: { marginBottom: 16 },
283
312
  children: "返回列表"
284
313
  }
285
314
  ),
286
- /* @__PURE__ */ e.jsx(I, { title: h ? "编辑密钥" : "新增密钥", children: /* @__PURE__ */ e.jsxs(
287
- x,
288
- {
289
- form: t,
290
- layout: "vertical",
291
- onFinish: k,
292
- children: [
293
- /* @__PURE__ */ e.jsx(
294
- x.Item,
295
- {
296
- name: "secretName",
297
- label: "密钥名称",
298
- rules: [{ required: !0, message: "请输入密钥名称" }],
299
- children: /* @__PURE__ */ e.jsx(f, { placeholder: "请输入密钥名称" })
300
- }
301
- ),
302
- /* @__PURE__ */ e.jsx(
303
- x.Item,
304
- {
305
- name: "secretKey",
306
- label: "密钥标识",
307
- rules: [{ required: !0, message: "请输入密钥标识" }],
308
- children: /* @__PURE__ */ e.jsx(f, { placeholder: "请输入密钥标识,如: database/password", disabled: h })
309
- }
310
- ),
311
- /* @__PURE__ */ e.jsx(
312
- x.Item,
313
- {
314
- name: "group",
315
- label: "分组",
316
- initialValue: "DEFAULT_GROUP",
317
- children: /* @__PURE__ */ e.jsx(f, { placeholder: "请输入分组" })
318
- }
319
- ),
320
- /* @__PURE__ */ e.jsx(
321
- x.Item,
322
- {
323
- name: "appName",
324
- label: "应用名",
325
- children: /* @__PURE__ */ e.jsx(f, { placeholder: "请输入应用名" })
326
- }
327
- ),
328
- /* @__PURE__ */ e.jsx(
329
- x.Item,
330
- {
331
- name: "secretType",
332
- label: "密钥类型",
333
- initialValue: "text",
334
- children: /* @__PURE__ */ e.jsxs(L, { placeholder: "请选择密钥类型", children: [
335
- /* @__PURE__ */ e.jsx(P, { value: "text", children: "文本" }),
336
- /* @__PURE__ */ e.jsx(P, { value: "password", children: "密码" }),
337
- /* @__PURE__ */ e.jsx(P, { value: "cert", children: "证书" }),
338
- /* @__PURE__ */ e.jsx(P, { value: "key", children: "密钥" }),
339
- /* @__PURE__ */ e.jsx(P, { value: "api_key", children: "API Key" })
340
- ] })
341
- }
342
- ),
343
- /* @__PURE__ */ e.jsx(
344
- x.Item,
345
- {
346
- name: "encryptedValue",
347
- label: "密钥值",
348
- rules: [{ required: !0, message: "请输入密钥值" }],
349
- children: /* @__PURE__ */ e.jsx(X, { rows: 4, placeholder: "请输入密钥值" })
350
- }
351
- ),
352
- /* @__PURE__ */ e.jsx(
353
- x.Item,
354
- {
355
- name: "encryptAlgorithm",
356
- label: "加密算法",
357
- initialValue: "AES",
358
- children: /* @__PURE__ */ e.jsxs(L, { placeholder: "请选择加密算法", children: [
359
- /* @__PURE__ */ e.jsx(P, { value: "AES", children: "AES" }),
360
- /* @__PURE__ */ e.jsx(P, { value: "RSA", children: "RSA" })
361
- ] })
362
- }
363
- ),
364
- /* @__PURE__ */ e.jsx(
365
- x.Item,
366
- {
367
- name: "description",
368
- label: "描述",
369
- children: /* @__PURE__ */ e.jsx(X, { rows: 2, placeholder: "请输入描述" })
370
- }
371
- ),
372
- /* @__PURE__ */ e.jsxs(x.Item, { children: [
373
- /* @__PURE__ */ e.jsx(g, { type: "primary", htmlType: "submit", loading: b, children: h ? "更新" : "创建" }),
374
- /* @__PURE__ */ e.jsx(g, { onClick: () => i("/z-mist/secret"), style: { marginLeft: 8 }, children: "取消" })
375
- ] })
376
- ]
377
- }
378
- ) })
315
+ /* @__PURE__ */ e.jsxs(S, { title: I ? "编辑密钥" : "新增密钥", children: [
316
+ g && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(B, { error: g, title: "获取密钥详情失败", onRetry: () => C() }) }),
317
+ /* @__PURE__ */ e.jsxs(
318
+ x,
319
+ {
320
+ form: s,
321
+ layout: "vertical",
322
+ onFinish: O,
323
+ children: [
324
+ /* @__PURE__ */ e.jsx(
325
+ x.Item,
326
+ {
327
+ name: "secretName",
328
+ label: "密钥名称",
329
+ rules: [{ required: !0, message: "请输入密钥名称" }],
330
+ children: /* @__PURE__ */ e.jsx(b, { placeholder: "请输入密钥名称" })
331
+ }
332
+ ),
333
+ /* @__PURE__ */ e.jsx(
334
+ x.Item,
335
+ {
336
+ name: "secretKey",
337
+ label: "密钥标识",
338
+ rules: [{ required: !0, message: "请输入密钥标识" }],
339
+ children: /* @__PURE__ */ e.jsx(b, { placeholder: "请输入密钥标识,如: database/password", disabled: I })
340
+ }
341
+ ),
342
+ /* @__PURE__ */ e.jsx(
343
+ x.Item,
344
+ {
345
+ name: "group",
346
+ label: "分组",
347
+ initialValue: "DEFAULT_GROUP",
348
+ children: /* @__PURE__ */ e.jsx(b, { placeholder: "请输入分组" })
349
+ }
350
+ ),
351
+ /* @__PURE__ */ e.jsx(
352
+ x.Item,
353
+ {
354
+ name: "appName",
355
+ label: "应用名",
356
+ children: /* @__PURE__ */ e.jsx(b, { placeholder: "请输入应用名" })
357
+ }
358
+ ),
359
+ /* @__PURE__ */ e.jsx(
360
+ x.Item,
361
+ {
362
+ name: "secretType",
363
+ label: "密钥类型",
364
+ initialValue: "text",
365
+ children: /* @__PURE__ */ e.jsxs(K, { placeholder: "请选择密钥类型", children: [
366
+ /* @__PURE__ */ e.jsx(D, { value: "text", children: "文本" }),
367
+ /* @__PURE__ */ e.jsx(D, { value: "password", children: "密码" }),
368
+ /* @__PURE__ */ e.jsx(D, { value: "cert", children: "证书" }),
369
+ /* @__PURE__ */ e.jsx(D, { value: "key", children: "密钥" }),
370
+ /* @__PURE__ */ e.jsx(D, { value: "api_key", children: "API Key" })
371
+ ] })
372
+ }
373
+ ),
374
+ /* @__PURE__ */ e.jsx(
375
+ x.Item,
376
+ {
377
+ name: "encryptedValue",
378
+ label: "密钥值",
379
+ rules: [{ required: !0, message: "请输入密钥值" }],
380
+ children: /* @__PURE__ */ e.jsx(re, { rows: 4, placeholder: "请输入密钥值" })
381
+ }
382
+ ),
383
+ /* @__PURE__ */ e.jsx(
384
+ x.Item,
385
+ {
386
+ name: "encryptAlgorithm",
387
+ label: "加密算法",
388
+ initialValue: "AES",
389
+ children: /* @__PURE__ */ e.jsxs(K, { placeholder: "请选择加密算法", children: [
390
+ /* @__PURE__ */ e.jsx(D, { value: "AES", children: "AES" }),
391
+ /* @__PURE__ */ e.jsx(D, { value: "RSA", children: "RSA" })
392
+ ] })
393
+ }
394
+ ),
395
+ /* @__PURE__ */ e.jsx(
396
+ x.Item,
397
+ {
398
+ name: "description",
399
+ label: "描述",
400
+ children: /* @__PURE__ */ e.jsx(re, { rows: 2, placeholder: "请输入描述" })
401
+ }
402
+ ),
403
+ /* @__PURE__ */ e.jsxs(x.Item, { children: [
404
+ /* @__PURE__ */ e.jsx(T, { type: "primary", htmlType: "submit", loading: k, children: I ? "更新" : "创建" }),
405
+ /* @__PURE__ */ e.jsx(T, { onClick: () => r("/z-mist/secret"), style: { marginLeft: 8 }, children: "取消" })
406
+ ] })
407
+ ]
408
+ }
409
+ )
410
+ ] })
379
411
  ] });
380
412
  }
381
- const { TextArea: et } = f;
382
- function _e() {
383
- const i = H(), { id: p } = re(), [t, b] = d(null), [o, h] = d([]), [j, k] = d([]), [m, S] = d(""), [a, c] = d(!1), [C, v] = d(!0), [n, A] = d(!1);
384
- B(() => {
385
- p && (w(), D(), s());
386
- }, [p]);
387
- const w = async () => {
388
- v(!0);
413
+ const { TextArea: it } = b;
414
+ function Ve() {
415
+ const r = Q(), { id: c } = de(), [s, k] = i(null), [d, g] = i([]), [f, I] = i([]), [C, O] = i(""), [h, m] = i(!1), [u, l] = i(!0), [p, y] = i(!1);
416
+ V(() => {
417
+ c && (t(), E(), M());
418
+ }, [c]);
419
+ const t = async () => {
420
+ l(!0);
389
421
  try {
390
- const l = await u.get("/secret/list");
391
- if (l.success) {
392
- const y = (l.data || []).find((E) => String(E.id) === String(p));
393
- b(y || null), y && s(y);
422
+ const o = await j.get("/secret/list");
423
+ if (o.success) {
424
+ const w = (o.data || []).find((R) => String(R.id) === String(c));
425
+ k(w || null), w && M(w);
394
426
  }
395
427
  } catch {
396
- r.error("获取密钥详情失败");
428
+ a.error("获取密钥详情失败");
397
429
  } finally {
398
- v(!1);
430
+ l(!1);
399
431
  }
400
- }, D = async () => {
401
- const l = await u.get("/secret/list");
402
- if (l.success) {
403
- const y = (l.data || []).find((E) => String(E.id) === String(p));
404
- if (y) {
405
- const E = await u.get(
406
- `/secret/history/list?secretKey=${encodeURIComponent(y.secretKey)}&group=${encodeURIComponent(y.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(y.namespace || "")}`
432
+ }, E = async () => {
433
+ const o = await j.get("/secret/list");
434
+ if (o.success) {
435
+ const w = (o.data || []).find((R) => String(R.id) === String(c));
436
+ if (w) {
437
+ const R = await j.get(
438
+ `/secret/history/list?secretKey=${encodeURIComponent(w.secretKey)}&group=${encodeURIComponent(w.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(w.namespace || "")}`
407
439
  );
408
- E.success && h(E.data || []);
440
+ R.success && g(R.data || []);
409
441
  }
410
442
  }
411
- }, s = async (l) => {
412
- const y = l || t;
413
- if (!y) return;
414
- const E = await u.get(
415
- `/tag/by-secret?secretKey=${encodeURIComponent(y.secretKey)}&group=${encodeURIComponent(y.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(y.namespace || "")}`
443
+ }, M = async (o) => {
444
+ const w = o || s;
445
+ if (!w) return;
446
+ const R = await j.get(
447
+ `/tag/by-secret?secretKey=${encodeURIComponent(w.secretKey)}&group=${encodeURIComponent(w.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(w.namespace || "")}`
416
448
  );
417
- E.success && k(E.data || []);
418
- }, z = async () => {
419
- if (t) {
420
- A(!0);
449
+ R.success && I(R.data || []);
450
+ }, X = async () => {
451
+ if (s) {
452
+ y(!0);
421
453
  try {
422
- const l = await u.get(
423
- `/secret/plain?secretKey=${encodeURIComponent(t.secretKey)}&group=${encodeURIComponent(t.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(t.namespace || "")}`
454
+ const o = await j.get(
455
+ `/secret/plain?secretKey=${encodeURIComponent(s.secretKey)}&group=${encodeURIComponent(s.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(s.namespace || "")}`
424
456
  );
425
- l.success ? (S(l.data), c(!0)) : r.error(l.message || "解密失败");
457
+ o.success ? (O(o.data), m(!0)) : a.error(o.message || "解密失败");
426
458
  } catch {
427
- r.error("解密请求失败");
459
+ a.error("解密请求失败");
428
460
  } finally {
429
- A(!1);
461
+ y(!1);
430
462
  }
431
463
  }
432
- }, J = (l) => {
433
- navigator.clipboard ? navigator.clipboard.writeText(l).then(() => {
434
- r.success("已复制");
435
- }).catch(() => r.error("复制失败")) : r.warning("当前浏览器不支持剪贴板 API");
436
- }, ie = async () => {
437
- t && U.confirm({
464
+ }, G = (o) => {
465
+ navigator.clipboard ? navigator.clipboard.writeText(o).then(() => {
466
+ a.success("已复制");
467
+ }).catch(() => a.error("复制失败")) : a.warning("当前浏览器不支持剪贴板 API");
468
+ }, Z = async () => {
469
+ s && U.confirm({
438
470
  title: "确认轮换密钥?",
439
- content: `将重新生成 ${t.secretKey} 的值并自增版本号`,
471
+ content: `将重新生成 ${s.secretKey} 的值并自增版本号`,
440
472
  onOk: async () => {
441
- const l = await u.post(
442
- `/secret/rotate?secretKey=${encodeURIComponent(t.secretKey)}&group=${encodeURIComponent(t.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(t.namespace || "")}&newValueLength=32`
473
+ const o = await j.post(
474
+ `/secret/rotate?secretKey=${encodeURIComponent(s.secretKey)}&group=${encodeURIComponent(s.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(s.namespace || "")}&newValueLength=32`
443
475
  );
444
- l.success ? (r.success("轮换成功"), w(), D()) : r.error(l.message || "轮换失败");
476
+ o.success ? (a.success("轮换成功"), t(), E()) : a.error(o.message || "轮换失败");
445
477
  }
446
478
  });
447
- }, le = (l) => {
479
+ }, n = (o) => {
448
480
  U.confirm({
449
481
  title: "确认回滚到该历史版本?",
450
482
  content: "回滚会生成一个新版本,旧值会被快照保留",
451
483
  onOk: async () => {
452
- const y = await u.post(`/secret/rollback?historyId=${l}`);
453
- y.success ? (r.success("回滚成功"), w(), D()) : r.error(y.message || "回滚失败");
484
+ const w = await j.post(`/secret/rollback?historyId=${o}`);
485
+ w.success ? (a.success("回滚成功"), t(), E()) : a.error(w.message || "回滚失败");
454
486
  }
455
487
  });
456
- }, oe = () => {
457
- let l = 3600;
488
+ }, A = () => {
489
+ let o = 3600;
458
490
  U.confirm({
459
491
  title: "生成动态密钥(带 TTL)",
460
492
  content: /* @__PURE__ */ e.jsxs("div", { children: [
461
493
  /* @__PURE__ */ e.jsxs("p", { children: [
462
494
  "关联密钥: ",
463
- t == null ? void 0 : t.secretKey
495
+ s == null ? void 0 : s.secretKey
464
496
  ] }),
465
- /* @__PURE__ */ e.jsx(f, { defaultValue: "3600", addonAfter: "秒", id: "dyn-ttl" })
497
+ /* @__PURE__ */ e.jsx(b, { defaultValue: "3600", addonAfter: "秒", id: "dyn-ttl" })
466
498
  ] }),
467
499
  onOk: async () => {
468
- const y = document.getElementById("dyn-ttl");
469
- l = parseInt((y == null ? void 0 : y.value) || "3600");
470
- const E = await u.post(
471
- `/secret/dynamic/generate?secretKey=${encodeURIComponent(t.secretKey)}&group=${encodeURIComponent(t.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(t.namespace || "")}&ttlSeconds=${l}`
500
+ const w = document.getElementById("dyn-ttl");
501
+ o = parseInt((w == null ? void 0 : w.value) || "3600");
502
+ const R = await j.post(
503
+ `/secret/dynamic/generate?secretKey=${encodeURIComponent(s.secretKey)}&group=${encodeURIComponent(s.group || "DEFAULT_GROUP")}&namespace=${encodeURIComponent(s.namespace || "")}&ttlSeconds=${o}`
472
504
  );
473
- E.success ? U.info({
505
+ R.success ? U.info({
474
506
  title: "动态密钥生成成功",
475
507
  content: /* @__PURE__ */ e.jsxs("div", { children: [
476
508
  /* @__PURE__ */ e.jsx("p", { children: "dynKey (UUID): " }),
477
- /* @__PURE__ */ e.jsx(f.TextArea, { rows: 3, value: E.data, readOnly: !0 }),
509
+ /* @__PURE__ */ e.jsx(b.TextArea, { rows: 3, value: R.data, readOnly: !0 }),
478
510
  /* @__PURE__ */ e.jsxs("p", { style: { marginTop: 8, color: "#999", fontSize: 12 }, children: [
479
511
  "TTL: ",
480
- l,
512
+ o,
481
513
  " 秒,过期自动失效"
482
514
  ] })
483
515
  ] })
484
- }) : r.error(E.message || "生成失败");
516
+ }) : a.error(R.message || "生成失败");
485
517
  }
486
518
  });
487
519
  };
488
- return C ? /* @__PURE__ */ e.jsx(ae, { size: "large", style: { display: "block", margin: 80 } }) : t ? /* @__PURE__ */ e.jsxs("div", { children: [
489
- /* @__PURE__ */ e.jsxs(K, { style: { marginBottom: 16 }, children: [
490
- /* @__PURE__ */ e.jsx(g, { icon: /* @__PURE__ */ e.jsx(Y, {}), onClick: () => i("/z-mist/secret"), children: "返回列表" }),
491
- /* @__PURE__ */ e.jsx(g, { icon: /* @__PURE__ */ e.jsx(ye, {}), onClick: ie, type: "primary", children: "立即轮换" }),
492
- /* @__PURE__ */ e.jsx(g, { onClick: oe, children: "生成动态密钥" })
493
- ] }),
494
- /* @__PURE__ */ e.jsx(I, { title: `密钥详情: ${t.secretName || t.secretKey}`, children: /* @__PURE__ */ e.jsxs(O, { column: 2, bordered: !0, size: "small", children: [
495
- /* @__PURE__ */ e.jsx(O.Item, { label: "密钥标识", children: t.secretKey }),
496
- /* @__PURE__ */ e.jsx(O.Item, { label: "密钥名称", children: t.secretName }),
497
- /* @__PURE__ */ e.jsx(O.Item, { label: "分组", children: t.group }),
498
- /* @__PURE__ */ e.jsx(O.Item, { label: "命名空间", children: t.namespace }),
499
- /* @__PURE__ */ e.jsx(O.Item, { label: "应用", children: t.appName || "-" }),
500
- /* @__PURE__ */ e.jsx(O.Item, { label: "类型", children: /* @__PURE__ */ e.jsx(T, { color: "blue", children: t.secretType }) }),
501
- /* @__PURE__ */ e.jsx(O.Item, { label: "加密算法", children: /* @__PURE__ */ e.jsx(T, { color: "purple", children: t.encryptAlgorithm }) }),
502
- /* @__PURE__ */ e.jsx(O.Item, { label: "版本", children: t.keyVersion }),
503
- /* @__PURE__ */ e.jsx(O.Item, { label: "MD5 指纹", children: /* @__PURE__ */ e.jsx("code", { children: t.valueMd5 }) }),
504
- /* @__PURE__ */ e.jsx(O.Item, { label: "过期时间", children: t.expireTime ? /* @__PURE__ */ e.jsx(T, { color: "orange", children: new Date(t.expireTime).toLocaleString() }) : "-" }),
505
- /* @__PURE__ */ e.jsx(O.Item, { label: "创建时间", span: 2, children: t.gmtCreate ? new Date(t.gmtCreate).toLocaleString() : "-" }),
506
- /* @__PURE__ */ e.jsx(O.Item, { label: "密文(Base64)", span: 2, children: /* @__PURE__ */ e.jsx(
507
- f.TextArea,
520
+ return u ? /* @__PURE__ */ e.jsx(he, { variant: "detail" }) : s ? /* @__PURE__ */ e.jsxs("div", { children: [
521
+ /* @__PURE__ */ e.jsx(
522
+ ne,
523
+ {
524
+ title: `密钥详情: ${s.secretName || s.secretKey}`,
525
+ back: !0,
526
+ onBack: () => r("/z-mist/secret"),
527
+ extra: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
528
+ /* @__PURE__ */ e.jsx(T, { icon: /* @__PURE__ */ e.jsx(be, {}), onClick: Z, type: "primary", children: "立即轮换" }),
529
+ /* @__PURE__ */ e.jsx(T, { onClick: A, children: "生成动态密钥" })
530
+ ] })
531
+ }
532
+ ),
533
+ /* @__PURE__ */ e.jsx(S, { children: /* @__PURE__ */ e.jsxs(z, { column: 2, bordered: !0, size: "small", children: [
534
+ /* @__PURE__ */ e.jsx(z.Item, { label: "密钥标识", children: s.secretKey }),
535
+ /* @__PURE__ */ e.jsx(z.Item, { label: "密钥名称", children: s.secretName }),
536
+ /* @__PURE__ */ e.jsx(z.Item, { label: "分组", children: s.group }),
537
+ /* @__PURE__ */ e.jsx(z.Item, { label: "命名空间", children: s.namespace }),
538
+ /* @__PURE__ */ e.jsx(z.Item, { label: "应用", children: s.appName || "-" }),
539
+ /* @__PURE__ */ e.jsx(z.Item, { label: "类型", children: /* @__PURE__ */ e.jsx(v, { color: "blue", children: s.secretType }) }),
540
+ /* @__PURE__ */ e.jsx(z.Item, { label: "加密算法", children: /* @__PURE__ */ e.jsx(v, { color: "purple", children: s.encryptAlgorithm }) }),
541
+ /* @__PURE__ */ e.jsx(z.Item, { label: "版本", children: s.keyVersion }),
542
+ /* @__PURE__ */ e.jsx(z.Item, { label: "MD5 指纹", children: /* @__PURE__ */ e.jsx("code", { children: s.valueMd5 }) }),
543
+ /* @__PURE__ */ e.jsx(z.Item, { label: "过期时间", children: s.expireTime ? /* @__PURE__ */ e.jsx(v, { color: "orange", children: new Date(s.expireTime).toLocaleString() }) : "-" }),
544
+ /* @__PURE__ */ e.jsx(z.Item, { label: "创建时间", span: 2, children: s.gmtCreate ? new Date(s.gmtCreate).toLocaleString() : "-" }),
545
+ /* @__PURE__ */ e.jsx(z.Item, { label: "密文(Base64)", span: 2, children: /* @__PURE__ */ e.jsx(
546
+ b.TextArea,
508
547
  {
509
548
  rows: 3,
510
- value: t.encryptedValue,
549
+ value: s.encryptedValue,
511
550
  readOnly: !0,
512
- addonAfter: /* @__PURE__ */ e.jsx(Q, { onClick: () => J(t.encryptedValue) })
551
+ addonAfter: /* @__PURE__ */ e.jsx(se, { onClick: () => G(s.encryptedValue) })
513
552
  }
514
553
  ) }),
515
- /* @__PURE__ */ e.jsx(O.Item, { label: "明文", span: 2, children: /* @__PURE__ */ e.jsxs(K.Compact, { style: { width: "100%" }, children: [
554
+ /* @__PURE__ */ e.jsx(z.Item, { label: "明文", span: 2, children: /* @__PURE__ */ e.jsxs(N.Compact, { style: { width: "100%" }, children: [
516
555
  /* @__PURE__ */ e.jsx(
517
- f,
556
+ b,
518
557
  {
519
- type: a ? "text" : "password",
520
- value: m,
558
+ type: h ? "text" : "password",
559
+ value: C,
521
560
  readOnly: !0,
522
561
  placeholder: "点击右侧按钮获取明文(将记录访问日志)"
523
562
  }
524
563
  ),
525
564
  /* @__PURE__ */ e.jsx(
526
- g,
565
+ T,
527
566
  {
528
- icon: a ? /* @__PURE__ */ e.jsx(je, {}) : /* @__PURE__ */ e.jsx(fe, {}),
529
- onClick: () => a ? c(!1) : z(),
530
- loading: n,
531
- children: a ? "隐藏" : "查看"
567
+ icon: h ? /* @__PURE__ */ e.jsx(Te, {}) : /* @__PURE__ */ e.jsx(Se, {}),
568
+ onClick: () => h ? m(!1) : X(),
569
+ loading: p,
570
+ children: h ? "隐藏" : "查看"
532
571
  }
533
572
  ),
534
- a && /* @__PURE__ */ e.jsx(g, { icon: /* @__PURE__ */ e.jsx(Q, {}), onClick: () => J(m), children: "复制" })
573
+ h && /* @__PURE__ */ e.jsx(T, { icon: /* @__PURE__ */ e.jsx(se, {}), onClick: () => G(C), children: "复制" })
535
574
  ] }) }),
536
- /* @__PURE__ */ e.jsx(O.Item, { label: "描述", span: 2, children: t.description || "-" })
575
+ /* @__PURE__ */ e.jsx(z.Item, { label: "描述", span: 2, children: s.description || "-" })
537
576
  ] }) }),
538
- /* @__PURE__ */ e.jsx(I, { style: { marginTop: 16 }, children: /* @__PURE__ */ e.jsx(
539
- Ke,
577
+ /* @__PURE__ */ e.jsx(S, { style: { marginTop: 16 }, children: /* @__PURE__ */ e.jsx(
578
+ $e,
540
579
  {
541
580
  items: [
542
581
  {
543
582
  key: "history",
544
- label: `历史版本 (${o.length})`,
583
+ label: `历史版本 (${d.length})`,
545
584
  children: /* @__PURE__ */ e.jsx(
546
585
  $,
547
586
  {
548
587
  size: "small",
549
588
  rowKey: "id",
550
- dataSource: o,
589
+ dataSource: d,
551
590
  pagination: { pageSize: 10 },
552
591
  columns: [
553
592
  { title: "ID", dataIndex: "id", width: 60 },
@@ -556,26 +595,26 @@ function _e() {
556
595
  title: "操作类型",
557
596
  dataIndex: "opType",
558
597
  width: 100,
559
- render: (l) => /* @__PURE__ */ e.jsx(T, { children: l })
598
+ render: (o) => /* @__PURE__ */ e.jsx(v, { children: o })
560
599
  },
561
600
  { title: "MD5 指纹", dataIndex: "valueMd5", ellipsis: !0 },
562
601
  {
563
602
  title: "创建时间",
564
603
  dataIndex: "gmtCreate",
565
604
  width: 180,
566
- render: (l) => l ? new Date(l).toLocaleString() : "-"
605
+ render: (o) => o ? new Date(o).toLocaleString() : "-"
567
606
  },
568
607
  {
569
608
  title: "操作",
570
609
  width: 120,
571
610
  fixed: "right",
572
- render: (l, y) => /* @__PURE__ */ e.jsx(
573
- g,
611
+ render: (o, w) => /* @__PURE__ */ e.jsx(
612
+ T,
574
613
  {
575
614
  type: "link",
576
- icon: /* @__PURE__ */ e.jsx(we, {}),
577
- onClick: () => le(y.id),
578
- disabled: y.opType === "ROLLBACK",
615
+ icon: /* @__PURE__ */ e.jsx(Ce, {}),
616
+ onClick: () => n(w.id),
617
+ disabled: w.opType === "ROLLBACK",
579
618
  children: "回滚"
580
619
  }
581
620
  )
@@ -586,65 +625,65 @@ function _e() {
586
625
  },
587
626
  {
588
627
  key: "tags",
589
- label: `标签 (${j.length})`,
590
- children: /* @__PURE__ */ e.jsx("div", { children: j.length === 0 ? /* @__PURE__ */ e.jsx(F, { message: "暂无标签,可通过 /api/tag 添加", type: "info" }) : /* @__PURE__ */ e.jsx(K, { wrap: !0, children: j.map((l) => /* @__PURE__ */ e.jsxs(T, { color: "geekblue", children: [
591
- l.tagKey,
628
+ label: `标签 (${f.length})`,
629
+ children: /* @__PURE__ */ e.jsx("div", { children: f.length === 0 ? /* @__PURE__ */ e.jsx(W, { message: "暂无标签,可通过 /api/tag 添加", type: "info" }) : /* @__PURE__ */ e.jsx(N, { wrap: !0, children: f.map((o) => /* @__PURE__ */ e.jsxs(v, { color: "geekblue", children: [
630
+ o.tagKey,
592
631
  "=",
593
- l.tagValue
594
- ] }, l.id)) }) })
632
+ o.tagValue
633
+ ] }, o.id)) }) })
595
634
  }
596
635
  ]
597
636
  }
598
637
  ) })
599
638
  ] }) : /* @__PURE__ */ e.jsxs("div", { children: [
600
- /* @__PURE__ */ e.jsx(g, { icon: /* @__PURE__ */ e.jsx(Y, {}), onClick: () => i("/z-mist/secret"), children: "返回" }),
601
- /* @__PURE__ */ e.jsx(F, { type: "error", message: "密钥不存在", style: { marginTop: 16 } })
639
+ /* @__PURE__ */ e.jsx(ne, { title: "密钥详情", back: !0, onBack: () => r("/z-mist/secret") }),
640
+ /* @__PURE__ */ e.jsx(B, { title: "密钥不存在", description: "该密钥可能已被删除,返回列表重新选择" })
602
641
  ] });
603
642
  }
604
- const { TextArea: N } = f, { Option: ee } = L;
605
- function Be() {
606
- const [i, p] = d("AES"), [t, b] = d(""), [o, h] = d(""), [j, k] = d(""), [m, S] = d(""), [a, c] = d(!1), C = async () => {
607
- if (!t) {
608
- r.warning("请输入明文");
643
+ const { TextArea: q } = b, { Option: ae } = K;
644
+ function Me() {
645
+ const [r, c] = i("AES"), [s, k] = i(""), [d, g] = i(""), [f, I] = i(""), [C, O] = i(""), [h, m] = i(!1), u = async () => {
646
+ if (!s) {
647
+ a.warning("请输入明文");
609
648
  return;
610
649
  }
611
- c(!0);
650
+ m(!0);
612
651
  try {
613
- const w = await u.post("/eaas/encrypt", {
614
- plainText: t,
615
- algorithm: i
652
+ const t = await j.post("/eaas/encrypt", {
653
+ plainText: s,
654
+ algorithm: r
616
655
  });
617
- w.success ? (h(w.data), r.success("加密成功")) : r.error(w.message || "加密失败");
656
+ t.success ? (g(t.data), a.success("加密成功")) : a.error(t.message || "加密失败");
618
657
  } catch {
619
- r.error("加密请求失败");
658
+ a.error("加密请求失败");
620
659
  } finally {
621
- c(!1);
660
+ m(!1);
622
661
  }
623
- }, v = async () => {
624
- if (!j) {
625
- r.warning("请输入密文");
662
+ }, l = async () => {
663
+ if (!f) {
664
+ a.warning("请输入密文");
626
665
  return;
627
666
  }
628
- c(!0);
667
+ m(!0);
629
668
  try {
630
- const w = await u.post("/eaas/decrypt", {
631
- cipherText: j,
632
- algorithm: i
669
+ const t = await j.post("/eaas/decrypt", {
670
+ cipherText: f,
671
+ algorithm: r
633
672
  });
634
- w.success ? (S(w.data), r.success("解密成功")) : r.error(w.message || "解密失败");
673
+ t.success ? (O(t.data), a.success("解密成功")) : a.error(t.message || "解密失败");
635
674
  } catch {
636
- r.error("解密请求失败");
675
+ a.error("解密请求失败");
637
676
  } finally {
638
- c(!1);
677
+ m(!1);
639
678
  }
640
- }, n = (w, D) => {
641
- navigator.clipboard && navigator.clipboard.writeText(w).then(() => r.success(`${D}已复制`));
642
- }, A = () => {
643
- k(o), b(""), h(""), r.info("已把加密结果搬到解密输入框");
679
+ }, p = (t, E) => {
680
+ navigator.clipboard && navigator.clipboard.writeText(t).then(() => a.success(`${E}已复制`));
681
+ }, y = () => {
682
+ I(d), k(""), g(""), a.info("已把加密结果搬到解密输入框");
644
683
  };
645
684
  return /* @__PURE__ */ e.jsxs("div", { children: [
646
685
  /* @__PURE__ */ e.jsx(
647
- F,
686
+ W,
648
687
  {
649
688
  type: "info",
650
689
  showIcon: !0,
@@ -653,11 +692,11 @@ function Be() {
653
692
  style: { marginBottom: 16 }
654
693
  }
655
694
  ),
656
- /* @__PURE__ */ e.jsxs(M, { gutter: 16, children: [
657
- /* @__PURE__ */ e.jsx(R, { span: 2, children: /* @__PURE__ */ e.jsxs(I, { title: "算法", children: [
658
- /* @__PURE__ */ e.jsxs(L, { value: i, onChange: p, style: { width: "100%" }, children: [
659
- /* @__PURE__ */ e.jsx(ee, { value: "AES", children: "AES" }),
660
- /* @__PURE__ */ e.jsx(ee, { value: "RSA", children: "RSA" })
695
+ /* @__PURE__ */ e.jsxs(Y, { gutter: 16, children: [
696
+ /* @__PURE__ */ e.jsx(L, { span: 2, children: /* @__PURE__ */ e.jsxs(S, { title: "算法", children: [
697
+ /* @__PURE__ */ e.jsxs(K, { value: r, onChange: c, style: { width: "100%" }, children: [
698
+ /* @__PURE__ */ e.jsx(ae, { value: "AES", children: "AES" }),
699
+ /* @__PURE__ */ e.jsx(ae, { value: "RSA", children: "RSA" })
661
700
  ] }),
662
701
  /* @__PURE__ */ e.jsxs("div", { style: { marginTop: 16, fontSize: 12, color: "#999" }, children: [
663
702
  "AES: 对称加密,速度快,适合大数据",
@@ -665,85 +704,85 @@ function Be() {
665
704
  "RSA: 非对称加密,密文较长,适合小数据/密钥交换"
666
705
  ] })
667
706
  ] }) }),
668
- /* @__PURE__ */ e.jsx(R, { span: 11, children: /* @__PURE__ */ e.jsxs(
669
- I,
707
+ /* @__PURE__ */ e.jsx(L, { span: 11, children: /* @__PURE__ */ e.jsxs(
708
+ S,
670
709
  {
671
710
  title: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
672
- /* @__PURE__ */ e.jsx(G, {}),
711
+ /* @__PURE__ */ e.jsx(J, {}),
673
712
  " 加密"
674
713
  ] }),
675
- extra: /* @__PURE__ */ e.jsxs(K, { children: [
676
- /* @__PURE__ */ e.jsx(g, { onClick: A, icon: /* @__PURE__ */ e.jsx(Ie, {}), size: "small", children: "密文→解密" }),
677
- /* @__PURE__ */ e.jsx(g, { type: "primary", onClick: C, loading: a, children: "加密" })
714
+ extra: /* @__PURE__ */ e.jsxs(N, { children: [
715
+ /* @__PURE__ */ e.jsx(T, { onClick: y, icon: /* @__PURE__ */ e.jsx(ke, {}), size: "small", children: "密文→解密" }),
716
+ /* @__PURE__ */ e.jsx(T, { type: "primary", onClick: u, loading: h, children: "加密" })
678
717
  ] }),
679
718
  children: [
680
719
  /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 8 }, children: "明文:" }),
681
720
  /* @__PURE__ */ e.jsx(
682
- N,
721
+ q,
683
722
  {
684
723
  rows: 4,
685
- value: t,
686
- onChange: (w) => b(w.target.value),
724
+ value: s,
725
+ onChange: (t) => k(t.target.value),
687
726
  placeholder: "输入任意明文,例如: my-secret-password-123"
688
727
  }
689
728
  ),
690
729
  /* @__PURE__ */ e.jsx("div", { style: { marginTop: 12, marginBottom: 8 }, children: "密文 (Base64):" }),
691
730
  /* @__PURE__ */ e.jsx(
692
- N,
731
+ q,
693
732
  {
694
733
  rows: 4,
695
- value: o,
734
+ value: d,
696
735
  readOnly: !0,
697
736
  placeholder: "加密结果会显示在这里"
698
737
  }
699
738
  ),
700
- o && /* @__PURE__ */ e.jsx(
701
- g,
739
+ d && /* @__PURE__ */ e.jsx(
740
+ T,
702
741
  {
703
742
  style: { marginTop: 8 },
704
743
  size: "small",
705
- onClick: () => n(o, "密文"),
744
+ onClick: () => p(d, "密文"),
706
745
  children: "复制密文"
707
746
  }
708
747
  )
709
748
  ]
710
749
  }
711
750
  ) }),
712
- /* @__PURE__ */ e.jsx(R, { span: 11, children: /* @__PURE__ */ e.jsxs(
713
- I,
751
+ /* @__PURE__ */ e.jsx(L, { span: 11, children: /* @__PURE__ */ e.jsxs(
752
+ S,
714
753
  {
715
754
  title: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
716
- /* @__PURE__ */ e.jsx(be, {}),
755
+ /* @__PURE__ */ e.jsx(ve, {}),
717
756
  " 解密"
718
757
  ] }),
719
- extra: /* @__PURE__ */ e.jsx(g, { type: "primary", onClick: v, loading: a, children: "解密" }),
758
+ extra: /* @__PURE__ */ e.jsx(T, { type: "primary", onClick: l, loading: h, children: "解密" }),
720
759
  children: [
721
760
  /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 8 }, children: "密文 (Base64):" }),
722
761
  /* @__PURE__ */ e.jsx(
723
- N,
762
+ q,
724
763
  {
725
764
  rows: 4,
726
- value: j,
727
- onChange: (w) => k(w.target.value),
765
+ value: f,
766
+ onChange: (t) => I(t.target.value),
728
767
  placeholder: "粘贴 Base64 密文"
729
768
  }
730
769
  ),
731
770
  /* @__PURE__ */ e.jsx("div", { style: { marginTop: 12, marginBottom: 8 }, children: "明文:" }),
732
771
  /* @__PURE__ */ e.jsx(
733
- N,
772
+ q,
734
773
  {
735
774
  rows: 4,
736
- value: m,
775
+ value: C,
737
776
  readOnly: !0,
738
777
  placeholder: "解密结果会显示在这里"
739
778
  }
740
779
  ),
741
- m && /* @__PURE__ */ e.jsx(
742
- g,
780
+ C && /* @__PURE__ */ e.jsx(
781
+ T,
743
782
  {
744
783
  style: { marginTop: 8 },
745
784
  size: "small",
746
- onClick: () => n(m, "明文"),
785
+ onClick: () => p(C, "明文"),
747
786
  children: "复制明文"
748
787
  }
749
788
  )
@@ -751,9 +790,9 @@ function Be() {
751
790
  }
752
791
  ) })
753
792
  ] }),
754
- /* @__PURE__ */ e.jsxs(I, { title: "信封加密(Envelope Encryption)", style: { marginTop: 16 }, children: [
793
+ /* @__PURE__ */ e.jsxs(S, { title: "信封加密(Envelope Encryption)", style: { marginTop: 16 }, children: [
755
794
  /* @__PURE__ */ e.jsx(
756
- F,
795
+ W,
757
796
  {
758
797
  type: "warning",
759
798
  showIcon: !0,
@@ -775,79 +814,85 @@ function Be() {
775
814
  ] })
776
815
  ] });
777
816
  }
778
- const { Option: te } = L;
779
- function Fe() {
780
- const [i, p] = d([]), [t, b] = d([]), [o, h] = d(!1), [j, k] = d(!1), [m, S] = d(null), [a] = x.useForm();
781
- B(() => {
782
- c(), C();
817
+ const { Option: le } = K;
818
+ function Ge() {
819
+ const [r, c] = i([]), [s, k] = i([]), [d, g] = i(!1), [f, I] = i(!1), [C, O] = i(null), [h, m] = i(null), [u, l] = i(null), [p] = x.useForm();
820
+ V(() => {
821
+ y(), t();
783
822
  }, []);
784
- const c = async () => {
785
- h(!0);
823
+ const y = async () => {
824
+ g(!0);
786
825
  try {
787
- const s = await u.get("/rotation/policy/page?current=1&size=100");
788
- s.success && p(s.data || []);
789
- } catch {
790
- r.error("查询策略失败");
826
+ const n = await j.get("/rotation/policy/page?current=1&size=100");
827
+ n.success && c(n.data || []), m(null);
828
+ } catch (n) {
829
+ m(n);
791
830
  } finally {
792
- h(!1);
831
+ g(!1);
793
832
  }
794
- }, C = async () => {
833
+ }, t = async () => {
795
834
  try {
796
- const s = await u.get("/rotation/history/page?current=1&size=50");
797
- s.success && b(s.data || []);
798
- } catch {
799
- r.error("查询轮换历史失败");
835
+ const n = await j.get("/rotation/history/page?current=1&size=50");
836
+ n.success && k(n.data || []), l(null);
837
+ } catch (n) {
838
+ l(n);
800
839
  }
801
- }, v = () => {
802
- S(null), a.resetFields(), a.setFieldsValue({
840
+ }, E = () => {
841
+ O(null), p.resetFields(), p.setFieldsValue({
803
842
  cronExpression: "0 0 0 * * ?",
804
843
  rotationStrategy: "auto",
805
844
  newValueLength: 32,
806
845
  enabled: !0,
807
846
  group: "DEFAULT_GROUP",
808
847
  namespace: ""
809
- }), k(!0);
810
- }, n = (s) => {
811
- S(s), a.setFieldsValue({ ...s, enabled: s.enabled === 1 }), k(!0);
812
- }, A = (s) => {
848
+ }), I(!0);
849
+ }, M = (n) => {
850
+ O(n), p.setFieldsValue({ ...n, enabled: n.enabled === 1 }), I(!0);
851
+ }, X = (n) => {
813
852
  U.confirm({
814
853
  title: "确认删除策略",
815
- content: `将停止 ${s.secretKey} 的自动轮换`,
854
+ content: `将停止 ${n.secretKey} 的自动轮换`,
816
855
  onOk: async () => {
817
- (await u.delete(`/rotation/policy/${s.id}`)).success && (r.success("删除成功"), c());
856
+ (await j.delete(`/rotation/policy/${n.id}`)).success && (a.success("删除成功"), y());
818
857
  }
819
858
  });
820
- }, w = (s) => {
859
+ }, G = (n) => {
821
860
  U.confirm({
822
861
  title: "立即触发轮换",
823
- content: `将立即重新生成 ${s.secretKey} 的值,旧值进入历史快照`,
862
+ content: `将立即重新生成 ${n.secretKey} 的值,旧值进入历史快照`,
824
863
  onOk: async () => {
825
- const z = await u.post(`/rotation/policy/${s.id}/trigger`);
826
- z.success ? (r.success("触发成功"), c(), C()) : r.error(z.message || "触发失败");
864
+ const A = await j.post(`/rotation/policy/${n.id}/trigger`);
865
+ A.success ? (a.success("触发成功"), y(), t()) : a.error(A.message || "触发失败");
827
866
  }
828
867
  });
829
- }, D = async () => {
830
- const s = await a.validateFields();
831
- typeof s.enabled == "boolean" && (s.enabled = s.enabled ? 1 : 0);
868
+ }, Z = async () => {
869
+ const n = await p.validateFields();
870
+ typeof n.enabled == "boolean" && (n.enabled = n.enabled ? 1 : 0);
832
871
  try {
833
- const z = m ? await u.put(`/rotation/policy/${m.id}`, s) : await u.post("/rotation/policy", s);
834
- z.success ? (r.success(m ? "更新成功" : "创建成功"), k(!1), c()) : r.error(z.message || "操作失败");
872
+ const A = C ? await j.put(`/rotation/policy/${C.id}`, n) : await j.post("/rotation/policy", n);
873
+ A.success ? (a.success(C ? "更新成功" : "创建成功"), I(!1), y()) : a.error(A.message || "操作失败");
835
874
  } catch {
836
- r.error("操作失败");
875
+ a.error("操作失败");
837
876
  }
838
877
  };
839
878
  return /* @__PURE__ */ e.jsxs("div", { children: [
840
- /* @__PURE__ */ e.jsxs(I, { title: "轮换策略", children: [
841
- /* @__PURE__ */ e.jsxs(K, { style: { marginBottom: 16 }, children: [
842
- /* @__PURE__ */ e.jsx(g, { icon: /* @__PURE__ */ e.jsx(W, {}), onClick: c, children: "刷新" }),
843
- /* @__PURE__ */ e.jsx(g, { type: "primary", icon: /* @__PURE__ */ e.jsx(Se, {}), onClick: v, children: "新建策略" })
844
- ] }),
879
+ /* @__PURE__ */ e.jsxs(S, { title: "轮换策略", children: [
880
+ h && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(B, { error: h, title: "查询策略失败", onRetry: () => y() }) }),
881
+ /* @__PURE__ */ e.jsx(
882
+ pe,
883
+ {
884
+ right: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
885
+ /* @__PURE__ */ e.jsx(T, { icon: /* @__PURE__ */ e.jsx(te, {}), onClick: y, children: "刷新" }),
886
+ /* @__PURE__ */ e.jsx(T, { type: "primary", icon: /* @__PURE__ */ e.jsx(ze, {}), onClick: E, children: "新建策略" })
887
+ ] })
888
+ }
889
+ ),
845
890
  /* @__PURE__ */ e.jsx(
846
891
  $,
847
892
  {
848
- loading: o,
893
+ loading: d,
849
894
  rowKey: "id",
850
- dataSource: i,
895
+ dataSource: r,
851
896
  pagination: { pageSize: 10 },
852
897
  columns: [
853
898
  { title: "ID", dataIndex: "id", width: 60 },
@@ -858,175 +903,180 @@ function Fe() {
858
903
  title: "cron",
859
904
  dataIndex: "cronExpression",
860
905
  width: 150,
861
- render: (s) => /* @__PURE__ */ e.jsx("code", { children: s })
906
+ render: (n) => /* @__PURE__ */ e.jsx("code", { children: n })
862
907
  },
863
908
  {
864
909
  title: "策略",
865
910
  dataIndex: "rotationStrategy",
866
911
  width: 80,
867
- render: (s) => /* @__PURE__ */ e.jsx(T, { color: s === "auto" ? "blue" : "orange", children: s })
912
+ render: (n) => /* @__PURE__ */ e.jsx(v, { color: n === "auto" ? "blue" : "orange", children: n })
868
913
  },
869
914
  { title: "新值长度", dataIndex: "newValueLength", width: 90 },
870
915
  {
871
916
  title: "启用",
872
917
  dataIndex: "enabled",
873
918
  width: 70,
874
- render: (s) => /* @__PURE__ */ e.jsx(T, { color: s === 1 ? "green" : "default", children: s === 1 ? "是" : "否" })
919
+ render: (n) => /* @__PURE__ */ e.jsx(v, { color: n === 1 ? "green" : "default", children: n === 1 ? "是" : "否" })
875
920
  },
876
921
  {
877
922
  title: "上次轮换",
878
923
  dataIndex: "lastRotationTime",
879
924
  width: 170,
880
- render: (s) => s ? new Date(s).toLocaleString() : "从未"
925
+ render: (n) => n ? new Date(n).toLocaleString() : "从未"
881
926
  },
882
927
  {
883
928
  title: "下次轮换",
884
929
  dataIndex: "nextRotationTime",
885
930
  width: 170,
886
- render: (s) => s ? new Date(s).toLocaleString() : "-"
931
+ render: (n) => n ? new Date(n).toLocaleString() : "-"
887
932
  },
888
933
  {
889
934
  title: "操作",
890
935
  width: 240,
891
936
  fixed: "right",
892
- render: (s, z) => /* @__PURE__ */ e.jsxs(K, { size: "small", children: [
937
+ render: (n, A) => /* @__PURE__ */ e.jsxs(N, { size: "small", children: [
893
938
  /* @__PURE__ */ e.jsx(
894
- g,
939
+ T,
895
940
  {
896
941
  type: "link",
897
- icon: /* @__PURE__ */ e.jsx(Ce, {}),
898
- onClick: () => w(z),
942
+ icon: /* @__PURE__ */ e.jsx(Oe, {}),
943
+ onClick: () => G(A),
899
944
  children: "立即触发"
900
945
  }
901
946
  ),
902
947
  /* @__PURE__ */ e.jsx(
903
- g,
948
+ T,
904
949
  {
905
950
  type: "link",
906
- icon: /* @__PURE__ */ e.jsx(Te, {}),
907
- onClick: () => n(z),
951
+ icon: /* @__PURE__ */ e.jsx(Ee, {}),
952
+ onClick: () => M(A),
908
953
  children: "编辑"
909
954
  }
910
955
  ),
911
956
  /* @__PURE__ */ e.jsx(
912
- g,
957
+ T,
913
958
  {
914
959
  type: "link",
915
960
  danger: !0,
916
- icon: /* @__PURE__ */ e.jsx(ke, {}),
917
- onClick: () => A(z),
961
+ icon: /* @__PURE__ */ e.jsx(Ae, {}),
962
+ onClick: () => X(A),
918
963
  children: "删除"
919
964
  }
920
965
  )
921
966
  ] })
922
967
  }
968
+ ],
969
+ locale: { emptyText: /* @__PURE__ */ e.jsx(F, { title: "暂无轮换策略", description: "点「新建策略」给密钥配一条自动轮换规则" }) }
970
+ }
971
+ )
972
+ ] }),
973
+ /* @__PURE__ */ e.jsxs(S, { title: "轮换历史", style: { marginTop: 16 }, children: [
974
+ u && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(B, { error: u, title: "查询轮换历史失败", onRetry: () => t() }) }),
975
+ /* @__PURE__ */ e.jsx(
976
+ $,
977
+ {
978
+ rowKey: "id",
979
+ dataSource: s,
980
+ pagination: { pageSize: 10 },
981
+ locale: { emptyText: /* @__PURE__ */ e.jsx(F, { title: "暂无轮换记录", description: "策略触发后这里会留下每次轮换的痕迹", size: "sm" }) },
982
+ columns: [
983
+ { title: "ID", dataIndex: "id", width: 60 },
984
+ { title: "密钥", dataIndex: "secretKey", ellipsis: !0 },
985
+ { title: "策略ID", dataIndex: "policyId", width: 80 },
986
+ { title: "旧版本", dataIndex: "oldVersion", width: 80 },
987
+ { title: "新版本", dataIndex: "newVersion", width: 80 },
988
+ {
989
+ title: "触发方式",
990
+ dataIndex: "triggerType",
991
+ width: 100,
992
+ render: (n) => /* @__PURE__ */ e.jsx(
993
+ v,
994
+ {
995
+ color: n === "cron" ? "blue" : n === "manual" ? "orange" : "default",
996
+ children: n
997
+ }
998
+ )
999
+ },
1000
+ {
1001
+ title: "成功",
1002
+ dataIndex: "success",
1003
+ width: 80,
1004
+ render: (n) => /* @__PURE__ */ e.jsx(v, { color: n === 1 ? "green" : "red", children: n === 1 ? "是" : "否" })
1005
+ },
1006
+ { title: "错误信息", dataIndex: "errorMessage", ellipsis: !0 },
1007
+ {
1008
+ title: "时间",
1009
+ dataIndex: "gmtCreate",
1010
+ width: 170,
1011
+ render: (n) => n ? new Date(n).toLocaleString() : "-"
1012
+ }
923
1013
  ]
924
1014
  }
925
1015
  )
926
1016
  ] }),
927
- /* @__PURE__ */ e.jsx(I, { title: "轮换历史", style: { marginTop: 16 }, children: /* @__PURE__ */ e.jsx(
928
- $,
929
- {
930
- rowKey: "id",
931
- dataSource: t,
932
- pagination: { pageSize: 10 },
933
- columns: [
934
- { title: "ID", dataIndex: "id", width: 60 },
935
- { title: "密钥", dataIndex: "secretKey", ellipsis: !0 },
936
- { title: "策略ID", dataIndex: "policyId", width: 80 },
937
- { title: "旧版本", dataIndex: "oldVersion", width: 80 },
938
- { title: "新版本", dataIndex: "newVersion", width: 80 },
939
- {
940
- title: "触发方式",
941
- dataIndex: "triggerType",
942
- width: 100,
943
- render: (s) => /* @__PURE__ */ e.jsx(
944
- T,
945
- {
946
- color: s === "cron" ? "blue" : s === "manual" ? "orange" : "default",
947
- children: s
948
- }
949
- )
950
- },
951
- {
952
- title: "成功",
953
- dataIndex: "success",
954
- width: 80,
955
- render: (s) => /* @__PURE__ */ e.jsx(T, { color: s === 1 ? "green" : "red", children: s === 1 ? "是" : "否" })
956
- },
957
- { title: "错误信息", dataIndex: "errorMessage", ellipsis: !0 },
958
- {
959
- title: "时间",
960
- dataIndex: "gmtCreate",
961
- width: 170,
962
- render: (s) => s ? new Date(s).toLocaleString() : "-"
963
- }
964
- ]
965
- }
966
- ) }),
967
1017
  /* @__PURE__ */ e.jsx(
968
1018
  U,
969
1019
  {
970
- title: m ? "编辑策略" : "新建策略",
971
- open: j,
972
- onCancel: () => k(!1),
973
- onOk: D,
1020
+ title: C ? "编辑策略" : "新建策略",
1021
+ open: f,
1022
+ onCancel: () => I(!1),
1023
+ onOk: Z,
974
1024
  width: 500,
975
1025
  destroyOnClose: !0,
976
- children: /* @__PURE__ */ e.jsxs(x, { form: a, layout: "vertical", children: [
977
- /* @__PURE__ */ e.jsx(x.Item, { name: "secretKey", label: "密钥标识", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(f, { placeholder: "如: db_password" }) }),
978
- /* @__PURE__ */ e.jsx(x.Item, { name: "group", label: "分组", children: /* @__PURE__ */ e.jsx(f, {}) }),
979
- /* @__PURE__ */ e.jsx(x.Item, { name: "namespace", label: "命名空间", children: /* @__PURE__ */ e.jsx(f, {}) }),
1026
+ children: /* @__PURE__ */ e.jsxs(x, { form: p, layout: "vertical", children: [
1027
+ /* @__PURE__ */ e.jsx(x.Item, { name: "secretKey", label: "密钥标识", rules: [{ required: !0 }], children: /* @__PURE__ */ e.jsx(b, { placeholder: "如: db_password" }) }),
1028
+ /* @__PURE__ */ e.jsx(x.Item, { name: "group", label: "分组", children: /* @__PURE__ */ e.jsx(b, {}) }),
1029
+ /* @__PURE__ */ e.jsx(x.Item, { name: "namespace", label: "命名空间", children: /* @__PURE__ */ e.jsx(b, {}) }),
980
1030
  /* @__PURE__ */ e.jsx(
981
1031
  x.Item,
982
1032
  {
983
1033
  name: "cronExpression",
984
1034
  label: "cron 表达式",
985
1035
  tooltip: "标准 6 位 Quartz 格式,如 0 0 0 * * ? 表示每天 0 点",
986
- children: /* @__PURE__ */ e.jsx(f, { placeholder: "0 0 0 * * ?" })
1036
+ children: /* @__PURE__ */ e.jsx(b, { placeholder: "0 0 0 * * ?" })
987
1037
  }
988
1038
  ),
989
- /* @__PURE__ */ e.jsx(x.Item, { name: "rotationStrategy", label: "轮换策略", children: /* @__PURE__ */ e.jsxs(L, { children: [
990
- /* @__PURE__ */ e.jsx(te, { value: "auto", children: "auto (自动生成随机值)" }),
991
- /* @__PURE__ */ e.jsx(te, { value: "manual", children: "manual (调用 API 时手动触发)" })
1039
+ /* @__PURE__ */ e.jsx(x.Item, { name: "rotationStrategy", label: "轮换策略", children: /* @__PURE__ */ e.jsxs(K, { children: [
1040
+ /* @__PURE__ */ e.jsx(le, { value: "auto", children: "auto (自动生成随机值)" }),
1041
+ /* @__PURE__ */ e.jsx(le, { value: "manual", children: "manual (调用 API 时手动触发)" })
992
1042
  ] }) }),
993
- /* @__PURE__ */ e.jsx(x.Item, { name: "newValueLength", label: "新密钥值长度", children: /* @__PURE__ */ e.jsx(De, { min: 8, max: 128, style: { width: "100%" } }) }),
994
- /* @__PURE__ */ e.jsx(x.Item, { name: "enabled", label: "启用", valuePropName: "checked", children: /* @__PURE__ */ e.jsx(Pe, {}) }),
995
- /* @__PURE__ */ e.jsx(x.Item, { name: "description", label: "描述", children: /* @__PURE__ */ e.jsx(f.TextArea, { rows: 2 }) })
1043
+ /* @__PURE__ */ e.jsx(x.Item, { name: "newValueLength", label: "新密钥值长度", children: /* @__PURE__ */ e.jsx(_e, { min: 8, max: 128, style: { width: "100%" } }) }),
1044
+ /* @__PURE__ */ e.jsx(x.Item, { name: "enabled", label: "启用", valuePropName: "checked", children: /* @__PURE__ */ e.jsx(Fe, {}) }),
1045
+ /* @__PURE__ */ e.jsx(x.Item, { name: "description", label: "描述", children: /* @__PURE__ */ e.jsx(b.TextArea, { rows: 2 }) })
996
1046
  ] })
997
1047
  }
998
1048
  )
999
1049
  ] });
1000
1050
  }
1001
- const { Option: q } = L;
1002
- function Ve() {
1003
- const [i, p] = d([]), [t, b] = d(0), [o, h] = d(!1), [j, k] = d(1), [m, S] = d(20), [a, c] = d({
1051
+ const { Option: ee } = K;
1052
+ function He() {
1053
+ const [r, c] = i([]), [s, k] = i(0), [d, g] = i(!1), [f, I] = i(1), [C, O] = i(20), [h, m] = i(null), [u, l] = i({
1004
1054
  secretKey: "",
1005
1055
  operator: "",
1006
1056
  opType: "",
1007
1057
  success: void 0
1008
1058
  });
1009
- B(() => {
1010
- C();
1011
- }, [j, m]);
1012
- const C = async () => {
1013
- h(!0);
1059
+ V(() => {
1060
+ p();
1061
+ }, [f, C]);
1062
+ const p = async () => {
1063
+ g(!0);
1014
1064
  try {
1015
- const n = new URLSearchParams({
1016
- current: j,
1017
- size: m,
1018
- secretKey: a.secretKey || "",
1019
- operator: a.operator || "",
1020
- opType: a.opType || "",
1021
- success: a.success === void 0 ? "" : a.success ? 1 : 0
1022
- }), A = await u.get(`/log/page?${n}`);
1023
- A.success && (p(A.data || []), b(A.total || 0));
1024
- } catch {
1025
- r.error("查询日志失败");
1065
+ const t = new URLSearchParams({
1066
+ current: f,
1067
+ size: C,
1068
+ secretKey: u.secretKey || "",
1069
+ operator: u.operator || "",
1070
+ opType: u.opType || "",
1071
+ success: u.success === void 0 ? "" : u.success ? 1 : 0
1072
+ }), E = await j.get(`/log/page?${t}`);
1073
+ E.success && (c(E.data || []), k(E.total || 0)), m(null);
1074
+ } catch (t) {
1075
+ m(t);
1026
1076
  } finally {
1027
- h(!1);
1077
+ g(!1);
1028
1078
  }
1029
- }, v = {
1079
+ }, y = {
1030
1080
  GET: "blue",
1031
1081
  LIST: "cyan",
1032
1082
  PUT: "green",
@@ -1040,73 +1090,81 @@ function Ve() {
1040
1090
  DYN_READ: "lime",
1041
1091
  DYN_REVOKE: "red"
1042
1092
  };
1043
- return /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(I, { children: [
1044
- /* @__PURE__ */ e.jsxs(K, { wrap: !0, style: { marginBottom: 16 }, children: [
1045
- /* @__PURE__ */ e.jsx(
1046
- f,
1047
- {
1048
- placeholder: "密钥标识",
1049
- allowClear: !0,
1050
- value: a.secretKey,
1051
- onChange: (n) => c({ ...a, secretKey: n.target.value }),
1052
- style: { width: 180 }
1053
- }
1054
- ),
1055
- /* @__PURE__ */ e.jsx(
1056
- f,
1057
- {
1058
- placeholder: "操作者",
1059
- allowClear: !0,
1060
- value: a.operator,
1061
- onChange: (n) => c({ ...a, operator: n.target.value }),
1062
- style: { width: 140 }
1063
- }
1064
- ),
1065
- /* @__PURE__ */ e.jsx(
1066
- L,
1067
- {
1068
- placeholder: "操作类型",
1069
- allowClear: !0,
1070
- value: a.opType || void 0,
1071
- onChange: (n) => c({ ...a, opType: n || "" }),
1072
- style: { width: 160 },
1073
- children: ["GET", "PUT", "DELETE", "LIST", "GET_PLAIN", "SEARCH", "HISTORY", "ROLLBACK", "ROTATE", "DYN_GENERATE", "DYN_READ", "DYN_REVOKE"].map(
1074
- (n) => /* @__PURE__ */ e.jsx(q, { value: n, children: n }, n)
1093
+ return /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs(S, { children: [
1094
+ h && /* @__PURE__ */ e.jsx("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e.jsx(B, { error: h, title: "查询日志失败", onRetry: () => p() }) }),
1095
+ /* @__PURE__ */ e.jsx(
1096
+ pe,
1097
+ {
1098
+ left: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1099
+ /* @__PURE__ */ e.jsx(
1100
+ b,
1101
+ {
1102
+ placeholder: "密钥标识",
1103
+ allowClear: !0,
1104
+ value: u.secretKey,
1105
+ onChange: (t) => l({ ...u, secretKey: t.target.value }),
1106
+ style: { width: 180 }
1107
+ }
1108
+ ),
1109
+ /* @__PURE__ */ e.jsx(
1110
+ b,
1111
+ {
1112
+ placeholder: "操作者",
1113
+ allowClear: !0,
1114
+ value: u.operator,
1115
+ onChange: (t) => l({ ...u, operator: t.target.value }),
1116
+ style: { width: 140 }
1117
+ }
1118
+ ),
1119
+ /* @__PURE__ */ e.jsx(
1120
+ K,
1121
+ {
1122
+ placeholder: "操作类型",
1123
+ allowClear: !0,
1124
+ value: u.opType || void 0,
1125
+ onChange: (t) => l({ ...u, opType: t || "" }),
1126
+ style: { width: 160 },
1127
+ children: ["GET", "PUT", "DELETE", "LIST", "GET_PLAIN", "SEARCH", "HISTORY", "ROLLBACK", "ROTATE", "DYN_GENERATE", "DYN_READ", "DYN_REVOKE"].map(
1128
+ (t) => /* @__PURE__ */ e.jsx(ee, { value: t, children: t }, t)
1129
+ )
1130
+ }
1131
+ ),
1132
+ /* @__PURE__ */ e.jsxs(
1133
+ K,
1134
+ {
1135
+ placeholder: "成功/失败",
1136
+ allowClear: !0,
1137
+ value: u.success,
1138
+ onChange: (t) => l({ ...u, success: t }),
1139
+ style: { width: 120 },
1140
+ children: [
1141
+ /* @__PURE__ */ e.jsx(ee, { value: !0, children: "成功" }),
1142
+ /* @__PURE__ */ e.jsx(ee, { value: !1, children: "失败" })
1143
+ ]
1144
+ }
1075
1145
  )
1076
- }
1077
- ),
1078
- /* @__PURE__ */ e.jsxs(
1079
- L,
1080
- {
1081
- placeholder: "成功/失败",
1082
- allowClear: !0,
1083
- value: a.success,
1084
- onChange: (n) => c({ ...a, success: n }),
1085
- style: { width: 120 },
1086
- children: [
1087
- /* @__PURE__ */ e.jsx(q, { value: !0, children: "成功" }),
1088
- /* @__PURE__ */ e.jsx(q, { value: !1, children: "失败" })
1089
- ]
1090
- }
1091
- ),
1092
- /* @__PURE__ */ e.jsx(g, { type: "primary", icon: /* @__PURE__ */ e.jsx(ve, {}), onClick: () => {
1093
- k(1), C();
1094
- }, children: "查询" }),
1095
- /* @__PURE__ */ e.jsx(g, { icon: /* @__PURE__ */ e.jsx(W, {}), onClick: C, children: "刷新" })
1096
- ] }),
1146
+ ] }),
1147
+ right: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
1148
+ /* @__PURE__ */ e.jsx(T, { type: "primary", icon: /* @__PURE__ */ e.jsx(Re, {}), onClick: () => {
1149
+ I(1), p();
1150
+ }, children: "查询" }),
1151
+ /* @__PURE__ */ e.jsx(T, { icon: /* @__PURE__ */ e.jsx(te, {}), onClick: p, children: "刷新" })
1152
+ ] })
1153
+ }
1154
+ ),
1097
1155
  /* @__PURE__ */ e.jsx(
1098
1156
  $,
1099
1157
  {
1100
- loading: o,
1158
+ loading: d,
1101
1159
  rowKey: "id",
1102
- dataSource: i,
1160
+ dataSource: r,
1103
1161
  pagination: {
1104
- current: j,
1105
- pageSize: m,
1106
- total: t,
1162
+ current: f,
1163
+ pageSize: C,
1164
+ total: s,
1107
1165
  showSizeChanger: !0,
1108
- onChange: (n, A) => {
1109
- k(n), S(A);
1166
+ onChange: (t, E) => {
1167
+ I(t), O(E);
1110
1168
  }
1111
1169
  },
1112
1170
  columns: [
@@ -1116,7 +1174,7 @@ function Ve() {
1116
1174
  title: "操作类型",
1117
1175
  dataIndex: "opType",
1118
1176
  width: 120,
1119
- render: (n) => /* @__PURE__ */ e.jsx(T, { color: v[n] || "default", children: n })
1177
+ render: (t) => /* @__PURE__ */ e.jsx(v, { color: y[t] || "default", children: t })
1120
1178
  },
1121
1179
  { title: "操作者", dataIndex: "operator", width: 110 },
1122
1180
  { title: "IP", dataIndex: "operatorIp", width: 130 },
@@ -1124,48 +1182,49 @@ function Ve() {
1124
1182
  title: "成功",
1125
1183
  dataIndex: "success",
1126
1184
  width: 80,
1127
- render: (n) => n ? /* @__PURE__ */ e.jsx(T, { color: "green", children: "成功" }) : /* @__PURE__ */ e.jsx(T, { color: "red", children: "失败" })
1185
+ render: (t) => t ? /* @__PURE__ */ e.jsx(v, { color: "green", children: "成功" }) : /* @__PURE__ */ e.jsx(v, { color: "red", children: "失败" })
1128
1186
  },
1129
1187
  {
1130
1188
  title: "错误信息",
1131
1189
  dataIndex: "errorMessage",
1132
1190
  ellipsis: !0,
1133
- render: (n) => n ? /* @__PURE__ */ e.jsx("span", { style: { color: "#cf1322" }, children: n }) : "-"
1191
+ render: (t) => t ? /* @__PURE__ */ e.jsx("span", { style: { color: "#cf1322" }, children: t }) : "-"
1134
1192
  },
1135
1193
  {
1136
1194
  title: "时间",
1137
1195
  dataIndex: "gmtCreate",
1138
1196
  width: 170,
1139
- render: (n) => n ? new Date(n).toLocaleString() : "-"
1197
+ render: (t) => t ? new Date(t).toLocaleString() : "-"
1140
1198
  }
1141
- ]
1199
+ ],
1200
+ locale: { emptyText: /* @__PURE__ */ e.jsx(F, { title: "暂无访问日志", description: "放宽筛选条件再查一次" }) }
1142
1201
  }
1143
1202
  )
1144
1203
  ] }) });
1145
1204
  }
1146
- const { Title: Ne, Paragraph: Me } = Ue;
1147
- function Ge() {
1148
- const i = H(), [p, t] = d(null);
1149
- B(() => {
1150
- const o = localStorage.getItem("userInfo");
1151
- if (o)
1205
+ const { Title: qe, Paragraph: Ye } = Ne;
1206
+ function We() {
1207
+ const r = Q(), [c, s] = i(null);
1208
+ V(() => {
1209
+ const d = localStorage.getItem("userInfo");
1210
+ if (d)
1152
1211
  try {
1153
- t(JSON.parse(o));
1212
+ s(JSON.parse(d));
1154
1213
  } catch {
1155
- t({ name: o });
1214
+ s({ name: d });
1156
1215
  }
1157
1216
  }, []);
1158
- const b = He.filter((o) => o.key !== "/z-mist/home");
1217
+ const k = Je.filter((d) => d.key !== "/z-mist/home");
1159
1218
  return /* @__PURE__ */ e.jsxs("div", { children: [
1160
- /* @__PURE__ */ e.jsx(I, { style: { marginBottom: 16, background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" }, children: /* @__PURE__ */ e.jsxs(K, { direction: "vertical", size: 4, style: { color: "#fff" }, children: [
1161
- /* @__PURE__ */ e.jsxs(Ne, { level: 3, style: { color: "#fff", margin: 0 }, children: [
1219
+ /* @__PURE__ */ e.jsx(S, { style: { marginBottom: 16, background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" }, children: /* @__PURE__ */ e.jsxs(N, { direction: "vertical", size: 4, style: { color: "#fff" }, children: [
1220
+ /* @__PURE__ */ e.jsxs(qe, { level: 3, style: { color: "#fff", margin: 0 }, children: [
1162
1221
  "欢迎",
1163
- p != null && p.name ? `,${p.name}` : ""
1222
+ c != null && c.name ? `,${c.name}` : ""
1164
1223
  ] }),
1165
- /* @__PURE__ */ e.jsx(Me, { style: { color: "rgba(255,255,255,0.85)", margin: 0 }, children: "z-mist 密钥管理 管理台" }),
1166
- (p == null ? void 0 : p.role) && /* @__PURE__ */ e.jsx(T, { style: { marginTop: 8, background: "rgba(255,255,255,0.2)", color: "#fff", border: "none" }, children: p.role })
1224
+ /* @__PURE__ */ e.jsx(Ye, { style: { color: "rgba(255,255,255,0.85)", margin: 0 }, children: "z-mist 密钥管理 管理台" }),
1225
+ (c == null ? void 0 : c.role) && /* @__PURE__ */ e.jsx(v, { style: { marginTop: 8, background: "rgba(255,255,255,0.2)", color: "#fff", border: "none" }, children: c.role })
1167
1226
  ] }) }),
1168
- /* @__PURE__ */ e.jsx(M, { gutter: [16, 16], children: b.map((o) => /* @__PURE__ */ e.jsx(R, { xs: 24, sm: 12, md: 12, lg: 8, children: /* @__PURE__ */ e.jsx(I, { hoverable: !0, onClick: () => i(o.key), style: { borderTop: "3px solid #7c3aed" }, children: /* @__PURE__ */ e.jsxs(K, { align: "start", size: 12, children: [
1227
+ /* @__PURE__ */ e.jsx(Y, { gutter: [16, 16], children: k.map((d) => /* @__PURE__ */ e.jsx(L, { xs: 24, sm: 12, md: 12, lg: 8, children: /* @__PURE__ */ e.jsx(S, { hoverable: !0, onClick: () => r(d.key), style: { borderTop: "3px solid #7c3aed" }, children: /* @__PURE__ */ e.jsxs(N, { align: "start", size: 12, children: [
1169
1228
  /* @__PURE__ */ e.jsx("div", { style: {
1170
1229
  width: 44,
1171
1230
  height: 44,
@@ -1177,22 +1236,22 @@ function Ge() {
1177
1236
  alignItems: "center",
1178
1237
  justifyContent: "center",
1179
1238
  fontSize: 20
1180
- }, children: o.icon }),
1239
+ }, children: d.icon }),
1181
1240
  /* @__PURE__ */ e.jsxs("div", { style: { minWidth: 0 }, children: [
1182
- /* @__PURE__ */ e.jsx("div", { style: { fontSize: 15, fontWeight: 600, color: "#0f172a" }, children: o.label }),
1183
- /* @__PURE__ */ e.jsx("div", { style: { fontSize: 12, color: "#94a3b8", marginTop: 2 }, children: o.key })
1241
+ /* @__PURE__ */ e.jsx("div", { style: { fontSize: 15, fontWeight: 600, color: "#0f172a" }, children: d.label }),
1242
+ /* @__PURE__ */ e.jsx("div", { style: { fontSize: 12, color: "#94a3b8", marginTop: 2 }, children: d.key })
1184
1243
  ] })
1185
- ] }) }) }, o.key)) })
1244
+ ] }) }) }, d.key)) })
1186
1245
  ] });
1187
1246
  }
1188
1247
  const _ = { username: "admin", password: "123456", user: { name: "admin", role: "管理员" } };
1189
- function tt() {
1190
- const [i, p] = d(!1), t = async (b) => {
1191
- p(!0);
1248
+ function at() {
1249
+ const [r, c] = i(!1), s = async (k) => {
1250
+ c(!0);
1192
1251
  try {
1193
- b.username === _.username && b.password === _.password ? (localStorage.setItem("token", "mock-" + _.username), localStorage.setItem("userInfo", JSON.stringify(_.user)), r.success("登录成功(mock 模式,待 CTC/SSO 接入)"), window.location.href = "/z-mist/home") : r.error("用户名或密码错误(默认 admin/123456)");
1252
+ k.username === _.username && k.password === _.password ? (localStorage.setItem("token", "mock-" + _.username), localStorage.setItem("userInfo", JSON.stringify(_.user)), a.success("登录成功(mock 模式,待 CTC/SSO 接入)"), window.location.href = "/z-mist/home") : a.error("用户名或密码错误(默认 admin/123456)");
1194
1253
  } finally {
1195
- p(!1);
1254
+ c(!1);
1196
1255
  }
1197
1256
  };
1198
1257
  return /* @__PURE__ */ e.jsx("div", { style: {
@@ -1201,7 +1260,7 @@ function tt() {
1201
1260
  justifyContent: "center",
1202
1261
  alignItems: "center",
1203
1262
  background: "linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #eff6ff 100%)"
1204
- }, children: /* @__PURE__ */ e.jsxs(I, { style: { width: 400, boxShadow: "0 10px 40px rgba(124,58,237,0.12)" }, children: [
1263
+ }, children: /* @__PURE__ */ e.jsxs(S, { style: { width: 400, boxShadow: "0 10px 40px rgba(124,58,237,0.12)" }, children: [
1205
1264
  /* @__PURE__ */ e.jsxs("div", { style: { textAlign: "center", marginBottom: 20 }, children: [
1206
1265
  /* @__PURE__ */ e.jsx("div", { style: {
1207
1266
  width: 48,
@@ -1218,15 +1277,15 @@ function tt() {
1218
1277
  }, children: "z" }),
1219
1278
  /* @__PURE__ */ e.jsx("div", { style: { fontSize: 18, fontWeight: 600, color: "#0f172a" }, children: "z-mist 管理台" })
1220
1279
  ] }),
1221
- /* @__PURE__ */ e.jsxs(x, { onFinish: t, size: "large", children: [
1222
- /* @__PURE__ */ e.jsx(x.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ e.jsx(f, { prefix: /* @__PURE__ */ e.jsx(se, {}), placeholder: "用户名" }) }),
1223
- /* @__PURE__ */ e.jsx(x.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ e.jsx(f.Password, { prefix: /* @__PURE__ */ e.jsx(G, {}), placeholder: "密码" }) }),
1280
+ /* @__PURE__ */ e.jsxs(x, { onFinish: s, size: "large", children: [
1281
+ /* @__PURE__ */ e.jsx(x.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ e.jsx(b, { prefix: /* @__PURE__ */ e.jsx(oe, {}), placeholder: "用户名" }) }),
1282
+ /* @__PURE__ */ e.jsx(x.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ e.jsx(b.Password, { prefix: /* @__PURE__ */ e.jsx(J, {}), placeholder: "密码" }) }),
1224
1283
  /* @__PURE__ */ e.jsx(x.Item, { style: { marginBottom: 8 }, children: /* @__PURE__ */ e.jsx(
1225
- g,
1284
+ T,
1226
1285
  {
1227
1286
  type: "primary",
1228
1287
  htmlType: "submit",
1229
- loading: i,
1288
+ loading: r,
1230
1289
  block: !0,
1231
1290
  style: { background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" },
1232
1291
  children: "登 录"
@@ -1241,35 +1300,35 @@ function tt() {
1241
1300
  ] })
1242
1301
  ] }) });
1243
1302
  }
1244
- const st = { title: "z-mist 密钥管理", short: "z-mist" }, He = [
1245
- { key: "/z-mist/home", label: "首页", icon: /* @__PURE__ */ e.jsx(Oe, {}) },
1246
- { key: "/z-mist/dashboard", label: "数据看板", icon: /* @__PURE__ */ e.jsx(ze, {}) },
1247
- { key: "/z-mist/secret", label: "密钥管理", icon: /* @__PURE__ */ e.jsx(ne, {}) },
1248
- { key: "/z-mist/eaas", label: "加密即服务", icon: /* @__PURE__ */ e.jsx(G, {}) },
1249
- { key: "/z-mist/rotation", label: "轮换策略", icon: /* @__PURE__ */ e.jsx(W, {}) },
1250
- { key: "/z-mist/acl", label: "授权管理", icon: /* @__PURE__ */ e.jsx(Ee, {}) },
1251
- { key: "/z-mist/app", label: "应用管理", icon: /* @__PURE__ */ e.jsx(Ae, {}) },
1252
- { key: "/z-mist/log", label: "访问日志", icon: /* @__PURE__ */ e.jsx(Re, {}) }
1253
- ], nt = [
1254
- { path: "/z-mist/home", Component: Ge },
1255
- { path: "/z-mist/dashboard", Component: $e },
1256
- { path: "/z-mist/secret", Component: ce },
1257
- { path: "/z-mist/secret/add", Component: Z },
1258
- { path: "/z-mist/secret/edit/:id", Component: Z },
1259
- { path: "/z-mist/secret/detail/:id", Component: _e },
1260
- { path: "/z-mist/eaas", Component: Be },
1261
- { path: "/z-mist/rotation", Component: Fe },
1262
- { path: "/z-mist/acl", Component: de },
1263
- { path: "/z-mist/app", Component: he },
1264
- { path: "/z-mist/log", Component: Ve },
1265
- { path: "/z-mist/:rest*", Component: pe }
1303
+ const lt = { title: "z-mist 密钥管理", short: "z-mist" }, Je = [
1304
+ { key: "/z-mist/home", label: "首页", icon: /* @__PURE__ */ e.jsx(Le, {}) },
1305
+ { key: "/z-mist/dashboard", label: "数据看板", icon: /* @__PURE__ */ e.jsx(Ke, {}) },
1306
+ { key: "/z-mist/secret", label: "密钥管理", icon: /* @__PURE__ */ e.jsx(ce, {}) },
1307
+ { key: "/z-mist/eaas", label: "加密即服务", icon: /* @__PURE__ */ e.jsx(J, {}) },
1308
+ { key: "/z-mist/rotation", label: "轮换策略", icon: /* @__PURE__ */ e.jsx(te, {}) },
1309
+ { key: "/z-mist/acl", label: "授权管理", icon: /* @__PURE__ */ e.jsx(De, {}) },
1310
+ { key: "/z-mist/app", label: "应用管理", icon: /* @__PURE__ */ e.jsx(Pe, {}) },
1311
+ { key: "/z-mist/log", label: "访问日志", icon: /* @__PURE__ */ e.jsx(Ue, {}) }
1312
+ ], ot = [
1313
+ { path: "/z-mist/home", Component: We },
1314
+ { path: "/z-mist/dashboard", Component: Be },
1315
+ { path: "/z-mist/secret", Component: xe },
1316
+ { path: "/z-mist/secret/add", Component: ie },
1317
+ { path: "/z-mist/secret/edit/:id", Component: ie },
1318
+ { path: "/z-mist/secret/detail/:id", Component: Ve },
1319
+ { path: "/z-mist/eaas", Component: Me },
1320
+ { path: "/z-mist/rotation", Component: Ge },
1321
+ { path: "/z-mist/acl", Component: me },
1322
+ { path: "/z-mist/app", Component: ue },
1323
+ { path: "/z-mist/log", Component: He },
1324
+ { path: "/z-mist/:rest*", Component: ge }
1266
1325
  ];
1267
1326
  export {
1268
- $e as Dashboard,
1269
- Ge as HomePage,
1270
- Ze as Login,
1271
- tt as LoginPage,
1272
- st as appMeta,
1273
- He as menuItems,
1274
- nt as routes
1327
+ Be as Dashboard,
1328
+ We as HomePage,
1329
+ rt as Login,
1330
+ at as LoginPage,
1331
+ lt as appMeta,
1332
+ Je as menuItems,
1333
+ ot as routes
1275
1334
  };