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