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