@yuku123/z-mist-component 0.1.0 → 0.1.2

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