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