@yuku123/z-team-component 0.2.91 → 0.2.92
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/{ChangeLogView-DagOxr6O.js → ChangeLogView-DMVBdFFX.js} +12 -12
- package/dist/ComponentDoc-Boc9n2c_.js +8035 -0
- package/dist/{InvitationManagementPage-DYoqQA0v.js → InvitationManagementPage-B4UJQBrv.js} +1 -1
- package/dist/{OnboardingPage-D2Gm8MRd.js → OnboardingPage-BuDvSKMx.js} +2 -2
- package/dist/{ScheduledTasks-DB3VxAnb.js → ScheduledTasks-DY4iYtX3.js} +4341 -4337
- package/dist/{SystemShell-D3jHItxY.js → SystemShell-UVZjsfJs.js} +11 -12
- package/dist/admin-logs-OIyOdfuC.js +198 -0
- package/dist/{api-DYsAzJJo.js → api-mJ7FvgsR.js} +1 -1
- package/dist/createWorkspaceWsHandler-9k7O4P-D.js +13135 -0
- package/dist/{index-B5dDwxhs.js → index-BMt6Z1yA.js} +1 -1
- package/dist/{index-Cw6MIoNv.js → index-Bi6mbk7-.js} +6 -7
- package/dist/{index-E4Q6JmzX.js → index-BxRNZbw5.js} +3 -3
- package/dist/{index-CgWa7RFv.js → index-C2LwqjZQ.js} +23 -24
- package/dist/{index-BZ12pY96.js → index-COLSSd6V.js} +2 -2
- package/dist/{index-BfzgRKii.js → index-CYe2nfiG.js} +90 -91
- package/dist/{index-BYe87pnq.js → index-CeYCMcgX.js} +11 -12
- package/dist/index-Ckpc_Z6-.js +3495 -0
- package/dist/{index-BMQ6XkO3.js → index-CpA8ev3a.js} +1 -1
- package/dist/{index-VGtET31b.js → index-CpwvgQ3b.js} +1 -1
- package/dist/{index-W_4faD_M.js → index-CsHpsX_P.js} +2 -2
- package/dist/{index-CYyFYmlZ.js → index-CwNtNKwX.js} +8 -9
- package/dist/index-D1odHNMR.js +316 -0
- package/dist/{index-DyQ9YnMd.js → index-D74FCwtx.js} +3629 -3473
- package/dist/{index-Dwqa30HZ.js → index-D83QI-17.js} +4 -4
- package/dist/{index-Cggl78j7.js → index-DeHC7MtX.js} +5 -6
- package/dist/{index-ues0LW7p.js → index-FAhDAnIy.js} +1257 -1258
- package/dist/{index-C8cR7lJw.js → index-GHQ4Tl6H.js} +10 -11
- package/dist/{index-BaCqZeiw.js → index-Gk-5X-GO.js} +1 -1
- package/dist/{index-CZyFAmEq.js → index-Hm6ZaRmP.js} +10 -11
- package/dist/{index-CLfhHxPf.js → index-TW4txhve.js} +1 -1
- package/dist/{index-DE82vM_4.js → index-kwnNAAM0.js} +19 -18
- package/dist/{index-CSpckSHg.js → index-r4IxoITP.js} +23 -23
- package/dist/{index-CLD5lLa6.js → index-s5yeUpMA.js} +19 -19
- package/dist/{index-152G-_4j.js → index-zEqjsTFh.js} +5 -6
- package/dist/index.js +1 -1
- package/dist/{instance-CI6-4BZ6.js → instance-BpY3BXci.js} +1 -1
- package/dist/{menuPermission-C33I6ujb.js → menuPermission-DX8KlB6K.js} +11 -11
- package/dist/pages.js +8 -8
- package/dist/{send-default-agent-team-message-c5oKdQQA.js → send-default-agent-team-message-DVFuAdE9.js} +1 -1
- package/dist/{sso-user-DToM5dPy.js → sso-user-BBkFFo35.js} +1 -1
- package/dist/{training-B38tnwLL.js → training-BCi9cA6O.js} +1 -1
- package/dist/webide-MQ5gD1Go.js +5233 -0
- package/dist/z-team-component.css +1 -26
- package/package.json +3 -2
- package/dist/ComponentDoc-Bqfu128t.js +0 -3998
- package/dist/admin-logs-ogvMwS4O.js +0 -302
- package/dist/api-BftpestH.js +0 -2156
- package/dist/createWorkspaceWsHandler-D8h5BEzH.js +0 -13030
- package/dist/index-CUVdeb8y.js +0 -638
- package/dist/index-DVaTGA2z.js +0 -3488
- package/dist/schedule-ChO2xIGd.js +0 -625
- package/dist/useAppStore-uc8v8XZC.js +0 -1920
- package/dist/webide-BuUYLPSp.js +0 -8399
|
@@ -1,3998 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as n, Fragment as Be } from "react/jsx-runtime";
|
|
2
|
-
import { lazy as Tt, Suspense as vt, useState as h, useEffect as G, useRef as ht } from "react";
|
|
3
|
-
import { useLocation as _t, useNavigate as ke, useParams as mt, Routes as yt, Route as re, Navigate as gt, useSearchParams as At } from "react-router-dom";
|
|
4
|
-
import { Row as Y, Col as M, Typography as ae, Alert as W, Card as $, Space as R, Input as N, Button as E, Table as Q, Drawer as Ie, Descriptions as z, Tag as C, Tooltip as he, message as w, Modal as me, Statistic as H, Select as Z, Tabs as Se, Form as P, Upload as Et, Popconfirm as He, Spin as Pe, Radio as ne, InputNumber as Le, Empty as Pt } from "antd";
|
|
5
|
-
import { SettingOutlined as Rt, ProjectOutlined as Re, UserOutlined as ft, AuditOutlined as je, RobotOutlined as Ue, ApiOutlined as Ge, AppstoreOutlined as zt, ThunderboltOutlined as be, BarChartOutlined as Ot, ScheduleOutlined as Lt, FileTextOutlined as Xe, ReloadOutlined as ee, ExperimentOutlined as Mt, PlayCircleOutlined as ze, CopyOutlined as bt, GlobalOutlined as wt, NodeIndexOutlined as Dt, UndoOutlined as $t, FileSearchOutlined as Nt, VideoCameraOutlined as Ye, SearchOutlined as xt, EyeOutlined as Bt, CodeOutlined as fe, InfoCircleOutlined as jt, FunctionOutlined as Te, ImportOutlined as qe, CloudUploadOutlined as Qe, FileAddOutlined as Ut, PlusOutlined as kt, EditOutlined as qt, PauseCircleOutlined as Ft, CheckCircleOutlined as We, DeleteOutlined as Kt, ExclamationCircleOutlined as Ht, SaveOutlined as It, ArrowLeftOutlined as St, SendOutlined as Gt } from "@ant-design/icons";
|
|
6
|
-
import "@yuku123/z-frontend-common";
|
|
7
|
-
import { PageHeader as ye, GradientStatCard as ve, SectionHeader as Xt, FeatureCard as Wt, DarkBanner as Zt, ListTable as le, TableToolbar as Jt, ErrorState as Vt, ComponentDoc as Yt } from "@yuku123/z-frontend-common/ui";
|
|
8
|
-
import Ze from "axios";
|
|
9
|
-
const Qt = [
|
|
10
|
-
"/config",
|
|
11
|
-
// z-config 配置中心
|
|
12
|
-
"/mist",
|
|
13
|
-
// z-mist 密钥中心
|
|
14
|
-
"/meta",
|
|
15
|
-
// z-meta 元数据中心
|
|
16
|
-
"/msg",
|
|
17
|
-
// z-msg 消息中心
|
|
18
|
-
"/rpc",
|
|
19
|
-
// z-rpc 服务注册
|
|
20
|
-
"/vector",
|
|
21
|
-
// z-vector 向量检索
|
|
22
|
-
"/graph",
|
|
23
|
-
// z-graph 图数据库
|
|
24
|
-
"/gw",
|
|
25
|
-
// z-gw 网关
|
|
26
|
-
"/cache",
|
|
27
|
-
// z-cache 缓存
|
|
28
|
-
"/mq",
|
|
29
|
-
// z-mq 消息队列
|
|
30
|
-
"/kb",
|
|
31
|
-
// z-kb 知识库
|
|
32
|
-
"/oss"
|
|
33
|
-
// z-oss 对象存储
|
|
34
|
-
], en = [
|
|
35
|
-
"/script/keys",
|
|
36
|
-
"/script/monitor",
|
|
37
|
-
"/script/quota",
|
|
38
|
-
"/script/version",
|
|
39
|
-
"/script/tag"
|
|
40
|
-
], tn = [
|
|
41
|
-
"/ops",
|
|
42
|
-
// DevOps 运维 + 部署编排(渠道/环境/部署/仓库)
|
|
43
|
-
"/resource"
|
|
44
|
-
// 资源管理(域名 / ECS / RDS / OSS)
|
|
45
|
-
];
|
|
46
|
-
function et(t, a) {
|
|
47
|
-
return t === a || t.startsWith(a + "/");
|
|
48
|
-
}
|
|
49
|
-
function nn(t) {
|
|
50
|
-
return t ? tn.some((a) => et(t, a)) ? "ops" : en.includes(t) || Qt.some((a) => et(t, a)) ? "middleware" : "system" : "system";
|
|
51
|
-
}
|
|
52
|
-
const rn = 30, an = ["/api/", "/kapi/", "/z-team/", "/auth/", "/sso/"], we = "__zteam_api_error_monitor__", xe = globalThis;
|
|
53
|
-
function Me(t) {
|
|
54
|
-
return t.startsWith(location.origin) && (t = t.slice(location.origin.length)), an.some((a) => t.includes(a));
|
|
55
|
-
}
|
|
56
|
-
function De(t) {
|
|
57
|
-
const a = xe[we];
|
|
58
|
-
if (!a) return;
|
|
59
|
-
a.failures.push(t), a.failures.length > rn && a.failures.shift();
|
|
60
|
-
const r = [...a.failures];
|
|
61
|
-
a.listeners.forEach((S) => S(r));
|
|
62
|
-
}
|
|
63
|
-
function hr() {
|
|
64
|
-
var t;
|
|
65
|
-
return ((t = xe[we]) == null ? void 0 : t.failures) ?? [];
|
|
66
|
-
}
|
|
67
|
-
function mr(t) {
|
|
68
|
-
const a = xe[we];
|
|
69
|
-
return a ? (a.listeners.add(t), t(a.failures), () => a.listeners.delete(t)) : () => {
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function tt(t) {
|
|
73
|
-
return t >= 400 && t !== 401;
|
|
74
|
-
}
|
|
75
|
-
function sn() {
|
|
76
|
-
if (xe[we]) return;
|
|
77
|
-
const t = { failures: [], listeners: /* @__PURE__ */ new Set() };
|
|
78
|
-
xe[we] = t;
|
|
79
|
-
const a = window.fetch.bind(window);
|
|
80
|
-
window.fetch = async (...s) => {
|
|
81
|
-
var g;
|
|
82
|
-
const d = s[0], l = typeof d == "string" ? d : d instanceof URL ? d.href : d.url, A = (((g = s[1]) == null ? void 0 : g.method) ?? (typeof d == "object" && d && "method" in d ? d.method : void 0) ?? "GET").toUpperCase();
|
|
83
|
-
try {
|
|
84
|
-
const x = await a(...s);
|
|
85
|
-
return tt(x.status) && Me(l) && De({ method: A, url: l, status: x.status, route: location.pathname, at: Date.now() }), x;
|
|
86
|
-
} catch (x) {
|
|
87
|
-
throw Me(l) && De({ method: A, url: l, status: 0, route: location.pathname, at: Date.now() }), x;
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const r = XMLHttpRequest.prototype.open, S = XMLHttpRequest.prototype.send;
|
|
91
|
-
XMLHttpRequest.prototype.open = function(s, d, ...l) {
|
|
92
|
-
const A = r.call(this, s, d, ...l);
|
|
93
|
-
return this.__url = String(d), this.__method = String(s || "GET").toUpperCase(), A;
|
|
94
|
-
}, XMLHttpRequest.prototype.send = function(...s) {
|
|
95
|
-
const d = S.apply(this, s), l = this, A = l.__url;
|
|
96
|
-
if (A && Me(A)) {
|
|
97
|
-
const g = l.__method ?? "GET";
|
|
98
|
-
this.addEventListener("loadend", () => {
|
|
99
|
-
tt(this.status) && De({ method: g, url: A, status: this.status, route: location.pathname, at: Date.now() });
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
return d;
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
sn();
|
|
106
|
-
const J = (t) => {
|
|
107
|
-
const a = Tt(t);
|
|
108
|
-
return (r) => /* @__PURE__ */ e(vt, { fallback: null, children: /* @__PURE__ */ e(a, { ...r }) });
|
|
109
|
-
}, ie = J(() => import("./index-DyQ9YnMd.js").then((t) => t.al)), ln = J(() => import("./index-BfzgRKii.js")), on = J(() => import("./index-CgWa7RFv.js")), cn = J(() => import("./index-152G-_4j.js")), dn = J(() => import("./index-CZyFAmEq.js")), un = J(() => import("./index-BYe87pnq.js"));
|
|
110
|
-
J(() => import("./index-ues0LW7p.js"));
|
|
111
|
-
const pn = J(() => import("./index-C815hPWS.js")), hn = J(() => import("./index-BydWNuk5.js")), mn = J(() => import("./index-DhDdFRHC.js")), yn = J(() => import("./index-B5dDwxhs.js")), gn = J(() => import("./index-VGtET31b.js")), fn = J(() => import("./index-B_LJRFsK.js")), bn = J(() => import("./index-CYyFYmlZ.js"));
|
|
112
|
-
function yr({ forcedMode: t }) {
|
|
113
|
-
const { pathname: a } = _t(), r = a.replace(/\/+$/, "") || "/";
|
|
114
|
-
return t === "system" ? /* @__PURE__ */ e(ie, { forcedChatMode: nn(r) }) : t === "rpa" ? /* @__PURE__ */ e(ie, { forcedChatMode: "rpa" }) : t === "dev" ? /* @__PURE__ */ e(ie, { forcedChatMode: "dev" }) : r === "/workspace" ? /* @__PURE__ */ e(ie, {}) : r === "/workspace/phone" ? /* @__PURE__ */ e(ln, {}) : r === "/workspace/from-ticket" ? /* @__PURE__ */ e(on, {}) : r === "/workspace/from-scenario" ? /* @__PURE__ */ e(cn, {}) : r === "/workspace/build-by-form" ? /* @__PURE__ */ e(dn, {}) : r === "/scenario" ? /* @__PURE__ */ e(un, {}) : r === "/admin" ? /* @__PURE__ */ e(ie, {}) : r === "/welcome" ? /* @__PURE__ */ e(hn, {}) : r === "/portal" ? /* @__PURE__ */ e(mn, {}) : r === "/chatdemo" ? /* @__PURE__ */ e(pn, {}) : r === "/embed/chat" || r.startsWith("/embed/chat/") ? /* @__PURE__ */ e(bn, {}) : r === "/change-log" ? /* @__PURE__ */ e(yn, {}) : r === "/docs" ? /* @__PURE__ */ e(gn, {}) : r === "/download" ? /* @__PURE__ */ e(fn, {}) : /* @__PURE__ */ e(ie, {});
|
|
115
|
-
}
|
|
116
|
-
function wn(t) {
|
|
117
|
-
if (!t || typeof t != "string") return null;
|
|
118
|
-
const a = t.split(".");
|
|
119
|
-
if (a.length !== 3) return null;
|
|
120
|
-
try {
|
|
121
|
-
let r = a[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
122
|
-
const S = r.length % 4;
|
|
123
|
-
S && (r += "=".repeat(4 - S));
|
|
124
|
-
const s = atob(r), d = Uint8Array.from(s, (g) => g.charCodeAt(0)), l = new TextDecoder().decode(d), A = JSON.parse(l);
|
|
125
|
-
return A && typeof A == "object" && !Array.isArray(A) ? A : null;
|
|
126
|
-
} catch {
|
|
127
|
-
return null;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function xn(t, a = 30) {
|
|
131
|
-
const r = wn(t);
|
|
132
|
-
return !r || typeof r.exp != "number" ? !0 : Date.now() / 1e3 > r.exp - a;
|
|
133
|
-
}
|
|
134
|
-
let nt = !1;
|
|
135
|
-
const kn = [
|
|
136
|
-
"/ctc/authn/login",
|
|
137
|
-
"/ctc/authn/register",
|
|
138
|
-
"/ctc/authn/send-code",
|
|
139
|
-
"/ctc/authn/register-phone",
|
|
140
|
-
"/ctc/authn/reset-password",
|
|
141
|
-
"/ctc/authn/phone-login",
|
|
142
|
-
"/ctc/authn/verify",
|
|
143
|
-
"/ctc/ac/login",
|
|
144
|
-
"/auth/login",
|
|
145
|
-
"/auth/register",
|
|
146
|
-
"/auth/reset-password",
|
|
147
|
-
"/uc/login",
|
|
148
|
-
"/uc/register",
|
|
149
|
-
"/uc/phone-login",
|
|
150
|
-
"/sso/login",
|
|
151
|
-
"/sso/callback"
|
|
152
|
-
];
|
|
153
|
-
function In(t) {
|
|
154
|
-
return kn.some((a) => t.includes(a));
|
|
155
|
-
}
|
|
156
|
-
function rt(t) {
|
|
157
|
-
if (nt || typeof window > "u" || window.location.pathname.startsWith("/login")) return;
|
|
158
|
-
nt = !0;
|
|
159
|
-
try {
|
|
160
|
-
localStorage.removeItem("token"), localStorage.removeItem("userInfo");
|
|
161
|
-
} catch {
|
|
162
|
-
}
|
|
163
|
-
console.warn(`[Auth] ${t}, 跳转到 /login`);
|
|
164
|
-
const a = window.location.pathname + window.location.search, r = encodeURIComponent(a);
|
|
165
|
-
window.location.href = `/login?redirect=${r}`;
|
|
166
|
-
}
|
|
167
|
-
function Sn(t) {
|
|
168
|
-
if (t && typeof t == "object" && "code" in t && "data" in t) {
|
|
169
|
-
const a = t;
|
|
170
|
-
return (typeof a.success == "boolean" ? a.success : typeof a.code == "number" && a.code >= 200 && a.code < 300) ? a.data : Promise.reject(new Error(a.message || "请求失败"));
|
|
171
|
-
}
|
|
172
|
-
return t;
|
|
173
|
-
}
|
|
174
|
-
function Cn(t, a = {}) {
|
|
175
|
-
const { tokenKey: r = "token", userInfoKey: S = "userInfo" } = a;
|
|
176
|
-
t.interceptors.request.use((s) => {
|
|
177
|
-
const d = localStorage.getItem(r);
|
|
178
|
-
if (d && xn(d))
|
|
179
|
-
return rt(`请求前检测到 token 已过期 (${s.url || ""})`), Promise.reject(new Ze.CanceledError("token expired"));
|
|
180
|
-
try {
|
|
181
|
-
const l = localStorage.getItem(S);
|
|
182
|
-
if (l) {
|
|
183
|
-
const A = JSON.parse(l), g = A.tenantCode || "default", x = A.domainCode || "default", b = A.id ?? A.userId, m = (s.method || "get").toLowerCase();
|
|
184
|
-
if (typeof s.url == "string" && s.url.includes("/ctc/ac/") && (s.params = { ...s.params || {} }, s.params.tenantCode || (s.params.tenantCode = g), s.params.domainCode || (s.params.domainCode = x)), b != null && (s.headers["X-User-Id"] = String(b)), m !== "get" && m !== "delete" && s.data && typeof s.data == "object") {
|
|
185
|
-
const c = s.data;
|
|
186
|
-
c.tenantCode == null && (c.tenantCode = g), c.domainCode == null && (c.domainCode = x);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
} catch {
|
|
190
|
-
}
|
|
191
|
-
return s;
|
|
192
|
-
}), t.interceptors.response.use(
|
|
193
|
-
(s) => Sn(s.data),
|
|
194
|
-
(s) => {
|
|
195
|
-
var A, g;
|
|
196
|
-
const d = (A = s.response) == null ? void 0 : A.status, l = ((g = s.config) == null ? void 0 : g.url) || "";
|
|
197
|
-
return d === 401 ? In(l) ? console.warn(`[401] 公开接口返回 401 (不是 token 问题): ${l}`) : rt(`接口 ${l} 返回 401`) : d === 403 ? console.warn("[403] 没有权限访问该资源:", l) : d === 404 ? console.warn("[404] 接口不存在:", l) : d === 500 && console.error("[500] 服务器内部错误:", l), Promise.reject(s);
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
function Je(t = {}) {
|
|
202
|
-
const a = Ze.create({
|
|
203
|
-
baseURL: t.baseURL ?? "/api",
|
|
204
|
-
timeout: t.timeout ?? 1e4,
|
|
205
|
-
withCredentials: !0
|
|
206
|
-
// Cookie 模式:浏览器自动携带 Cookie
|
|
207
|
-
});
|
|
208
|
-
return Cn(a, {
|
|
209
|
-
tokenKey: t.tokenKey,
|
|
210
|
-
userInfoKey: t.userInfoKey
|
|
211
|
-
}), a;
|
|
212
|
-
}
|
|
213
|
-
const B = Je(), gr = Je(), _e = Je({ baseURL: "/api", timeout: 1e4 }), Ae = (t) => t ? typeof t.total == "number" ? t.total : Array.isArray(t) ? t.length : Array.isArray(t.records) ? t.records.length : Array.isArray(t.data) ? t.data.length : 0 : 0, Tn = [
|
|
214
|
-
{
|
|
215
|
-
key: "ai",
|
|
216
|
-
color: "violet",
|
|
217
|
-
title: "智能中心",
|
|
218
|
-
subtitle: "Agent · 模型 · MCP · 技能",
|
|
219
|
-
icon: /* @__PURE__ */ e(Ue, {}),
|
|
220
|
-
href: "/ai/agent/app",
|
|
221
|
-
items: [
|
|
222
|
-
{
|
|
223
|
-
title: "Agent 应用",
|
|
224
|
-
description: "创建和管理 AI Agent 应用, 支持多种 LLM 模型",
|
|
225
|
-
icon: /* @__PURE__ */ e(Ue, {}),
|
|
226
|
-
color: "violet",
|
|
227
|
-
tags: [{ label: "AI", color: "violet" }, { label: "推荐", color: "orange" }],
|
|
228
|
-
meta: "12 个应用"
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
title: "多 Agent 实例",
|
|
232
|
-
description: "多 Agent 协同执行, 支持 ZBOT / Hermes / Claude Code / OpenCode",
|
|
233
|
-
icon: /* @__PURE__ */ e(Ge, {}),
|
|
234
|
-
color: "blue",
|
|
235
|
-
tags: [{ label: "AI", color: "blue" }],
|
|
236
|
-
meta: "5 种引擎"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
title: "模板市场",
|
|
240
|
-
description: "精选 AI 应用模板, 一键复制即可使用",
|
|
241
|
-
icon: /* @__PURE__ */ e(zt, {}),
|
|
242
|
-
color: "pink",
|
|
243
|
-
tags: [{ label: "模板", color: "pink" }],
|
|
244
|
-
meta: "24 个模板"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
title: "技能市场",
|
|
248
|
-
description: "为 Agent 装配技能, 拓展能力边界",
|
|
249
|
-
icon: /* @__PURE__ */ e(be, {}),
|
|
250
|
-
color: "orange",
|
|
251
|
-
tags: [{ label: "扩展", color: "orange" }]
|
|
252
|
-
}
|
|
253
|
-
]
|
|
254
|
-
},
|
|
255
|
-
// 运维中心已迁出独立平台 z-ops (2026-09-24, github.com/z-opc-foundation/z-ops)
|
|
256
|
-
{
|
|
257
|
-
key: "task",
|
|
258
|
-
color: "green",
|
|
259
|
-
title: "任务中心",
|
|
260
|
-
subtitle: "仪表盘 · 任务 · 项目",
|
|
261
|
-
icon: /* @__PURE__ */ e(Re, {}),
|
|
262
|
-
href: "/task/dashboard",
|
|
263
|
-
items: [
|
|
264
|
-
{
|
|
265
|
-
title: "任务仪表盘",
|
|
266
|
-
description: "实时任务执行情况, 成功率与时长统计",
|
|
267
|
-
icon: /* @__PURE__ */ e(Ot, {}),
|
|
268
|
-
color: "green",
|
|
269
|
-
tags: [{ label: "看板", color: "green" }]
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
title: "任务列表",
|
|
273
|
-
description: "所有定时/手动任务, 支持 Cron 表达式",
|
|
274
|
-
icon: /* @__PURE__ */ e(Lt, {}),
|
|
275
|
-
color: "blue",
|
|
276
|
-
tags: [{ label: "调度", color: "blue" }]
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
title: "项目管理",
|
|
280
|
-
description: "项目维度组织任务, 支持里程碑",
|
|
281
|
-
icon: /* @__PURE__ */ e(Re, {}),
|
|
282
|
-
color: "violet",
|
|
283
|
-
tags: [{ label: "项目", color: "violet" }]
|
|
284
|
-
}
|
|
285
|
-
]
|
|
286
|
-
},
|
|
287
|
-
{
|
|
288
|
-
key: "workflow",
|
|
289
|
-
color: "orange",
|
|
290
|
-
title: "流程中心",
|
|
291
|
-
subtitle: "审批 · 待办 · 我的",
|
|
292
|
-
icon: /* @__PURE__ */ e(je, {}),
|
|
293
|
-
href: "/workflow/dashboard",
|
|
294
|
-
items: [
|
|
295
|
-
{
|
|
296
|
-
title: "流程仪表盘",
|
|
297
|
-
description: "流程实例统计与效率分析",
|
|
298
|
-
icon: /* @__PURE__ */ e(je, {}),
|
|
299
|
-
color: "orange",
|
|
300
|
-
tags: [{ label: "审批", color: "orange" }]
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
title: "待办任务",
|
|
304
|
-
description: "我的待审批任务, 实时推送",
|
|
305
|
-
icon: /* @__PURE__ */ e(Xe, {}),
|
|
306
|
-
color: "red",
|
|
307
|
-
tags: [{ label: "待办", color: "red" }]
|
|
308
|
-
}
|
|
309
|
-
]
|
|
310
|
-
}
|
|
311
|
-
], fr = () => {
|
|
312
|
-
const [t, a] = h({
|
|
313
|
-
configCount: null,
|
|
314
|
-
projectCount: null,
|
|
315
|
-
userCount: null,
|
|
316
|
-
roleCount: null
|
|
317
|
-
});
|
|
318
|
-
return G(() => {
|
|
319
|
-
let r = !0;
|
|
320
|
-
const S = [
|
|
321
|
-
_e.get("/config/list", { params: { pageSize: 1 } }).then((s) => Ae(s)).then((s) => r && a((d) => ({ ...d, configCount: s }))).catch(() => r && a((s) => ({ ...s, configCount: 0 }))),
|
|
322
|
-
_e.get("/project/user/list").then((s) => Ae(s)).then((s) => r && a((d) => ({ ...d, projectCount: s }))).catch(() => r && a((s) => ({ ...s, projectCount: 0 }))),
|
|
323
|
-
_e.get("/ctc/ac/accounts", { params: { pageSize: 1 } }).then((s) => Ae(s)).then((s) => r && a((d) => ({ ...d, userCount: s }))).catch(() => r && a((s) => ({ ...s, userCount: 0 }))),
|
|
324
|
-
_e.get("/ctc/authz/roles/list").then((s) => Ae(s)).then((s) => r && a((d) => ({ ...d, roleCount: s }))).catch(() => r && a((s) => ({ ...s, roleCount: 0 })))
|
|
325
|
-
];
|
|
326
|
-
return () => {
|
|
327
|
-
r = !1, S.forEach((s) => {
|
|
328
|
-
var d;
|
|
329
|
-
return (d = s == null ? void 0 : s.catch) == null ? void 0 : d.call(s, () => {
|
|
330
|
-
});
|
|
331
|
-
});
|
|
332
|
-
};
|
|
333
|
-
}, []), /* @__PURE__ */ n("div", { children: [
|
|
334
|
-
/* @__PURE__ */ e(
|
|
335
|
-
ye,
|
|
336
|
-
{
|
|
337
|
-
title: "统一管理平台",
|
|
338
|
-
subtitle: "一站式企业级应用管理平台 · 整合配置 / 任务 / 工作流 / 用户 / 调度 等核心模块",
|
|
339
|
-
breadcrumb: [{ label: "首页" }]
|
|
340
|
-
}
|
|
341
|
-
),
|
|
342
|
-
/* @__PURE__ */ n(Y, { gutter: [16, 16], children: [
|
|
343
|
-
/* @__PURE__ */ e(M, { xs: 24, sm: 12, md: 12, lg: 6, children: /* @__PURE__ */ e(
|
|
344
|
-
ve,
|
|
345
|
-
{
|
|
346
|
-
icon: /* @__PURE__ */ e(Rt, {}),
|
|
347
|
-
label: "配置中心",
|
|
348
|
-
value: t.configCount,
|
|
349
|
-
suffix: "条",
|
|
350
|
-
color: "violet",
|
|
351
|
-
trend: 12.5,
|
|
352
|
-
href: "/config/list"
|
|
353
|
-
}
|
|
354
|
-
) }),
|
|
355
|
-
/* @__PURE__ */ e(M, { xs: 24, sm: 12, md: 12, lg: 6, children: /* @__PURE__ */ e(
|
|
356
|
-
ve,
|
|
357
|
-
{
|
|
358
|
-
icon: /* @__PURE__ */ e(Re, {}),
|
|
359
|
-
label: "我的项目",
|
|
360
|
-
value: t.projectCount,
|
|
361
|
-
suffix: "个",
|
|
362
|
-
color: "blue",
|
|
363
|
-
trend: 8.3,
|
|
364
|
-
href: "/project/list"
|
|
365
|
-
}
|
|
366
|
-
) }),
|
|
367
|
-
/* @__PURE__ */ e(M, { xs: 24, sm: 12, md: 12, lg: 6, children: /* @__PURE__ */ e(
|
|
368
|
-
ve,
|
|
369
|
-
{
|
|
370
|
-
icon: /* @__PURE__ */ e(ft, {}),
|
|
371
|
-
label: "账号数",
|
|
372
|
-
value: t.userCount,
|
|
373
|
-
suffix: "人",
|
|
374
|
-
color: "green",
|
|
375
|
-
trend: -2.1,
|
|
376
|
-
href: "/ctc/4a/account"
|
|
377
|
-
}
|
|
378
|
-
) }),
|
|
379
|
-
/* @__PURE__ */ e(M, { xs: 24, sm: 12, md: 12, lg: 6, children: /* @__PURE__ */ e(
|
|
380
|
-
ve,
|
|
381
|
-
{
|
|
382
|
-
icon: /* @__PURE__ */ e(je, {}),
|
|
383
|
-
label: "角色数",
|
|
384
|
-
value: t.roleCount,
|
|
385
|
-
suffix: "个",
|
|
386
|
-
color: "orange",
|
|
387
|
-
trend: 4.7,
|
|
388
|
-
href: "/ctc/4a/role"
|
|
389
|
-
}
|
|
390
|
-
) })
|
|
391
|
-
] }),
|
|
392
|
-
Tn.map((r) => /* @__PURE__ */ n("div", { style: { marginBottom: 32 }, children: [
|
|
393
|
-
/* @__PURE__ */ e(
|
|
394
|
-
Xt,
|
|
395
|
-
{
|
|
396
|
-
color: r.color,
|
|
397
|
-
title: r.title,
|
|
398
|
-
subtitle: r.subtitle,
|
|
399
|
-
moreHref: r.href
|
|
400
|
-
}
|
|
401
|
-
),
|
|
402
|
-
/* @__PURE__ */ e(Y, { gutter: [16, 16], children: r.items.map((S, s) => /* @__PURE__ */ e(
|
|
403
|
-
M,
|
|
404
|
-
{
|
|
405
|
-
xs: 24,
|
|
406
|
-
sm: 12,
|
|
407
|
-
md: 12,
|
|
408
|
-
lg: 6,
|
|
409
|
-
xl: 6,
|
|
410
|
-
xxl: 6,
|
|
411
|
-
children: /* @__PURE__ */ e(
|
|
412
|
-
Wt,
|
|
413
|
-
{
|
|
414
|
-
title: S.title,
|
|
415
|
-
description: S.description,
|
|
416
|
-
icon: S.icon,
|
|
417
|
-
color: S.color,
|
|
418
|
-
tags: S.tags,
|
|
419
|
-
meta: S.meta,
|
|
420
|
-
href: r.href
|
|
421
|
-
}
|
|
422
|
-
)
|
|
423
|
-
},
|
|
424
|
-
s
|
|
425
|
-
)) })
|
|
426
|
-
] }, r.key)),
|
|
427
|
-
/* @__PURE__ */ e(
|
|
428
|
-
Zt,
|
|
429
|
-
{
|
|
430
|
-
tag: "FOR ENGINEERS",
|
|
431
|
-
title: "把 Z-One Company 接入你的工作流",
|
|
432
|
-
description: "通过 OpenAPI、Webhook 与 SDK,把统一管理平台的能力嵌入到你的业务系统中。支持配置查询、任务触发、流程审批等 200+ 接口。",
|
|
433
|
-
buttonText: "查看开发文档",
|
|
434
|
-
buttonHref: "/z-tool/webide"
|
|
435
|
-
}
|
|
436
|
-
)
|
|
437
|
-
] });
|
|
438
|
-
};
|
|
439
|
-
let vn = "/api";
|
|
440
|
-
function Ct() {
|
|
441
|
-
return Ze.create({ baseURL: vn, timeout: 15e3, withCredentials: !0 });
|
|
442
|
-
}
|
|
443
|
-
const Ce = Ct(), _n = Ct();
|
|
444
|
-
_n.interceptors.request.use((t) => t);
|
|
445
|
-
Ce.interceptors.request.use((t) => t);
|
|
446
|
-
const Oe = "/mock-platform", X = (t, a) => Ce.get(`${Oe}${t}`, { params: a }).then((r) => r.data), F = (t, a, r) => Ce.post(`${Oe}${t}`, a, { params: r }).then((S) => S.data), Ee = (t, a, r) => Ce.put(`${Oe}${t}`, a, { params: r }).then((S) => S.data), ce = (t, a) => Ce.delete(`${Oe}${t}`, { params: a }).then((r) => r.data), U = {
|
|
447
|
-
stats: () => X("/stats"),
|
|
448
|
-
environments: {
|
|
449
|
-
list: () => X("/environments/list"),
|
|
450
|
-
create: (t) => F("/environments", t),
|
|
451
|
-
update: (t, a) => Ee("/environments", a, { envCode: t }),
|
|
452
|
-
delete: (t) => ce("/environments", { envCode: t })
|
|
453
|
-
},
|
|
454
|
-
endpoints: {
|
|
455
|
-
list: (t, a, r) => X("/endpoints/list", { envCode: t, scenarioCode: a, status: r }),
|
|
456
|
-
get: (t) => X("/endpoints/byCode", { mockCode: t }),
|
|
457
|
-
create: (t) => F("/endpoints", t),
|
|
458
|
-
update: (t, a) => Ee("/endpoints", a, { mockCode: t }),
|
|
459
|
-
delete: (t) => ce("/endpoints", { mockCode: t }),
|
|
460
|
-
toggle: (t, a) => F("/endpoints/toggle", null, { mockCode: t, status: a })
|
|
461
|
-
},
|
|
462
|
-
scenarios: {
|
|
463
|
-
list: () => X("/scenarios/list"),
|
|
464
|
-
get: (t) => X("/scenarios/byCode", { scenarioCode: t }),
|
|
465
|
-
create: (t) => F("/scenarios", t),
|
|
466
|
-
update: (t, a) => Ee("/scenarios", a, { scenarioCode: t }),
|
|
467
|
-
delete: (t) => ce("/scenarios", { scenarioCode: t }),
|
|
468
|
-
reset: (t) => F("/scenarios/reset", null, { scenarioCode: t }),
|
|
469
|
-
instances: (t) => X("/scenarios/instances", { scenarioCode: t })
|
|
470
|
-
},
|
|
471
|
-
cases: {
|
|
472
|
-
list: () => X("/cases/list"),
|
|
473
|
-
get: (t) => X("/cases/byCode", { caseCode: t }),
|
|
474
|
-
create: (t) => F("/cases", t),
|
|
475
|
-
update: (t, a) => Ee("/cases", a, { caseCode: t }),
|
|
476
|
-
delete: (t) => ce("/cases", { caseCode: t }),
|
|
477
|
-
run: (t) => F("/cases/run", null, { caseCode: t }),
|
|
478
|
-
runBatch: (t) => F("/cases/run-batch", { caseCodes: t })
|
|
479
|
-
},
|
|
480
|
-
recordings: {
|
|
481
|
-
list: () => X("/recordings/list"),
|
|
482
|
-
get: (t) => X("/recordings/byCode", { recordingCode: t }),
|
|
483
|
-
requests: (t) => X("/recordings/requests", { recordingCode: t }),
|
|
484
|
-
start: (t, a, r) => F("/recordings/start", {
|
|
485
|
-
recordingCode: t,
|
|
486
|
-
recordingName: a,
|
|
487
|
-
targetUrl: r
|
|
488
|
-
}),
|
|
489
|
-
stop: (t) => F("/recordings/stop", null, { recordingCode: t }),
|
|
490
|
-
export: (t, a) => F("/recordings/export", { recordingCode: t, projectCode: a }),
|
|
491
|
-
import: (t, a) => F("/recordings/import", { recordingCode: t, projectCode: a }),
|
|
492
|
-
playback: (t, a) => F("/recordings/playback", { recordingCode: t, targetUrl: a }),
|
|
493
|
-
delete: (t) => ce("/recordings", { recordingCode: t })
|
|
494
|
-
},
|
|
495
|
-
requestLogs: {
|
|
496
|
-
list: (t) => X("/request-logs/list", t),
|
|
497
|
-
stats: () => X("/request-logs/stats"),
|
|
498
|
-
clear: (t) => ce("/request-logs/clear", { limit: t })
|
|
499
|
-
},
|
|
500
|
-
curl: {
|
|
501
|
-
parse: (t) => F("/curl/parse", { curlText: t }),
|
|
502
|
-
run: (t) => F("/curl/run", { curlText: t }),
|
|
503
|
-
importAsCase: (t) => F("/curl/import-as-case", t),
|
|
504
|
-
importAsEndpoint: (t) => F("/curl/import-as-endpoint", t)
|
|
505
|
-
},
|
|
506
|
-
openapi: {
|
|
507
|
-
parse: (t) => F("/openapi/parse", { content: t }),
|
|
508
|
-
importBatch: (t) => F("/openapi/import-batch", t),
|
|
509
|
-
sample: (t) => X("/openapi/sample", { format: t })
|
|
510
|
-
}
|
|
511
|
-
}, { Text: se, Paragraph: An } = ae, at = { GET: "green", POST: "blue", PUT: "orange", DELETE: "red", PATCH: "purple" };
|
|
512
|
-
function Fe({ activeEnvCode: t }) {
|
|
513
|
-
const [a, r] = h([]), [S, s] = h(!1), [d, l] = h(null), [A, g] = h(!1), [x, b] = h(null), [m, c] = h(""), k = m.trim() ? a.filter((o) => `${o.path || ""} ${o.mock_code || ""}`.toLowerCase().includes(m.trim().toLowerCase())) : a;
|
|
514
|
-
G(() => {
|
|
515
|
-
O();
|
|
516
|
-
}, [t]);
|
|
517
|
-
const O = async () => {
|
|
518
|
-
s(!0), l(null);
|
|
519
|
-
try {
|
|
520
|
-
const o = await U.endpoints.list(t);
|
|
521
|
-
r(Array.isArray(o) ? o : []);
|
|
522
|
-
} catch (o) {
|
|
523
|
-
l((o == null ? void 0 : o.message) || "API unavailable"), r([]);
|
|
524
|
-
} finally {
|
|
525
|
-
s(!1);
|
|
526
|
-
}
|
|
527
|
-
}, y = (o) => `${window.location.origin}/api/mock/${o.env_code || t || "default"}${o.path || ""}`, I = [
|
|
528
|
-
{
|
|
529
|
-
title: "路径",
|
|
530
|
-
dataIndex: "path",
|
|
531
|
-
key: "path",
|
|
532
|
-
width: 280,
|
|
533
|
-
render: (o, v) => /* @__PURE__ */ n(R, { children: [
|
|
534
|
-
/* @__PURE__ */ e(C, { color: at[v.method] || "default", children: v.method }),
|
|
535
|
-
/* @__PURE__ */ e(se, { code: !0, copyable: { text: o }, children: o })
|
|
536
|
-
] })
|
|
537
|
-
},
|
|
538
|
-
{ title: "编码", dataIndex: "mock_code", key: "mock_code", width: 160 },
|
|
539
|
-
{
|
|
540
|
-
title: "优先级",
|
|
541
|
-
dataIndex: "priority",
|
|
542
|
-
key: "priority",
|
|
543
|
-
width: 80,
|
|
544
|
-
align: "center",
|
|
545
|
-
render: (o) => /* @__PURE__ */ n(C, { color: "blue", children: [
|
|
546
|
-
"P",
|
|
547
|
-
o || 5
|
|
548
|
-
] })
|
|
549
|
-
},
|
|
550
|
-
{ title: "状态码", dataIndex: "status_code", key: "status_code", width: 80, align: "center" },
|
|
551
|
-
{
|
|
552
|
-
title: "延迟",
|
|
553
|
-
dataIndex: "delay_ms",
|
|
554
|
-
key: "delay_ms",
|
|
555
|
-
width: 80,
|
|
556
|
-
align: "center",
|
|
557
|
-
render: (o) => o > 0 ? /* @__PURE__ */ n(se, { type: "warning", children: [
|
|
558
|
-
o,
|
|
559
|
-
"ms"
|
|
560
|
-
] }) : /* @__PURE__ */ e(se, { type: "secondary", children: "-" })
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
title: "故障",
|
|
564
|
-
dataIndex: "fault_type",
|
|
565
|
-
key: "fault_type",
|
|
566
|
-
width: 110,
|
|
567
|
-
render: (o) => o && o !== "NONE" ? /* @__PURE__ */ e(C, { color: "red", children: o }) : /* @__PURE__ */ e(se, { type: "secondary", children: "-" })
|
|
568
|
-
},
|
|
569
|
-
{
|
|
570
|
-
title: "场景",
|
|
571
|
-
dataIndex: "scenario_code",
|
|
572
|
-
key: "scenario_code",
|
|
573
|
-
width: 130,
|
|
574
|
-
render: (o) => o ? /* @__PURE__ */ e(C, { color: "purple", children: o }) : /* @__PURE__ */ e(se, { type: "secondary", children: "-" })
|
|
575
|
-
},
|
|
576
|
-
{
|
|
577
|
-
title: "命中",
|
|
578
|
-
dataIndex: "hit_count",
|
|
579
|
-
key: "hit_count",
|
|
580
|
-
width: 80,
|
|
581
|
-
align: "center",
|
|
582
|
-
render: (o) => /* @__PURE__ */ e(se, { strong: !0, children: o || 0 })
|
|
583
|
-
},
|
|
584
|
-
{
|
|
585
|
-
title: "状态",
|
|
586
|
-
dataIndex: "status",
|
|
587
|
-
key: "status",
|
|
588
|
-
width: 100,
|
|
589
|
-
align: "center",
|
|
590
|
-
render: (o) => o === 1 ? /* @__PURE__ */ e(C, { color: "green", children: "启用" }) : /* @__PURE__ */ e(C, { children: "禁用" })
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
title: "操作",
|
|
594
|
-
key: "action",
|
|
595
|
-
width: 160,
|
|
596
|
-
fixed: "right",
|
|
597
|
-
render: (o, v) => /* @__PURE__ */ n(R, { size: "small", children: [
|
|
598
|
-
/* @__PURE__ */ e(he, { title: "预览响应", children: /* @__PURE__ */ e(
|
|
599
|
-
E,
|
|
600
|
-
{
|
|
601
|
-
size: "small",
|
|
602
|
-
type: "link",
|
|
603
|
-
icon: /* @__PURE__ */ e(ze, {}),
|
|
604
|
-
onClick: () => {
|
|
605
|
-
b(v), g(!0);
|
|
606
|
-
},
|
|
607
|
-
children: "预览"
|
|
608
|
-
}
|
|
609
|
-
) }),
|
|
610
|
-
/* @__PURE__ */ e(he, { title: "复制URL", children: /* @__PURE__ */ e(
|
|
611
|
-
E,
|
|
612
|
-
{
|
|
613
|
-
size: "small",
|
|
614
|
-
type: "link",
|
|
615
|
-
icon: /* @__PURE__ */ e(bt, {}),
|
|
616
|
-
onClick: () => {
|
|
617
|
-
navigator.clipboard.writeText(y(v)), w.success("已复制");
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
) })
|
|
621
|
-
] })
|
|
622
|
-
}
|
|
623
|
-
];
|
|
624
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
625
|
-
d && /* @__PURE__ */ e(
|
|
626
|
-
W,
|
|
627
|
-
{
|
|
628
|
-
type: "warning",
|
|
629
|
-
showIcon: !0,
|
|
630
|
-
style: { marginBottom: 16 },
|
|
631
|
-
title: "后端 API 暂未连接",
|
|
632
|
-
description: d
|
|
633
|
-
}
|
|
634
|
-
),
|
|
635
|
-
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
636
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ n($, { children: [
|
|
637
|
-
/* @__PURE__ */ e("strong", { children: "总端点" }),
|
|
638
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 22 }, children: a.length })
|
|
639
|
-
] }) }),
|
|
640
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ n($, { children: [
|
|
641
|
-
/* @__PURE__ */ e("strong", { children: "已启用" }),
|
|
642
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 22, color: "#52c41a" }, children: a.filter((o) => o.status === 1).length })
|
|
643
|
-
] }) }),
|
|
644
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ n($, { children: [
|
|
645
|
-
/* @__PURE__ */ e("strong", { children: "已禁用" }),
|
|
646
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 22, color: "#ff4d4f" }, children: a.filter((o) => o.status === 0).length })
|
|
647
|
-
] }) }),
|
|
648
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ n($, { children: [
|
|
649
|
-
/* @__PURE__ */ e("strong", { children: "总命中" }),
|
|
650
|
-
/* @__PURE__ */ e("div", { style: {
|
|
651
|
-
fontSize: 22,
|
|
652
|
-
color: "#1890ff"
|
|
653
|
-
}, children: a.reduce((o, v) => o + (v.hit_count || 0), 0) })
|
|
654
|
-
] }) })
|
|
655
|
-
] }),
|
|
656
|
-
/* @__PURE__ */ n(R, { style: { marginBottom: 16 }, children: [
|
|
657
|
-
/* @__PURE__ */ e(
|
|
658
|
-
N.Search,
|
|
659
|
-
{
|
|
660
|
-
allowClear: !0,
|
|
661
|
-
placeholder: "按路径 / 编码过滤",
|
|
662
|
-
style: { width: 220 },
|
|
663
|
-
onChange: (o) => c(o.target.value)
|
|
664
|
-
}
|
|
665
|
-
),
|
|
666
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: O, children: "刷新" })
|
|
667
|
-
] }),
|
|
668
|
-
/* @__PURE__ */ e(
|
|
669
|
-
Q,
|
|
670
|
-
{
|
|
671
|
-
dataSource: k,
|
|
672
|
-
columns: I,
|
|
673
|
-
rowKey: "id",
|
|
674
|
-
loading: S,
|
|
675
|
-
pagination: { pageSize: 10 },
|
|
676
|
-
scroll: { x: 1300 },
|
|
677
|
-
size: "small"
|
|
678
|
-
}
|
|
679
|
-
),
|
|
680
|
-
/* @__PURE__ */ e(
|
|
681
|
-
Ie,
|
|
682
|
-
{
|
|
683
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
684
|
-
/* @__PURE__ */ e(Mt, {}),
|
|
685
|
-
"端点详情: ",
|
|
686
|
-
x == null ? void 0 : x.mock_code
|
|
687
|
-
] }),
|
|
688
|
-
open: A,
|
|
689
|
-
onClose: () => g(!1),
|
|
690
|
-
size: "large",
|
|
691
|
-
children: x && /* @__PURE__ */ n("div", { children: [
|
|
692
|
-
/* @__PURE__ */ n(z, { column: 2, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
693
|
-
/* @__PURE__ */ e(z.Item, { label: "编码", children: x.mock_code }),
|
|
694
|
-
/* @__PURE__ */ e(z.Item, { label: "名称", children: x.mock_name }),
|
|
695
|
-
/* @__PURE__ */ e(z.Item, { label: "方法", children: /* @__PURE__ */ e(C, { color: at[x.method], children: x.method }) }),
|
|
696
|
-
/* @__PURE__ */ e(z.Item, { label: "环境", children: x.env_code }),
|
|
697
|
-
/* @__PURE__ */ e(z.Item, { label: "路径", span: 2, children: x.path }),
|
|
698
|
-
/* @__PURE__ */ e(z.Item, { label: "状态码", children: x.status_code }),
|
|
699
|
-
/* @__PURE__ */ n(z.Item, { label: "延迟", children: [
|
|
700
|
-
x.delay_ms,
|
|
701
|
-
"ms"
|
|
702
|
-
] }),
|
|
703
|
-
/* @__PURE__ */ n(z.Item, { label: "优先级", children: [
|
|
704
|
-
"P",
|
|
705
|
-
x.priority
|
|
706
|
-
] }),
|
|
707
|
-
/* @__PURE__ */ e(z.Item, { label: "命中", children: x.hit_count || 0 }),
|
|
708
|
-
/* @__PURE__ */ e(z.Item, { label: "故障", children: x.fault_type && x.fault_type !== "NONE" ? /* @__PURE__ */ e(C, { color: "red", children: x.fault_type }) : /* @__PURE__ */ e(se, { type: "secondary", children: "-" }) }),
|
|
709
|
-
/* @__PURE__ */ e(z.Item, { label: "场景", children: x.scenario_code || "-" }),
|
|
710
|
-
/* @__PURE__ */ e(z.Item, { label: "状态", span: 2, children: x.status === 1 ? /* @__PURE__ */ e(C, { color: "green", children: "启用" }) : /* @__PURE__ */ e(C, { children: "禁用" }) }),
|
|
711
|
-
/* @__PURE__ */ e(z.Item, { label: "完整 URL", span: 2, children: /* @__PURE__ */ e(se, { copyable: !0, children: y(x) }) })
|
|
712
|
-
] }),
|
|
713
|
-
/* @__PURE__ */ e(An, { strong: !0, children: "响应模板:" }),
|
|
714
|
-
/* @__PURE__ */ e("pre", { style: {
|
|
715
|
-
background: "#f5f5f5",
|
|
716
|
-
padding: 12,
|
|
717
|
-
borderRadius: 4,
|
|
718
|
-
maxHeight: 350,
|
|
719
|
-
overflow: "auto",
|
|
720
|
-
fontSize: 13,
|
|
721
|
-
fontFamily: "monospace",
|
|
722
|
-
whiteSpace: "pre-wrap",
|
|
723
|
-
wordBreak: "break-all"
|
|
724
|
-
}, children: x.response_template })
|
|
725
|
-
] })
|
|
726
|
-
}
|
|
727
|
-
)
|
|
728
|
-
] });
|
|
729
|
-
}
|
|
730
|
-
const { Text: $e } = ae, En = { MOCK: "green", REAL: "blue", MIXED: "orange" };
|
|
731
|
-
function Ke({ onEnvChange: t }) {
|
|
732
|
-
const [a, r] = h([]), [S, s] = h(!1), [d, l] = h(""), A = d.trim() ? a.filter((b) => `${b.env_code || ""} ${b.env_name || ""}`.toLowerCase().includes(d.trim().toLowerCase())) : a;
|
|
733
|
-
G(() => {
|
|
734
|
-
g();
|
|
735
|
-
}, []);
|
|
736
|
-
const g = async () => {
|
|
737
|
-
s(!0);
|
|
738
|
-
try {
|
|
739
|
-
const b = await U.environments.list();
|
|
740
|
-
r(Array.isArray(b) ? b : []);
|
|
741
|
-
} catch (b) {
|
|
742
|
-
w.warning("加载环境列表失败: " + (b == null ? void 0 : b.message));
|
|
743
|
-
} finally {
|
|
744
|
-
s(!1);
|
|
745
|
-
}
|
|
746
|
-
}, x = [
|
|
747
|
-
{
|
|
748
|
-
title: "环境编码",
|
|
749
|
-
dataIndex: "env_code",
|
|
750
|
-
key: "env_code",
|
|
751
|
-
width: 140,
|
|
752
|
-
render: (b) => /* @__PURE__ */ e($e, { code: !0, children: b })
|
|
753
|
-
},
|
|
754
|
-
{ title: "环境名称", dataIndex: "env_name", key: "env_name", width: 160 },
|
|
755
|
-
{
|
|
756
|
-
title: "类型",
|
|
757
|
-
dataIndex: "env_type",
|
|
758
|
-
key: "env_type",
|
|
759
|
-
width: 240,
|
|
760
|
-
render: (b) => /* @__PURE__ */ e(C, { color: En[b] || "default", children: b })
|
|
761
|
-
},
|
|
762
|
-
{
|
|
763
|
-
title: "真实服务地址",
|
|
764
|
-
dataIndex: "base_url",
|
|
765
|
-
key: "base_url",
|
|
766
|
-
render: (b) => b ? /* @__PURE__ */ e($e, { copyable: !0, children: b }) : /* @__PURE__ */ e($e, { type: "secondary", children: "-" })
|
|
767
|
-
},
|
|
768
|
-
{
|
|
769
|
-
title: "默认",
|
|
770
|
-
dataIndex: "is_default",
|
|
771
|
-
key: "is_default",
|
|
772
|
-
width: 90,
|
|
773
|
-
align: "center",
|
|
774
|
-
render: (b) => b === 1 ? /* @__PURE__ */ e(C, { color: "gold", children: "默认" }) : "-"
|
|
775
|
-
},
|
|
776
|
-
{
|
|
777
|
-
title: "描述",
|
|
778
|
-
dataIndex: "description",
|
|
779
|
-
key: "description",
|
|
780
|
-
width: 220,
|
|
781
|
-
render: (b) => b || "-"
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
title: "操作",
|
|
785
|
-
key: "action",
|
|
786
|
-
width: 120,
|
|
787
|
-
render: (b, m) => /* @__PURE__ */ e(R, { size: "small", children: /* @__PURE__ */ e(
|
|
788
|
-
E,
|
|
789
|
-
{
|
|
790
|
-
size: "small",
|
|
791
|
-
type: "link",
|
|
792
|
-
icon: /* @__PURE__ */ e(wt, {}),
|
|
793
|
-
onClick: () => {
|
|
794
|
-
t && t(m.env_code);
|
|
795
|
-
},
|
|
796
|
-
children: "切换"
|
|
797
|
-
}
|
|
798
|
-
) })
|
|
799
|
-
}
|
|
800
|
-
];
|
|
801
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
802
|
-
/* @__PURE__ */ e(
|
|
803
|
-
W,
|
|
804
|
-
{
|
|
805
|
-
type: "info",
|
|
806
|
-
showIcon: !0,
|
|
807
|
-
style: { marginBottom: 16 },
|
|
808
|
-
message: "环境隔离 - 控制 Mock 与真实服务的切换",
|
|
809
|
-
description: /* @__PURE__ */ n("div", { children: [
|
|
810
|
-
/* @__PURE__ */ n("div", { children: [
|
|
811
|
-
/* @__PURE__ */ e(C, { color: "green", children: "MOCK" }),
|
|
812
|
-
" 完全拦截,仅返回 Mock 数据"
|
|
813
|
-
] }),
|
|
814
|
-
/* @__PURE__ */ n("div", { children: [
|
|
815
|
-
/* @__PURE__ */ e(C, { color: "blue", children: "REAL" }),
|
|
816
|
-
" 全部代理到 base_url(适合压测、回归测试)"
|
|
817
|
-
] }),
|
|
818
|
-
/* @__PURE__ */ n("div", { children: [
|
|
819
|
-
/* @__PURE__ */ e(C, { color: "orange", children: "MIXED" }),
|
|
820
|
-
" Mock 优先,未匹配时转发到 base_url(开发联调)"
|
|
821
|
-
] })
|
|
822
|
-
] })
|
|
823
|
-
}
|
|
824
|
-
),
|
|
825
|
-
/* @__PURE__ */ n(R, { style: { marginBottom: 16 }, children: [
|
|
826
|
-
/* @__PURE__ */ e(
|
|
827
|
-
N.Search,
|
|
828
|
-
{
|
|
829
|
-
allowClear: !0,
|
|
830
|
-
placeholder: "按编码 / 名称过滤",
|
|
831
|
-
style: { width: 220 },
|
|
832
|
-
onChange: (b) => l(b.target.value)
|
|
833
|
-
}
|
|
834
|
-
),
|
|
835
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: g, children: "刷新" })
|
|
836
|
-
] }),
|
|
837
|
-
/* @__PURE__ */ e(
|
|
838
|
-
Q,
|
|
839
|
-
{
|
|
840
|
-
dataSource: A,
|
|
841
|
-
columns: x,
|
|
842
|
-
rowKey: "id",
|
|
843
|
-
loading: S,
|
|
844
|
-
pagination: { pageSize: 10 },
|
|
845
|
-
size: "small"
|
|
846
|
-
}
|
|
847
|
-
)
|
|
848
|
-
] });
|
|
849
|
-
}
|
|
850
|
-
const { Text: Pn } = ae;
|
|
851
|
-
function Rn() {
|
|
852
|
-
const [t, a] = h([]), [r, S] = h(!1), [s, d] = h(!1), [l, A] = h(null), [g, x] = h(""), b = g.trim() ? t.filter((y) => `${y.scenario_code || ""} ${y.scenario_name || ""}`.toLowerCase().includes(g.trim().toLowerCase())) : t;
|
|
853
|
-
G(() => {
|
|
854
|
-
m();
|
|
855
|
-
}, []);
|
|
856
|
-
const m = async () => {
|
|
857
|
-
S(!0);
|
|
858
|
-
try {
|
|
859
|
-
const y = await U.scenarios.list();
|
|
860
|
-
a(Array.isArray(y) ? y : []);
|
|
861
|
-
} catch {
|
|
862
|
-
w.warning("加载场景列表失败");
|
|
863
|
-
} finally {
|
|
864
|
-
S(!1);
|
|
865
|
-
}
|
|
866
|
-
}, c = async (y) => {
|
|
867
|
-
try {
|
|
868
|
-
await U.scenarios.reset(y), w.success("已重置所有实例状态");
|
|
869
|
-
} catch {
|
|
870
|
-
w.error("重置失败");
|
|
871
|
-
}
|
|
872
|
-
}, k = async (y) => {
|
|
873
|
-
try {
|
|
874
|
-
const I = await U.scenarios.instances(y);
|
|
875
|
-
A({ code: y, list: I }), d(!0);
|
|
876
|
-
} catch {
|
|
877
|
-
w.error("加载失败");
|
|
878
|
-
}
|
|
879
|
-
}, O = [
|
|
880
|
-
{
|
|
881
|
-
title: "场景编码",
|
|
882
|
-
dataIndex: "scenario_code",
|
|
883
|
-
key: "scenario_code",
|
|
884
|
-
width: 160,
|
|
885
|
-
render: (y) => /* @__PURE__ */ e(Pn, { code: !0, children: y })
|
|
886
|
-
},
|
|
887
|
-
{ title: "场景名称", dataIndex: "scenario_name", key: "scenario_name", width: 200 },
|
|
888
|
-
{
|
|
889
|
-
title: "初始状态",
|
|
890
|
-
dataIndex: "initial_state",
|
|
891
|
-
key: "initial_state",
|
|
892
|
-
width: 140,
|
|
893
|
-
render: (y) => /* @__PURE__ */ e(C, { color: "blue", children: y })
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
title: "描述",
|
|
897
|
-
dataIndex: "description",
|
|
898
|
-
key: "description",
|
|
899
|
-
width: 240,
|
|
900
|
-
render: (y) => y || "-"
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
title: "操作",
|
|
904
|
-
key: "action",
|
|
905
|
-
width: 200,
|
|
906
|
-
fixed: "right",
|
|
907
|
-
render: (y, I) => /* @__PURE__ */ n(R, { size: "small", children: [
|
|
908
|
-
/* @__PURE__ */ e(
|
|
909
|
-
E,
|
|
910
|
-
{
|
|
911
|
-
size: "small",
|
|
912
|
-
type: "link",
|
|
913
|
-
icon: /* @__PURE__ */ e(Dt, {}),
|
|
914
|
-
onClick: () => k(I.scenario_code),
|
|
915
|
-
children: "实例"
|
|
916
|
-
}
|
|
917
|
-
),
|
|
918
|
-
/* @__PURE__ */ e(
|
|
919
|
-
E,
|
|
920
|
-
{
|
|
921
|
-
size: "small",
|
|
922
|
-
type: "link",
|
|
923
|
-
icon: /* @__PURE__ */ e($t, {}),
|
|
924
|
-
onClick: () => c(I.scenario_code),
|
|
925
|
-
children: "重置"
|
|
926
|
-
}
|
|
927
|
-
)
|
|
928
|
-
] })
|
|
929
|
-
}
|
|
930
|
-
];
|
|
931
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
932
|
-
/* @__PURE__ */ e(
|
|
933
|
-
W,
|
|
934
|
-
{
|
|
935
|
-
type: "info",
|
|
936
|
-
showIcon: !0,
|
|
937
|
-
style: { marginBottom: 16 },
|
|
938
|
-
title: "场景状态机 (Scenario)",
|
|
939
|
-
description: "用状态机驱动 Mock 集合,模拟完整业务流程(如:未登录→登录中→已登录→下单→已支付→完成)。实例通过 X-Session-Id 或 X-Trace-Id 区分,每个实例独立维护当前状态。"
|
|
940
|
-
}
|
|
941
|
-
),
|
|
942
|
-
/* @__PURE__ */ n(R, { style: { marginBottom: 16 }, children: [
|
|
943
|
-
/* @__PURE__ */ e(
|
|
944
|
-
N.Search,
|
|
945
|
-
{
|
|
946
|
-
allowClear: !0,
|
|
947
|
-
placeholder: "按编码 / 名称过滤",
|
|
948
|
-
style: { width: 220 },
|
|
949
|
-
onChange: (y) => x(y.target.value)
|
|
950
|
-
}
|
|
951
|
-
),
|
|
952
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: m, children: "刷新" })
|
|
953
|
-
] }),
|
|
954
|
-
/* @__PURE__ */ e(
|
|
955
|
-
Q,
|
|
956
|
-
{
|
|
957
|
-
dataSource: b,
|
|
958
|
-
columns: O,
|
|
959
|
-
rowKey: "id",
|
|
960
|
-
loading: r,
|
|
961
|
-
pagination: { pageSize: 10 },
|
|
962
|
-
scroll: { x: 1100 },
|
|
963
|
-
size: "small"
|
|
964
|
-
}
|
|
965
|
-
),
|
|
966
|
-
/* @__PURE__ */ e(
|
|
967
|
-
me,
|
|
968
|
-
{
|
|
969
|
-
title: `场景实例: ${l == null ? void 0 : l.code}`,
|
|
970
|
-
open: s,
|
|
971
|
-
onCancel: () => d(!1),
|
|
972
|
-
footer: /* @__PURE__ */ e(E, { onClick: () => d(!1), children: "关闭" }),
|
|
973
|
-
size: "large",
|
|
974
|
-
children: l && /* @__PURE__ */ e(
|
|
975
|
-
Q,
|
|
976
|
-
{
|
|
977
|
-
dataSource: Array.isArray(l.list) ? l.list : [],
|
|
978
|
-
columns: [
|
|
979
|
-
{ title: "实例标识", dataIndex: "instance_key", key: "instance_key" },
|
|
980
|
-
{
|
|
981
|
-
title: "当前状态",
|
|
982
|
-
dataIndex: "current_state",
|
|
983
|
-
key: "current_state",
|
|
984
|
-
render: (y) => /* @__PURE__ */ e(C, { color: "blue", children: y })
|
|
985
|
-
},
|
|
986
|
-
{ title: "最后变更", dataIndex: "update_time", key: "update_time" }
|
|
987
|
-
],
|
|
988
|
-
rowKey: (y, I) => y.instance_key || I,
|
|
989
|
-
pagination: !1,
|
|
990
|
-
size: "small"
|
|
991
|
-
}
|
|
992
|
-
)
|
|
993
|
-
}
|
|
994
|
-
)
|
|
995
|
-
] });
|
|
996
|
-
}
|
|
997
|
-
const { Text: oe } = ae, Ne = { PASS: "green", FAIL: "red", SKIP: "default" }, zn = { P0: "red", P1: "orange", P2: "blue", P3: "default" };
|
|
998
|
-
function On() {
|
|
999
|
-
const [t, a] = h([]), [r, S] = h(!1), [s, d] = h([]), [l, A] = h(!1), [g, x] = h(null), [b, m] = h(null), [c, k] = h(!1), [O, y] = h(""), I = O.trim() ? t.filter((f) => `${f.case_code || ""} ${f.case_name || ""} ${f.request_url || ""}`.toLowerCase().includes(O.trim().toLowerCase())) : t;
|
|
1000
|
-
G(() => {
|
|
1001
|
-
o();
|
|
1002
|
-
}, []);
|
|
1003
|
-
const o = async () => {
|
|
1004
|
-
S(!0);
|
|
1005
|
-
try {
|
|
1006
|
-
const f = await U.cases.list();
|
|
1007
|
-
a(Array.isArray(f) ? f : []);
|
|
1008
|
-
} catch {
|
|
1009
|
-
w.warning("加载用例列表失败");
|
|
1010
|
-
} finally {
|
|
1011
|
-
S(!1);
|
|
1012
|
-
}
|
|
1013
|
-
}, v = async (f) => {
|
|
1014
|
-
try {
|
|
1015
|
-
const D = await U.cases.run(f.case_code);
|
|
1016
|
-
x(D), A(!0), (D == null ? void 0 : D.status) === "PASS" ? w.success("用例通过") : w.error("用例失败: " + ((D == null ? void 0 : D.error) || (D == null ? void 0 : D.actualStatus))), o();
|
|
1017
|
-
} catch (D) {
|
|
1018
|
-
w.error("执行失败: " + (D == null ? void 0 : D.message));
|
|
1019
|
-
}
|
|
1020
|
-
}, u = async () => {
|
|
1021
|
-
if (s.length === 0) {
|
|
1022
|
-
w.warning("请先选择用例");
|
|
1023
|
-
return;
|
|
1024
|
-
}
|
|
1025
|
-
try {
|
|
1026
|
-
const f = await U.cases.runBatch(s);
|
|
1027
|
-
m(f), k(!0), w.success(`批量执行完成: ${f == null ? void 0 : f.pass} 通过, ${f == null ? void 0 : f.fail} 失败`), o();
|
|
1028
|
-
} catch {
|
|
1029
|
-
w.error("批量执行失败");
|
|
1030
|
-
}
|
|
1031
|
-
}, _ = [
|
|
1032
|
-
{
|
|
1033
|
-
title: "用例编码",
|
|
1034
|
-
dataIndex: "case_code",
|
|
1035
|
-
key: "case_code",
|
|
1036
|
-
width: 180,
|
|
1037
|
-
render: (f) => /* @__PURE__ */ e(oe, { code: !0, children: f })
|
|
1038
|
-
},
|
|
1039
|
-
{ title: "名称", dataIndex: "case_name", key: "case_name", width: 220 },
|
|
1040
|
-
{
|
|
1041
|
-
title: "分组",
|
|
1042
|
-
dataIndex: "case_group",
|
|
1043
|
-
key: "case_group",
|
|
1044
|
-
width: 130,
|
|
1045
|
-
render: (f) => f ? /* @__PURE__ */ e(C, { children: f }) : "-"
|
|
1046
|
-
},
|
|
1047
|
-
{
|
|
1048
|
-
title: "方法",
|
|
1049
|
-
dataIndex: "request_method",
|
|
1050
|
-
key: "request_method",
|
|
1051
|
-
width: 80,
|
|
1052
|
-
render: (f) => /* @__PURE__ */ e(C, { color: "blue", children: f })
|
|
1053
|
-
},
|
|
1054
|
-
{
|
|
1055
|
-
title: "路径",
|
|
1056
|
-
dataIndex: "request_url",
|
|
1057
|
-
key: "request_url",
|
|
1058
|
-
ellipsis: !0,
|
|
1059
|
-
render: (f) => /* @__PURE__ */ e(oe, { code: !0, children: f })
|
|
1060
|
-
},
|
|
1061
|
-
{
|
|
1062
|
-
title: "优先级",
|
|
1063
|
-
dataIndex: "priority",
|
|
1064
|
-
key: "priority",
|
|
1065
|
-
width: 80,
|
|
1066
|
-
align: "center",
|
|
1067
|
-
render: (f) => /* @__PURE__ */ e(C, { color: zn[f], children: f || "P1" })
|
|
1068
|
-
},
|
|
1069
|
-
{
|
|
1070
|
-
title: "上次结果",
|
|
1071
|
-
dataIndex: "last_run_result",
|
|
1072
|
-
key: "last_run_result",
|
|
1073
|
-
width: 100,
|
|
1074
|
-
align: "center",
|
|
1075
|
-
render: (f) => f ? /* @__PURE__ */ e(C, { color: Ne[f], children: f }) : "-"
|
|
1076
|
-
},
|
|
1077
|
-
{
|
|
1078
|
-
title: "统计",
|
|
1079
|
-
key: "stats",
|
|
1080
|
-
width: 130,
|
|
1081
|
-
align: "center",
|
|
1082
|
-
render: (f, D) => /* @__PURE__ */ n(R, { size: "small", children: [
|
|
1083
|
-
/* @__PURE__ */ e(oe, { type: "success", children: D.pass_count || 0 }),
|
|
1084
|
-
"/",
|
|
1085
|
-
/* @__PURE__ */ e(oe, { type: "danger", children: D.fail_count || 0 }),
|
|
1086
|
-
/* @__PURE__ */ n(oe, { type: "secondary", children: [
|
|
1087
|
-
"(",
|
|
1088
|
-
D.run_count || 0,
|
|
1089
|
-
")"
|
|
1090
|
-
] })
|
|
1091
|
-
] })
|
|
1092
|
-
},
|
|
1093
|
-
{
|
|
1094
|
-
title: "操作",
|
|
1095
|
-
key: "action",
|
|
1096
|
-
width: 120,
|
|
1097
|
-
fixed: "right",
|
|
1098
|
-
render: (f, D) => /* @__PURE__ */ e(R, { size: "small", children: /* @__PURE__ */ e(
|
|
1099
|
-
E,
|
|
1100
|
-
{
|
|
1101
|
-
size: "small",
|
|
1102
|
-
type: "link",
|
|
1103
|
-
icon: /* @__PURE__ */ e(ze, {}),
|
|
1104
|
-
onClick: () => v(D),
|
|
1105
|
-
children: "运行"
|
|
1106
|
-
}
|
|
1107
|
-
) })
|
|
1108
|
-
}
|
|
1109
|
-
];
|
|
1110
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
1111
|
-
/* @__PURE__ */ e(
|
|
1112
|
-
W,
|
|
1113
|
-
{
|
|
1114
|
-
type: "info",
|
|
1115
|
-
showIcon: !0,
|
|
1116
|
-
style: { marginBottom: 16 },
|
|
1117
|
-
title: "测试用例库",
|
|
1118
|
-
description: "对 Mock 接口进行断言验证。支持 7 种断言类型:STATUS / HEADER / BODY / JSON_PATH / REGEX / SCHEMA / RESPONSE_TIME。支持单条运行与批量运行,自动统计通过/失败次数。"
|
|
1119
|
-
}
|
|
1120
|
-
),
|
|
1121
|
-
/* @__PURE__ */ n(R, { style: { marginBottom: 16 }, children: [
|
|
1122
|
-
/* @__PURE__ */ e(
|
|
1123
|
-
N.Search,
|
|
1124
|
-
{
|
|
1125
|
-
allowClear: !0,
|
|
1126
|
-
placeholder: "按编码 / 名称 / 路径过滤",
|
|
1127
|
-
style: { width: 220 },
|
|
1128
|
-
onChange: (f) => y(f.target.value)
|
|
1129
|
-
}
|
|
1130
|
-
),
|
|
1131
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: o, children: "刷新" }),
|
|
1132
|
-
/* @__PURE__ */ n(
|
|
1133
|
-
E,
|
|
1134
|
-
{
|
|
1135
|
-
type: "primary",
|
|
1136
|
-
icon: /* @__PURE__ */ e(ze, {}),
|
|
1137
|
-
onClick: u,
|
|
1138
|
-
disabled: s.length === 0,
|
|
1139
|
-
children: [
|
|
1140
|
-
"批量运行 (",
|
|
1141
|
-
s.length,
|
|
1142
|
-
")"
|
|
1143
|
-
]
|
|
1144
|
-
}
|
|
1145
|
-
)
|
|
1146
|
-
] }),
|
|
1147
|
-
/* @__PURE__ */ e(
|
|
1148
|
-
Q,
|
|
1149
|
-
{
|
|
1150
|
-
dataSource: I,
|
|
1151
|
-
columns: _,
|
|
1152
|
-
rowKey: "id",
|
|
1153
|
-
loading: r,
|
|
1154
|
-
rowSelection: {
|
|
1155
|
-
selectedRowKeys: s,
|
|
1156
|
-
// 批量执行收的是 **case_code 列表**(后端按 case_code 查行),
|
|
1157
|
-
// 原来这里存的是 rowKey(=id) ⇒ 批量执行永远查不到行。
|
|
1158
|
-
onChange: (f, D) => d(D.map((K) => K.case_code))
|
|
1159
|
-
},
|
|
1160
|
-
pagination: { pageSize: 10 },
|
|
1161
|
-
scroll: { x: 1300 },
|
|
1162
|
-
size: "small"
|
|
1163
|
-
}
|
|
1164
|
-
),
|
|
1165
|
-
/* @__PURE__ */ e(
|
|
1166
|
-
Ie,
|
|
1167
|
-
{
|
|
1168
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
1169
|
-
/* @__PURE__ */ e(Nt, {}),
|
|
1170
|
-
"用例执行结果"
|
|
1171
|
-
] }),
|
|
1172
|
-
open: l,
|
|
1173
|
-
onClose: () => A(!1),
|
|
1174
|
-
size: "large",
|
|
1175
|
-
children: g && /* @__PURE__ */ n("div", { children: [
|
|
1176
|
-
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
1177
|
-
/* @__PURE__ */ e(M, { span: 8, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1178
|
-
H,
|
|
1179
|
-
{
|
|
1180
|
-
title: "结果",
|
|
1181
|
-
value: g.status,
|
|
1182
|
-
styles: { content: { color: Ne[g.status] === "green" ? "#52c41a" : "#ff4d4f" } }
|
|
1183
|
-
}
|
|
1184
|
-
) }) }),
|
|
1185
|
-
/* @__PURE__ */ e(M, { span: 8, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(H, { title: "实际状态码", value: g.actualStatus || "-" }) }) }),
|
|
1186
|
-
/* @__PURE__ */ e(M, { span: 8, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(H, { title: "耗时(ms)", value: g.durationMs || 0 }) }) })
|
|
1187
|
-
] }),
|
|
1188
|
-
/* @__PURE__ */ n(z, { column: 1, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
1189
|
-
/* @__PURE__ */ e(z.Item, { label: "用例编码", children: g.caseCode }),
|
|
1190
|
-
/* @__PURE__ */ e(z.Item, { label: "用例名称", children: g.caseName }),
|
|
1191
|
-
/* @__PURE__ */ e(z.Item, { label: "错误信息", children: g.error || "-" })
|
|
1192
|
-
] }),
|
|
1193
|
-
g.assertionResults && /* @__PURE__ */ n(Be, { children: [
|
|
1194
|
-
/* @__PURE__ */ e(oe, { strong: !0, children: "断言详情:" }),
|
|
1195
|
-
/* @__PURE__ */ e(
|
|
1196
|
-
Q,
|
|
1197
|
-
{
|
|
1198
|
-
style: { marginTop: 8 },
|
|
1199
|
-
dataSource: g.assertionResults,
|
|
1200
|
-
columns: [
|
|
1201
|
-
{ title: "断言类型", dataIndex: "type", key: "type", width: 110 },
|
|
1202
|
-
{ title: "表达式", dataIndex: "expression", key: "expression" },
|
|
1203
|
-
{ title: "期望值", dataIndex: "expected", key: "expected" },
|
|
1204
|
-
{ title: "实际值", dataIndex: "actual", key: "actual" },
|
|
1205
|
-
{
|
|
1206
|
-
title: "结果",
|
|
1207
|
-
dataIndex: "passed",
|
|
1208
|
-
key: "passed",
|
|
1209
|
-
width: 80,
|
|
1210
|
-
render: (f) => f ? /* @__PURE__ */ e(C, { color: "green", children: "PASS" }) : /* @__PURE__ */ e(C, { color: "red", children: "FAIL" })
|
|
1211
|
-
}
|
|
1212
|
-
],
|
|
1213
|
-
pagination: !1,
|
|
1214
|
-
size: "small"
|
|
1215
|
-
}
|
|
1216
|
-
)
|
|
1217
|
-
] }),
|
|
1218
|
-
/* @__PURE__ */ e(oe, { strong: !0, style: { marginTop: 16, display: "block" }, children: "响应体:" }),
|
|
1219
|
-
/* @__PURE__ */ e("pre", { style: {
|
|
1220
|
-
background: "#f5f5f5",
|
|
1221
|
-
padding: 12,
|
|
1222
|
-
borderRadius: 4,
|
|
1223
|
-
maxHeight: 250,
|
|
1224
|
-
overflow: "auto",
|
|
1225
|
-
fontSize: 12,
|
|
1226
|
-
fontFamily: "monospace",
|
|
1227
|
-
whiteSpace: "pre-wrap",
|
|
1228
|
-
wordBreak: "break-all"
|
|
1229
|
-
}, children: g.responseBody || "(empty)" })
|
|
1230
|
-
] })
|
|
1231
|
-
}
|
|
1232
|
-
),
|
|
1233
|
-
/* @__PURE__ */ e(
|
|
1234
|
-
me,
|
|
1235
|
-
{
|
|
1236
|
-
title: `批量执行结果 (${(b == null ? void 0 : b.total) || 0} 条)`,
|
|
1237
|
-
open: c,
|
|
1238
|
-
onCancel: () => k(!1),
|
|
1239
|
-
footer: /* @__PURE__ */ e(E, { onClick: () => k(!1), children: "关闭" }),
|
|
1240
|
-
size: "large",
|
|
1241
|
-
children: b && /* @__PURE__ */ n(Be, { children: [
|
|
1242
|
-
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
1243
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(H, { title: "总数", value: b.total }) }) }),
|
|
1244
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1245
|
-
H,
|
|
1246
|
-
{
|
|
1247
|
-
title: "通过",
|
|
1248
|
-
value: b.pass,
|
|
1249
|
-
styles: { content: { color: "#52c41a" } }
|
|
1250
|
-
}
|
|
1251
|
-
) }) }),
|
|
1252
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1253
|
-
H,
|
|
1254
|
-
{
|
|
1255
|
-
title: "失败",
|
|
1256
|
-
value: b.fail,
|
|
1257
|
-
styles: { content: { color: "#ff4d4f" } }
|
|
1258
|
-
}
|
|
1259
|
-
) }) }),
|
|
1260
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1261
|
-
H,
|
|
1262
|
-
{
|
|
1263
|
-
title: "通过率",
|
|
1264
|
-
value: `${b.total > 0 ? Math.round(b.pass / b.total * 100) : 0}%`
|
|
1265
|
-
}
|
|
1266
|
-
) }) })
|
|
1267
|
-
] }),
|
|
1268
|
-
/* @__PURE__ */ e(
|
|
1269
|
-
Q,
|
|
1270
|
-
{
|
|
1271
|
-
dataSource: b.results || [],
|
|
1272
|
-
columns: [
|
|
1273
|
-
{ title: "编码", dataIndex: "caseCode", key: "caseCode", width: 180 },
|
|
1274
|
-
{ title: "名称", dataIndex: "caseName", key: "caseName" },
|
|
1275
|
-
{
|
|
1276
|
-
title: "结果",
|
|
1277
|
-
dataIndex: "status",
|
|
1278
|
-
key: "status",
|
|
1279
|
-
width: 80,
|
|
1280
|
-
render: (f) => /* @__PURE__ */ e(C, { color: Ne[f], children: f })
|
|
1281
|
-
},
|
|
1282
|
-
{ title: "耗时", dataIndex: "durationMs", key: "durationMs", width: 80, align: "center" },
|
|
1283
|
-
{ title: "错误", dataIndex: "error", key: "error", ellipsis: !0 }
|
|
1284
|
-
],
|
|
1285
|
-
pagination: !1,
|
|
1286
|
-
size: "small",
|
|
1287
|
-
rowKey: "caseCode"
|
|
1288
|
-
}
|
|
1289
|
-
)
|
|
1290
|
-
] })
|
|
1291
|
-
}
|
|
1292
|
-
)
|
|
1293
|
-
] });
|
|
1294
|
-
}
|
|
1295
|
-
const { Text: de } = ae, st = {
|
|
1296
|
-
IDLE: "default",
|
|
1297
|
-
RECORDING: "red",
|
|
1298
|
-
STOPPED: "green",
|
|
1299
|
-
EXPIRED: "gray"
|
|
1300
|
-
};
|
|
1301
|
-
function Ln() {
|
|
1302
|
-
const [t, a] = h([]), [r, S] = h(!1), [s, d] = h(!1), [l, A] = h(null), [g, x] = h([]), [b, m] = h(""), c = b.trim() ? t.filter((I) => `${I.recording_code || ""} ${I.recording_name || ""} ${I.target_url || ""}`.toLowerCase().includes(b.trim().toLowerCase())) : t;
|
|
1303
|
-
G(() => {
|
|
1304
|
-
k();
|
|
1305
|
-
}, []);
|
|
1306
|
-
const k = async () => {
|
|
1307
|
-
S(!0);
|
|
1308
|
-
try {
|
|
1309
|
-
const I = await U.recordings.list();
|
|
1310
|
-
a(Array.isArray(I) ? I : []);
|
|
1311
|
-
} catch {
|
|
1312
|
-
w.warning("加载录制列表失败");
|
|
1313
|
-
} finally {
|
|
1314
|
-
S(!1);
|
|
1315
|
-
}
|
|
1316
|
-
}, O = async (I) => {
|
|
1317
|
-
try {
|
|
1318
|
-
const o = await U.recordings.requests(I.recording_code);
|
|
1319
|
-
A(I), x(Array.isArray(o) ? o : []), d(!0);
|
|
1320
|
-
} catch {
|
|
1321
|
-
w.error("加载失败");
|
|
1322
|
-
}
|
|
1323
|
-
}, y = [
|
|
1324
|
-
{
|
|
1325
|
-
title: "编码",
|
|
1326
|
-
dataIndex: "recording_code",
|
|
1327
|
-
key: "recording_code",
|
|
1328
|
-
width: 180,
|
|
1329
|
-
render: (I) => /* @__PURE__ */ e(de, { code: !0, children: I })
|
|
1330
|
-
},
|
|
1331
|
-
{ title: "名称", dataIndex: "recording_name", key: "recording_name", width: 200 },
|
|
1332
|
-
{
|
|
1333
|
-
title: "状态",
|
|
1334
|
-
dataIndex: "record_status",
|
|
1335
|
-
key: "record_status",
|
|
1336
|
-
width: 110,
|
|
1337
|
-
render: (I) => /* @__PURE__ */ e(C, { color: st[I], children: I })
|
|
1338
|
-
},
|
|
1339
|
-
{
|
|
1340
|
-
title: "请求数",
|
|
1341
|
-
dataIndex: "total_requests",
|
|
1342
|
-
key: "total_requests",
|
|
1343
|
-
width: 90,
|
|
1344
|
-
align: "center"
|
|
1345
|
-
},
|
|
1346
|
-
{
|
|
1347
|
-
title: "目标 URL",
|
|
1348
|
-
dataIndex: "target_url",
|
|
1349
|
-
key: "target_url",
|
|
1350
|
-
ellipsis: !0,
|
|
1351
|
-
render: (I) => I ? /* @__PURE__ */ e(de, { copyable: { text: I }, children: I }) : "-"
|
|
1352
|
-
},
|
|
1353
|
-
{ title: "开始时间", dataIndex: "start_time", key: "start_time", width: 170 },
|
|
1354
|
-
{ title: "结束时间", dataIndex: "end_time", key: "end_time", width: 170 },
|
|
1355
|
-
{
|
|
1356
|
-
title: "操作",
|
|
1357
|
-
key: "action",
|
|
1358
|
-
width: 120,
|
|
1359
|
-
fixed: "right",
|
|
1360
|
-
render: (I, o) => /* @__PURE__ */ e(R, { size: "small", children: /* @__PURE__ */ e(
|
|
1361
|
-
E,
|
|
1362
|
-
{
|
|
1363
|
-
size: "small",
|
|
1364
|
-
type: "link",
|
|
1365
|
-
icon: /* @__PURE__ */ e(Ye, {}),
|
|
1366
|
-
onClick: () => O(o),
|
|
1367
|
-
children: "详情"
|
|
1368
|
-
}
|
|
1369
|
-
) })
|
|
1370
|
-
}
|
|
1371
|
-
];
|
|
1372
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
1373
|
-
/* @__PURE__ */ e(
|
|
1374
|
-
W,
|
|
1375
|
-
{
|
|
1376
|
-
type: "info",
|
|
1377
|
-
showIcon: !0,
|
|
1378
|
-
style: { marginBottom: 16 },
|
|
1379
|
-
message: "流量录制与回放",
|
|
1380
|
-
description: /* @__PURE__ */ n("div", { children: [
|
|
1381
|
-
/* @__PURE__ */ n("div", { children: [
|
|
1382
|
-
"• 开启录制后,所有 ",
|
|
1383
|
-
/* @__PURE__ */ e(de, { code: !0, children: "/api/mock/{envCode}/**" }),
|
|
1384
|
-
" 请求会被捕获到数据库"
|
|
1385
|
-
] }),
|
|
1386
|
-
/* @__PURE__ */ e("div", { children: "• 停止录制后,可一键转为 Mock endpoints(用于离线测试)" }),
|
|
1387
|
-
/* @__PURE__ */ e("div", { children: "• 支持回放录制到目标服务(验证录制有效 / 跨环境验证)" })
|
|
1388
|
-
] })
|
|
1389
|
-
}
|
|
1390
|
-
),
|
|
1391
|
-
/* @__PURE__ */ n(R, { style: { marginBottom: 16 }, children: [
|
|
1392
|
-
/* @__PURE__ */ e(
|
|
1393
|
-
N.Search,
|
|
1394
|
-
{
|
|
1395
|
-
allowClear: !0,
|
|
1396
|
-
placeholder: "按编码 / 名称 / URL 过滤",
|
|
1397
|
-
style: { width: 220 },
|
|
1398
|
-
onChange: (I) => m(I.target.value)
|
|
1399
|
-
}
|
|
1400
|
-
),
|
|
1401
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: k, children: "刷新" })
|
|
1402
|
-
] }),
|
|
1403
|
-
/* @__PURE__ */ e(
|
|
1404
|
-
Q,
|
|
1405
|
-
{
|
|
1406
|
-
dataSource: c,
|
|
1407
|
-
columns: y,
|
|
1408
|
-
rowKey: "id",
|
|
1409
|
-
loading: r,
|
|
1410
|
-
pagination: { pageSize: 10 },
|
|
1411
|
-
scroll: { x: 1300 },
|
|
1412
|
-
size: "small"
|
|
1413
|
-
}
|
|
1414
|
-
),
|
|
1415
|
-
/* @__PURE__ */ e(
|
|
1416
|
-
Ie,
|
|
1417
|
-
{
|
|
1418
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
1419
|
-
/* @__PURE__ */ e(Ye, {}),
|
|
1420
|
-
"录制详情: ",
|
|
1421
|
-
l == null ? void 0 : l.recording_code
|
|
1422
|
-
] }),
|
|
1423
|
-
open: s,
|
|
1424
|
-
onClose: () => d(!1),
|
|
1425
|
-
size: "large",
|
|
1426
|
-
children: l && /* @__PURE__ */ n("div", { children: [
|
|
1427
|
-
/* @__PURE__ */ n(z, { column: 2, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
1428
|
-
/* @__PURE__ */ e(z.Item, { label: "编码", children: l.recording_code }),
|
|
1429
|
-
/* @__PURE__ */ e(z.Item, { label: "名称", children: l.recording_name }),
|
|
1430
|
-
/* @__PURE__ */ e(z.Item, { label: "状态", children: /* @__PURE__ */ e(C, { color: st[l.record_status], children: l.record_status }) }),
|
|
1431
|
-
/* @__PURE__ */ e(z.Item, { label: "请求数", children: l.total_requests }),
|
|
1432
|
-
/* @__PURE__ */ e(z.Item, { label: "目标 URL", span: 2, children: /* @__PURE__ */ e(de, { copyable: !0, children: l.target_url }) }),
|
|
1433
|
-
/* @__PURE__ */ e(z.Item, { label: "开始", children: l.start_time }),
|
|
1434
|
-
/* @__PURE__ */ e(z.Item, { label: "结束", children: l.end_time || "(录制中)" })
|
|
1435
|
-
] }),
|
|
1436
|
-
/* @__PURE__ */ n(de, { strong: !0, children: [
|
|
1437
|
-
"请求列表 (共 ",
|
|
1438
|
-
g.length,
|
|
1439
|
-
" 条):"
|
|
1440
|
-
] }),
|
|
1441
|
-
/* @__PURE__ */ e(
|
|
1442
|
-
Q,
|
|
1443
|
-
{
|
|
1444
|
-
style: { marginTop: 8 },
|
|
1445
|
-
dataSource: g,
|
|
1446
|
-
columns: [
|
|
1447
|
-
{ title: "#", dataIndex: "sequence", key: "sequence", width: 50 },
|
|
1448
|
-
{
|
|
1449
|
-
title: "方法",
|
|
1450
|
-
dataIndex: "request_method",
|
|
1451
|
-
key: "request_method",
|
|
1452
|
-
width: 80,
|
|
1453
|
-
render: (I) => /* @__PURE__ */ e(C, { color: "blue", children: I })
|
|
1454
|
-
},
|
|
1455
|
-
{
|
|
1456
|
-
title: "URL",
|
|
1457
|
-
dataIndex: "request_url",
|
|
1458
|
-
key: "request_url",
|
|
1459
|
-
ellipsis: !0,
|
|
1460
|
-
render: (I) => /* @__PURE__ */ e(de, { code: !0, children: I })
|
|
1461
|
-
},
|
|
1462
|
-
{
|
|
1463
|
-
title: "响应",
|
|
1464
|
-
dataIndex: "response_status",
|
|
1465
|
-
key: "response_status",
|
|
1466
|
-
width: 80,
|
|
1467
|
-
render: (I) => /* @__PURE__ */ e(C, { color: I >= 400 ? "red" : "green", children: I })
|
|
1468
|
-
},
|
|
1469
|
-
{
|
|
1470
|
-
title: "耗时",
|
|
1471
|
-
dataIndex: "response_time",
|
|
1472
|
-
key: "response_time",
|
|
1473
|
-
width: 80,
|
|
1474
|
-
render: (I) => `${I || 0}ms`
|
|
1475
|
-
}
|
|
1476
|
-
],
|
|
1477
|
-
pagination: { pageSize: 10 },
|
|
1478
|
-
size: "small",
|
|
1479
|
-
rowKey: "id"
|
|
1480
|
-
}
|
|
1481
|
-
)
|
|
1482
|
-
] })
|
|
1483
|
-
}
|
|
1484
|
-
)
|
|
1485
|
-
] });
|
|
1486
|
-
}
|
|
1487
|
-
const { Text: ue } = ae, Mn = { MOCK: "green", PROXY: "blue", 404: "red", 502: "orange" };
|
|
1488
|
-
function Dn() {
|
|
1489
|
-
const [t, a] = h([]), [r, S] = h(null), [s, d] = h(!1), [l, A] = h(null), [g, x] = h(!1), [b, m] = h(""), [c, k] = h();
|
|
1490
|
-
G(() => {
|
|
1491
|
-
O();
|
|
1492
|
-
}, []);
|
|
1493
|
-
const O = async () => {
|
|
1494
|
-
d(!0);
|
|
1495
|
-
try {
|
|
1496
|
-
const [o, v] = await Promise.all([
|
|
1497
|
-
U.requestLogs.list({
|
|
1498
|
-
path: b || void 0,
|
|
1499
|
-
matched: c,
|
|
1500
|
-
limit: 100
|
|
1501
|
-
}),
|
|
1502
|
-
U.requestLogs.stats().catch(() => null)
|
|
1503
|
-
]);
|
|
1504
|
-
a(Array.isArray(o) ? o : []), S(v);
|
|
1505
|
-
} catch {
|
|
1506
|
-
w.warning("加载失败");
|
|
1507
|
-
} finally {
|
|
1508
|
-
d(!1);
|
|
1509
|
-
}
|
|
1510
|
-
}, y = (o) => {
|
|
1511
|
-
A(o), x(!0);
|
|
1512
|
-
}, I = [
|
|
1513
|
-
{
|
|
1514
|
-
title: "时间",
|
|
1515
|
-
dataIndex: "create_time",
|
|
1516
|
-
key: "create_time",
|
|
1517
|
-
width: 170,
|
|
1518
|
-
render: (o) => o ? new Date(o).toLocaleString() : "-"
|
|
1519
|
-
},
|
|
1520
|
-
{
|
|
1521
|
-
title: "环境",
|
|
1522
|
-
dataIndex: "env_code",
|
|
1523
|
-
key: "env_code",
|
|
1524
|
-
width: 100,
|
|
1525
|
-
render: (o) => /* @__PURE__ */ e(C, { children: o })
|
|
1526
|
-
},
|
|
1527
|
-
{
|
|
1528
|
-
title: "方法",
|
|
1529
|
-
dataIndex: "request_method",
|
|
1530
|
-
key: "request_method",
|
|
1531
|
-
width: 80,
|
|
1532
|
-
render: (o) => /* @__PURE__ */ e(C, { color: "blue", children: o })
|
|
1533
|
-
},
|
|
1534
|
-
{
|
|
1535
|
-
title: "路径",
|
|
1536
|
-
dataIndex: "request_path",
|
|
1537
|
-
key: "request_path",
|
|
1538
|
-
ellipsis: !0,
|
|
1539
|
-
render: (o) => /* @__PURE__ */ e(ue, { code: !0, children: o })
|
|
1540
|
-
},
|
|
1541
|
-
{
|
|
1542
|
-
title: "状态",
|
|
1543
|
-
dataIndex: "response_status",
|
|
1544
|
-
key: "response_status",
|
|
1545
|
-
width: 90,
|
|
1546
|
-
align: "center",
|
|
1547
|
-
render: (o) => o ? /* @__PURE__ */ e(C, { color: o >= 400 ? "red" : "green", children: o }) : "-"
|
|
1548
|
-
},
|
|
1549
|
-
{
|
|
1550
|
-
title: "匹配",
|
|
1551
|
-
dataIndex: "matched",
|
|
1552
|
-
key: "matched",
|
|
1553
|
-
width: 90,
|
|
1554
|
-
align: "center",
|
|
1555
|
-
render: (o) => o === 1 ? /* @__PURE__ */ e(C, { color: "green", children: "命中" }) : /* @__PURE__ */ e(C, { color: "red", children: "未匹配" })
|
|
1556
|
-
},
|
|
1557
|
-
{
|
|
1558
|
-
title: "回退",
|
|
1559
|
-
dataIndex: "fallback_type",
|
|
1560
|
-
key: "fallback_type",
|
|
1561
|
-
width: 100,
|
|
1562
|
-
render: (o) => o ? /* @__PURE__ */ e(C, { color: Mn[o], children: o }) : "-"
|
|
1563
|
-
},
|
|
1564
|
-
{
|
|
1565
|
-
title: "耗时",
|
|
1566
|
-
dataIndex: "duration_ms",
|
|
1567
|
-
key: "duration_ms",
|
|
1568
|
-
width: 80,
|
|
1569
|
-
align: "center",
|
|
1570
|
-
render: (o) => `${o || 0}ms`
|
|
1571
|
-
},
|
|
1572
|
-
{
|
|
1573
|
-
title: "Mock",
|
|
1574
|
-
dataIndex: "mock_code",
|
|
1575
|
-
key: "mock_code",
|
|
1576
|
-
width: 160,
|
|
1577
|
-
ellipsis: !0,
|
|
1578
|
-
render: (o) => o ? /* @__PURE__ */ e(ue, { code: !0, children: o }) : "-"
|
|
1579
|
-
},
|
|
1580
|
-
{
|
|
1581
|
-
title: "操作",
|
|
1582
|
-
key: "action",
|
|
1583
|
-
width: 80,
|
|
1584
|
-
render: (o, v) => /* @__PURE__ */ e(
|
|
1585
|
-
E,
|
|
1586
|
-
{
|
|
1587
|
-
size: "small",
|
|
1588
|
-
type: "link",
|
|
1589
|
-
icon: /* @__PURE__ */ e(Bt, {}),
|
|
1590
|
-
onClick: () => y(v),
|
|
1591
|
-
children: "详情"
|
|
1592
|
-
}
|
|
1593
|
-
)
|
|
1594
|
-
}
|
|
1595
|
-
];
|
|
1596
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
1597
|
-
/* @__PURE__ */ e(
|
|
1598
|
-
W,
|
|
1599
|
-
{
|
|
1600
|
-
type: "info",
|
|
1601
|
-
showIcon: !0,
|
|
1602
|
-
style: { marginBottom: 16 },
|
|
1603
|
-
title: "Mock 请求日志 - 排查未匹配请求",
|
|
1604
|
-
description: "每一次请求都会留痕。包括请求/响应体、是否匹配 Mock、回退类型、耗时、场景状态等。便于排查“为什么这个请求没有 Mock 命中”问题。"
|
|
1605
|
-
}
|
|
1606
|
-
),
|
|
1607
|
-
r && /* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
1608
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(H, { title: "总请求数", value: r.total || 0 }) }) }),
|
|
1609
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1610
|
-
H,
|
|
1611
|
-
{
|
|
1612
|
-
title: "Mock 命中",
|
|
1613
|
-
value: r.matched || 0,
|
|
1614
|
-
styles: { content: { color: "#52c41a" } }
|
|
1615
|
-
}
|
|
1616
|
-
) }) }),
|
|
1617
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1618
|
-
H,
|
|
1619
|
-
{
|
|
1620
|
-
title: "未匹配",
|
|
1621
|
-
value: r.unmatched || 0,
|
|
1622
|
-
styles: { content: { color: "#ff4d4f" } }
|
|
1623
|
-
}
|
|
1624
|
-
) }) }),
|
|
1625
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
1626
|
-
H,
|
|
1627
|
-
{
|
|
1628
|
-
title: "命中率",
|
|
1629
|
-
value: `${r.total > 0 ? Math.round(r.matched / r.total * 100) : 0}%`
|
|
1630
|
-
}
|
|
1631
|
-
) }) })
|
|
1632
|
-
] }),
|
|
1633
|
-
/* @__PURE__ */ n(R, { style: { marginBottom: 16 }, children: [
|
|
1634
|
-
/* @__PURE__ */ e(
|
|
1635
|
-
N,
|
|
1636
|
-
{
|
|
1637
|
-
placeholder: "搜索路径",
|
|
1638
|
-
prefix: /* @__PURE__ */ e(xt, {}),
|
|
1639
|
-
allowClear: !0,
|
|
1640
|
-
style: { width: 240 },
|
|
1641
|
-
value: b,
|
|
1642
|
-
onChange: (o) => m(o.target.value),
|
|
1643
|
-
onPressEnter: O
|
|
1644
|
-
}
|
|
1645
|
-
),
|
|
1646
|
-
/* @__PURE__ */ e(
|
|
1647
|
-
Z,
|
|
1648
|
-
{
|
|
1649
|
-
placeholder: "匹配状态",
|
|
1650
|
-
allowClear: !0,
|
|
1651
|
-
style: { width: 140 },
|
|
1652
|
-
value: c,
|
|
1653
|
-
onChange: k,
|
|
1654
|
-
options: [
|
|
1655
|
-
{ value: 1, label: "已命中" },
|
|
1656
|
-
{ value: 0, label: "未匹配" }
|
|
1657
|
-
]
|
|
1658
|
-
}
|
|
1659
|
-
),
|
|
1660
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: O, children: "查询" })
|
|
1661
|
-
] }),
|
|
1662
|
-
/* @__PURE__ */ e(
|
|
1663
|
-
Q,
|
|
1664
|
-
{
|
|
1665
|
-
dataSource: t,
|
|
1666
|
-
columns: I,
|
|
1667
|
-
rowKey: "id",
|
|
1668
|
-
loading: s,
|
|
1669
|
-
pagination: { pageSize: 20 },
|
|
1670
|
-
scroll: { x: 1300 },
|
|
1671
|
-
size: "small"
|
|
1672
|
-
}
|
|
1673
|
-
),
|
|
1674
|
-
/* @__PURE__ */ e(
|
|
1675
|
-
Ie,
|
|
1676
|
-
{
|
|
1677
|
-
title: "请求详情",
|
|
1678
|
-
open: g,
|
|
1679
|
-
onClose: () => x(!1),
|
|
1680
|
-
size: "large",
|
|
1681
|
-
children: l && /* @__PURE__ */ n("div", { children: [
|
|
1682
|
-
/* @__PURE__ */ n(z, { column: 2, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
1683
|
-
/* @__PURE__ */ e(z.Item, { label: "环境", children: l.env_code }),
|
|
1684
|
-
/* @__PURE__ */ e(z.Item, { label: "方法", children: /* @__PURE__ */ e(
|
|
1685
|
-
C,
|
|
1686
|
-
{
|
|
1687
|
-
color: "blue",
|
|
1688
|
-
children: l.request_method
|
|
1689
|
-
}
|
|
1690
|
-
) }),
|
|
1691
|
-
/* @__PURE__ */ e(z.Item, { label: "路径", span: 2, children: /* @__PURE__ */ e(
|
|
1692
|
-
ue,
|
|
1693
|
-
{
|
|
1694
|
-
code: !0,
|
|
1695
|
-
children: l.request_path
|
|
1696
|
-
}
|
|
1697
|
-
) }),
|
|
1698
|
-
/* @__PURE__ */ e(z.Item, { label: "状态码", children: /* @__PURE__ */ e(
|
|
1699
|
-
C,
|
|
1700
|
-
{
|
|
1701
|
-
color: l.response_status >= 400 ? "red" : "green",
|
|
1702
|
-
children: l.response_status
|
|
1703
|
-
}
|
|
1704
|
-
) }),
|
|
1705
|
-
/* @__PURE__ */ n(z.Item, { label: "耗时", children: [
|
|
1706
|
-
l.duration_ms,
|
|
1707
|
-
"ms"
|
|
1708
|
-
] }),
|
|
1709
|
-
/* @__PURE__ */ e(z.Item, { label: "匹配", children: l.matched === 1 ? /* @__PURE__ */ e(C, { color: "green", children: "命中" }) : /* @__PURE__ */ e(C, { color: "red", children: "未匹配" }) }),
|
|
1710
|
-
/* @__PURE__ */ e(z.Item, { label: "回退", children: l.fallback_type || "-" }),
|
|
1711
|
-
/* @__PURE__ */ e(z.Item, { label: "Mock", span: 2, children: l.mock_code || "-" }),
|
|
1712
|
-
/* @__PURE__ */ e(
|
|
1713
|
-
z.Item,
|
|
1714
|
-
{
|
|
1715
|
-
label: "场景状态",
|
|
1716
|
-
span: 2,
|
|
1717
|
-
children: l.scenario_state || "-"
|
|
1718
|
-
}
|
|
1719
|
-
),
|
|
1720
|
-
/* @__PURE__ */ e(z.Item, { label: "客户端 IP", children: l.client_ip || "-" }),
|
|
1721
|
-
/* @__PURE__ */ e(z.Item, { label: "User-Agent", ellipsis: !0, children: l.user_agent || "-" }),
|
|
1722
|
-
/* @__PURE__ */ e(z.Item, { label: "时间", span: 2, children: l.create_time ? new Date(l.create_time).toLocaleString() : "-" })
|
|
1723
|
-
] }),
|
|
1724
|
-
/* @__PURE__ */ e(ue, { strong: !0, children: "请求头:" }),
|
|
1725
|
-
/* @__PURE__ */ e("pre", { style: {
|
|
1726
|
-
background: "#f5f5f5",
|
|
1727
|
-
padding: 12,
|
|
1728
|
-
borderRadius: 4,
|
|
1729
|
-
maxHeight: 150,
|
|
1730
|
-
overflow: "auto",
|
|
1731
|
-
fontSize: 12,
|
|
1732
|
-
fontFamily: "monospace",
|
|
1733
|
-
whiteSpace: "pre-wrap"
|
|
1734
|
-
}, children: l.request_headers || "(无)" }),
|
|
1735
|
-
/* @__PURE__ */ e(ue, { strong: !0, style: { marginTop: 12, display: "block" }, children: "请求体:" }),
|
|
1736
|
-
/* @__PURE__ */ e("pre", { style: {
|
|
1737
|
-
background: "#f5f5f5",
|
|
1738
|
-
padding: 12,
|
|
1739
|
-
borderRadius: 4,
|
|
1740
|
-
maxHeight: 200,
|
|
1741
|
-
overflow: "auto",
|
|
1742
|
-
fontSize: 12,
|
|
1743
|
-
fontFamily: "monospace",
|
|
1744
|
-
whiteSpace: "pre-wrap",
|
|
1745
|
-
wordBreak: "break-all"
|
|
1746
|
-
}, children: l.request_body || "(无)" }),
|
|
1747
|
-
/* @__PURE__ */ e(ue, { strong: !0, style: { marginTop: 12, display: "block" }, children: "响应体:" }),
|
|
1748
|
-
/* @__PURE__ */ e("pre", { style: {
|
|
1749
|
-
background: "#f5f5f5",
|
|
1750
|
-
padding: 12,
|
|
1751
|
-
borderRadius: 4,
|
|
1752
|
-
maxHeight: 300,
|
|
1753
|
-
overflow: "auto",
|
|
1754
|
-
fontSize: 12,
|
|
1755
|
-
fontFamily: "monospace",
|
|
1756
|
-
whiteSpace: "pre-wrap",
|
|
1757
|
-
wordBreak: "break-all"
|
|
1758
|
-
}, children: l.response_body || "(无)" })
|
|
1759
|
-
] })
|
|
1760
|
-
}
|
|
1761
|
-
)
|
|
1762
|
-
] });
|
|
1763
|
-
}
|
|
1764
|
-
const { Text: te } = ae, lt = [
|
|
1765
|
-
{ key: "endpoints", label: "Mock 端点", component: Fe },
|
|
1766
|
-
{ key: "environments", label: "环境 (MOCK/REAL/MIXED)", component: Ke },
|
|
1767
|
-
{ key: "scenarios", label: "场景状态机", component: Rn },
|
|
1768
|
-
{ key: "cases", label: "测试用例", component: On },
|
|
1769
|
-
{ key: "recordings", label: "录制回放", component: Ln },
|
|
1770
|
-
{ key: "request-logs", label: "请求日志", component: Dn }
|
|
1771
|
-
];
|
|
1772
|
-
function $n() {
|
|
1773
|
-
var b;
|
|
1774
|
-
const [t, a] = h("endpoints"), [r, S] = h([]), [s, d] = h("default"), [l, A] = h(null);
|
|
1775
|
-
G(() => {
|
|
1776
|
-
g(), x();
|
|
1777
|
-
}, []);
|
|
1778
|
-
const g = async () => {
|
|
1779
|
-
try {
|
|
1780
|
-
const m = await U.environments.list(), c = Array.isArray(m) ? m : [];
|
|
1781
|
-
if (S(c), c.length > 0 && !c.find((k) => k.env_code === s)) {
|
|
1782
|
-
const k = c.find((O) => O.is_default === 1) || c[0];
|
|
1783
|
-
d(k.env_code);
|
|
1784
|
-
}
|
|
1785
|
-
} catch {
|
|
1786
|
-
}
|
|
1787
|
-
}, x = async () => {
|
|
1788
|
-
try {
|
|
1789
|
-
const m = await U.stats();
|
|
1790
|
-
A(m);
|
|
1791
|
-
} catch {
|
|
1792
|
-
}
|
|
1793
|
-
};
|
|
1794
|
-
return (b = lt.find((m) => m.key === t)) == null || b.component, /* @__PURE__ */ n("div", { children: [
|
|
1795
|
-
/* @__PURE__ */ e(
|
|
1796
|
-
ye,
|
|
1797
|
-
{
|
|
1798
|
-
title: "Mock 平台",
|
|
1799
|
-
subtitle: "WireMock 级 · Mock 端点管理、环境隔离、场景状态机、测试用例库、录制回放、请求日志"
|
|
1800
|
-
}
|
|
1801
|
-
),
|
|
1802
|
-
/* @__PURE__ */ e(
|
|
1803
|
-
Se,
|
|
1804
|
-
{
|
|
1805
|
-
activeKey: t,
|
|
1806
|
-
onChange: a,
|
|
1807
|
-
type: "card",
|
|
1808
|
-
tabBarExtraContent: /* @__PURE__ */ n(R, { size: "large", wrap: !0, children: [
|
|
1809
|
-
/* @__PURE__ */ n(R, { children: [
|
|
1810
|
-
/* @__PURE__ */ e(wt, {}),
|
|
1811
|
-
/* @__PURE__ */ e(te, { children: "当前环境:" }),
|
|
1812
|
-
/* @__PURE__ */ e(
|
|
1813
|
-
Z,
|
|
1814
|
-
{
|
|
1815
|
-
value: s,
|
|
1816
|
-
onChange: d,
|
|
1817
|
-
style: { width: 200 },
|
|
1818
|
-
options: r.map((m) => ({
|
|
1819
|
-
value: m.env_code,
|
|
1820
|
-
label: `${m.env_name || m.env_code} (${m.env_type})`
|
|
1821
|
-
}))
|
|
1822
|
-
}
|
|
1823
|
-
)
|
|
1824
|
-
] }),
|
|
1825
|
-
l && /* @__PURE__ */ n(R, { size: "large", children: [
|
|
1826
|
-
/* @__PURE__ */ n(te, { type: "secondary", children: [
|
|
1827
|
-
"端点: ",
|
|
1828
|
-
/* @__PURE__ */ e(te, { strong: !0, children: l.totalEndpoints })
|
|
1829
|
-
] }),
|
|
1830
|
-
/* @__PURE__ */ n(te, { type: "secondary", children: [
|
|
1831
|
-
"启用: ",
|
|
1832
|
-
/* @__PURE__ */ e(
|
|
1833
|
-
te,
|
|
1834
|
-
{
|
|
1835
|
-
strong: !0,
|
|
1836
|
-
style: { color: "#52c41a" },
|
|
1837
|
-
children: l.activeEndpoints
|
|
1838
|
-
}
|
|
1839
|
-
)
|
|
1840
|
-
] }),
|
|
1841
|
-
/* @__PURE__ */ n(te, { type: "secondary", children: [
|
|
1842
|
-
"场景: ",
|
|
1843
|
-
/* @__PURE__ */ e(te, { strong: !0, children: l.totalScenarios })
|
|
1844
|
-
] }),
|
|
1845
|
-
/* @__PURE__ */ n(te, { type: "secondary", children: [
|
|
1846
|
-
"用例: ",
|
|
1847
|
-
/* @__PURE__ */ e(te, { strong: !0, children: l.totalCases })
|
|
1848
|
-
] })
|
|
1849
|
-
] }),
|
|
1850
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: () => {
|
|
1851
|
-
g(), x();
|
|
1852
|
-
}, children: "刷新" })
|
|
1853
|
-
] }),
|
|
1854
|
-
items: lt.map((m) => ({
|
|
1855
|
-
key: m.key,
|
|
1856
|
-
label: m.label,
|
|
1857
|
-
children: m.component === Fe ? /* @__PURE__ */ e(Fe, { activeEnvCode: s }) : m.component === Ke ? /* @__PURE__ */ e(Ke, { onEnvChange: (c) => {
|
|
1858
|
-
d(c), w.success(`已切换到环境: ${c}`);
|
|
1859
|
-
} }) : /* @__PURE__ */ e(m.component, {})
|
|
1860
|
-
}))
|
|
1861
|
-
}
|
|
1862
|
-
)
|
|
1863
|
-
] });
|
|
1864
|
-
}
|
|
1865
|
-
const br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1866
|
-
__proto__: null,
|
|
1867
|
-
default: $n
|
|
1868
|
-
}, Symbol.toStringTag, { value: "Module" })), { Text: ge, Paragraph: wr } = ae, ot = [
|
|
1869
|
-
{
|
|
1870
|
-
group: "基础数据",
|
|
1871
|
-
icon: /* @__PURE__ */ e(fe, {}),
|
|
1872
|
-
items: [
|
|
1873
|
-
{ syntax: "@uuid", desc: "随机 UUID", example: "a3f2e1b7-8c4d-4e6f-9a1b-2c3d4e5f6a7b" },
|
|
1874
|
-
{ syntax: "@int(1, 100)", desc: "随机整数(含边界)", example: "42" },
|
|
1875
|
-
{ syntax: "@int", desc: "随机整数(0-1000)", example: "731" },
|
|
1876
|
-
{ syntax: "@boolean", desc: "随机布尔", example: "true" },
|
|
1877
|
-
{ syntax: '@pick("a","b","c")', desc: "从列表随机取一项", example: '"b"' }
|
|
1878
|
-
]
|
|
1879
|
-
},
|
|
1880
|
-
{
|
|
1881
|
-
group: "时间相关",
|
|
1882
|
-
icon: /* @__PURE__ */ e(Te, {}),
|
|
1883
|
-
items: [
|
|
1884
|
-
{ syntax: "@datetime", desc: "当前时间 (yyyy-MM-dd HH:mm:ss)", example: "2026-06-17 22:30:15" },
|
|
1885
|
-
{ syntax: "@date", desc: "当前日期 (yyyy-MM-dd)", example: "2026-06-17" },
|
|
1886
|
-
{ syntax: "@time", desc: "当前时间戳 (毫秒)", example: "1718639415000" },
|
|
1887
|
-
{ syntax: "@timestamp", desc: "Unix 秒级时间戳", example: "1718639415" }
|
|
1888
|
-
]
|
|
1889
|
-
},
|
|
1890
|
-
{
|
|
1891
|
-
group: "文本生成",
|
|
1892
|
-
icon: /* @__PURE__ */ e(Te, {}),
|
|
1893
|
-
items: [
|
|
1894
|
-
{ syntax: "@name", desc: "随机中文姓名", example: "张伟" },
|
|
1895
|
-
{ syntax: "@firstName", desc: "随机名", example: "伟" },
|
|
1896
|
-
{ syntax: "@lastName", desc: "随机姓", example: "张" },
|
|
1897
|
-
{ syntax: "@email", desc: "随机邮箱", example: "zhangwei@example.com" },
|
|
1898
|
-
{ syntax: "@phone", desc: "随机手机号(中国)", example: "13812345678" },
|
|
1899
|
-
{ syntax: "@idCard", desc: "随机身份证号", example: "110101199003078234" },
|
|
1900
|
-
{ syntax: "@word", desc: "随机英文单词", example: "horizon" },
|
|
1901
|
-
{ syntax: "@sentence(5, 10)", desc: "随机句子 (5-10 词)", example: "The quick brown fox jumps." },
|
|
1902
|
-
{ syntax: "@paragraph(3, 5)", desc: "随机段落 (3-5 句)", example: "..." }
|
|
1903
|
-
]
|
|
1904
|
-
},
|
|
1905
|
-
{
|
|
1906
|
-
group: "序列与状态",
|
|
1907
|
-
icon: /* @__PURE__ */ e(Te, {}),
|
|
1908
|
-
items: [
|
|
1909
|
-
{ syntax: "@sequence(1)", desc: "自增序号(每次调用 +1,1 起始)", example: "1, 2, 3, ..." },
|
|
1910
|
-
{ syntax: "@sequence(100, 5)", desc: "自增序号(100 起始,步长 5)", example: "100, 105, 110, ..." }
|
|
1911
|
-
]
|
|
1912
|
-
},
|
|
1913
|
-
{
|
|
1914
|
-
group: "请求上下文",
|
|
1915
|
-
icon: /* @__PURE__ */ e(Te, {}),
|
|
1916
|
-
items: [
|
|
1917
|
-
{ syntax: "#path.id", desc: "从 URL 路径取值 /users/123 → 123", example: "123" },
|
|
1918
|
-
{ syntax: "#query.page", desc: "从 query string 取值 ?page=2", example: "2" },
|
|
1919
|
-
{ syntax: "#header.X-Token", desc: "从请求头取值", example: "abc.def.ghi" },
|
|
1920
|
-
{ syntax: "#body.username", desc: "从请求体 JSON 取值", example: '"alice"' }
|
|
1921
|
-
]
|
|
1922
|
-
}
|
|
1923
|
-
];
|
|
1924
|
-
function xr({ onInsert: t, form: a, formField: r = "responseTemplate" }) {
|
|
1925
|
-
const [S, s] = h(""), d = (m) => {
|
|
1926
|
-
var c;
|
|
1927
|
-
try {
|
|
1928
|
-
(c = navigator.clipboard) == null || c.writeText(m);
|
|
1929
|
-
} catch {
|
|
1930
|
-
}
|
|
1931
|
-
if (t)
|
|
1932
|
-
t(m);
|
|
1933
|
-
else if (a) {
|
|
1934
|
-
const k = a.getFieldValue(r) || "";
|
|
1935
|
-
a.setFieldsValue({ [r]: k + (k.endsWith(`
|
|
1936
|
-
`) || !k ? "" : " ") + m });
|
|
1937
|
-
}
|
|
1938
|
-
w.success(`已插入: ${m}`);
|
|
1939
|
-
}, l = (m) => {
|
|
1940
|
-
var c;
|
|
1941
|
-
try {
|
|
1942
|
-
(c = navigator.clipboard) == null || c.writeText(m), w.success("已复制到剪贴板");
|
|
1943
|
-
} catch {
|
|
1944
|
-
w.warning("复制失败,请手动选择");
|
|
1945
|
-
}
|
|
1946
|
-
}, A = S.toLowerCase(), g = ot.map((m) => ({
|
|
1947
|
-
...m,
|
|
1948
|
-
items: m.items.filter(
|
|
1949
|
-
(c) => !A || c.syntax.toLowerCase().includes(A) || c.desc.toLowerCase().includes(A) || c.example.toLowerCase().includes(A)
|
|
1950
|
-
)
|
|
1951
|
-
})).filter((m) => m.items.length > 0), x = ot.reduce((m, c) => m + c.items.length, 0), b = g.reduce((m, c) => m + c.items.length, 0);
|
|
1952
|
-
return /* @__PURE__ */ n(
|
|
1953
|
-
$,
|
|
1954
|
-
{
|
|
1955
|
-
size: "small",
|
|
1956
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
1957
|
-
/* @__PURE__ */ e(fe, {}),
|
|
1958
|
-
/* @__PURE__ */ e(ge, { strong: !0, children: "模板表达式" }),
|
|
1959
|
-
/* @__PURE__ */ n(C, { color: "blue", children: [
|
|
1960
|
-
b,
|
|
1961
|
-
"/",
|
|
1962
|
-
x
|
|
1963
|
-
] }),
|
|
1964
|
-
/* @__PURE__ */ e(he, { title: "点击按钮即可插入到上方响应模板;点击 syntax 文本可复制", children: /* @__PURE__ */ e(jt, { style: { color: "#999" } }) })
|
|
1965
|
-
] }),
|
|
1966
|
-
extra: /* @__PURE__ */ e(
|
|
1967
|
-
N,
|
|
1968
|
-
{
|
|
1969
|
-
size: "small",
|
|
1970
|
-
placeholder: "搜索 @ 表达式",
|
|
1971
|
-
prefix: /* @__PURE__ */ e(xt, {}),
|
|
1972
|
-
value: S,
|
|
1973
|
-
onChange: (m) => s(m.target.value),
|
|
1974
|
-
style: { width: 180 },
|
|
1975
|
-
allowClear: !0
|
|
1976
|
-
}
|
|
1977
|
-
),
|
|
1978
|
-
style: { marginTop: 8, background: "#fafafa" },
|
|
1979
|
-
styles: { body: { padding: 12, maxHeight: 320, overflow: "auto" } },
|
|
1980
|
-
children: [
|
|
1981
|
-
g.length === 0 && /* @__PURE__ */ e(ge, { type: "secondary", style: { display: "block", textAlign: "center", padding: 16 }, children: "没有匹配的表达式" }),
|
|
1982
|
-
g.map((m) => /* @__PURE__ */ n("div", { style: { marginBottom: 12 }, children: [
|
|
1983
|
-
/* @__PURE__ */ n(R, { size: 4, style: { marginBottom: 6 }, children: [
|
|
1984
|
-
m.icon,
|
|
1985
|
-
/* @__PURE__ */ e(ge, { strong: !0, style: { fontSize: 13 }, children: m.group }),
|
|
1986
|
-
/* @__PURE__ */ e(C, { children: m.items.length })
|
|
1987
|
-
] }),
|
|
1988
|
-
/* @__PURE__ */ e(Y, { gutter: [8, 8], children: m.items.map((c) => /* @__PURE__ */ e(M, { span: 24, children: /* @__PURE__ */ n(
|
|
1989
|
-
"div",
|
|
1990
|
-
{
|
|
1991
|
-
style: {
|
|
1992
|
-
display: "flex",
|
|
1993
|
-
alignItems: "center",
|
|
1994
|
-
padding: "6px 8px",
|
|
1995
|
-
background: "#fff",
|
|
1996
|
-
border: "1px solid #f0f0f0",
|
|
1997
|
-
borderRadius: 4,
|
|
1998
|
-
gap: 8
|
|
1999
|
-
},
|
|
2000
|
-
children: [
|
|
2001
|
-
/* @__PURE__ */ e(he, { title: "点击复制", children: /* @__PURE__ */ e(
|
|
2002
|
-
ge,
|
|
2003
|
-
{
|
|
2004
|
-
code: !0,
|
|
2005
|
-
style: { cursor: "pointer", minWidth: 140, fontSize: 12 },
|
|
2006
|
-
onClick: () => l(c.syntax),
|
|
2007
|
-
children: c.syntax
|
|
2008
|
-
}
|
|
2009
|
-
) }),
|
|
2010
|
-
/* @__PURE__ */ e(ge, { type: "secondary", style: { fontSize: 12, flex: 1 }, children: c.desc }),
|
|
2011
|
-
/* @__PURE__ */ e(C, { color: "default", style: { margin: 0, fontFamily: "monospace" }, children: c.example }),
|
|
2012
|
-
/* @__PURE__ */ e(he, { title: "插入到响应模板", children: /* @__PURE__ */ e(
|
|
2013
|
-
E,
|
|
2014
|
-
{
|
|
2015
|
-
size: "small",
|
|
2016
|
-
type: "text",
|
|
2017
|
-
icon: /* @__PURE__ */ e(bt, {}),
|
|
2018
|
-
onClick: () => d(c.syntax)
|
|
2019
|
-
}
|
|
2020
|
-
) })
|
|
2021
|
-
]
|
|
2022
|
-
}
|
|
2023
|
-
) }, c.syntax)) })
|
|
2024
|
-
] }, m.group))
|
|
2025
|
-
]
|
|
2026
|
-
}
|
|
2027
|
-
);
|
|
2028
|
-
}
|
|
2029
|
-
const { TextArea: it } = N, { Text: pe, Paragraph: Nn } = ae;
|
|
2030
|
-
function kr({ open: t, onClose: a, onSuccess: r, envOptions: S = [] }) {
|
|
2031
|
-
const [s, d] = h(""), [l, A] = h(null), [g, x] = h(null), [b, m] = h(!1), [c, k] = h(null), [O, y] = h(!1), [I, o] = h("import"), [v] = P.useForm(), [u] = P.useForm(), _ = () => {
|
|
2032
|
-
d(""), A(null), x(null), k(null), v.resetFields(), u.resetFields();
|
|
2033
|
-
}, f = () => {
|
|
2034
|
-
_(), a();
|
|
2035
|
-
}, D = async () => {
|
|
2036
|
-
var L, T, j, V;
|
|
2037
|
-
if (!s.trim()) {
|
|
2038
|
-
w.warning("请先粘贴 curl 命令");
|
|
2039
|
-
return;
|
|
2040
|
-
}
|
|
2041
|
-
x(null), A(null), k(null);
|
|
2042
|
-
try {
|
|
2043
|
-
const q = await U.curl.parse(s);
|
|
2044
|
-
q.success ? (A(q.data), v.setFieldsValue({
|
|
2045
|
-
caseName: `from-curl-${((L = q.data) == null ? void 0 : L.method) || "GET"}-${(((T = q.data) == null ? void 0 : T.path) || "").replace(/\W+/g, "-")}`,
|
|
2046
|
-
caseGroup: "imported",
|
|
2047
|
-
envCode: S[0] || "default"
|
|
2048
|
-
}), u.setFieldsValue({
|
|
2049
|
-
mockName: `mock-${((j = q.data) == null ? void 0 : j.method) || "GET"}-${(((V = q.data) == null ? void 0 : V.path) || "").replace(/\W+/g, "-")}`,
|
|
2050
|
-
envCode: S[0] || "default",
|
|
2051
|
-
projectCode: "default",
|
|
2052
|
-
responseTemplate: `{
|
|
2053
|
-
"code": 0,
|
|
2054
|
-
"message": "ok",
|
|
2055
|
-
"data": {}
|
|
2056
|
-
}`
|
|
2057
|
-
})) : x(q.message || "解析失败");
|
|
2058
|
-
} catch (q) {
|
|
2059
|
-
x(String((q == null ? void 0 : q.message) || q));
|
|
2060
|
-
}
|
|
2061
|
-
}, K = async () => {
|
|
2062
|
-
if (!s.trim()) {
|
|
2063
|
-
w.warning("请先粘贴 curl 命令");
|
|
2064
|
-
return;
|
|
2065
|
-
}
|
|
2066
|
-
m(!0), k(null);
|
|
2067
|
-
try {
|
|
2068
|
-
const L = await U.curl.run(s);
|
|
2069
|
-
k(L);
|
|
2070
|
-
} catch (L) {
|
|
2071
|
-
k({ success: !1, error: String((L == null ? void 0 : L.message) || L) });
|
|
2072
|
-
} finally {
|
|
2073
|
-
m(!1);
|
|
2074
|
-
}
|
|
2075
|
-
}, p = async () => {
|
|
2076
|
-
if (!l) {
|
|
2077
|
-
w.warning("请先解析");
|
|
2078
|
-
return;
|
|
2079
|
-
}
|
|
2080
|
-
let L;
|
|
2081
|
-
try {
|
|
2082
|
-
L = await v.validateFields();
|
|
2083
|
-
} catch {
|
|
2084
|
-
return;
|
|
2085
|
-
}
|
|
2086
|
-
y(!0);
|
|
2087
|
-
try {
|
|
2088
|
-
const T = await U.curl.importAsCase({
|
|
2089
|
-
curl: s,
|
|
2090
|
-
caseName: L.caseName,
|
|
2091
|
-
caseGroup: L.caseGroup,
|
|
2092
|
-
envCode: L.envCode
|
|
2093
|
-
});
|
|
2094
|
-
T.success ? (w.success(`已导入测试用例: ${T.caseCode}`), r && r("case", T), f()) : w.error(T.message || "导入失败");
|
|
2095
|
-
} catch (T) {
|
|
2096
|
-
w.error(String((T == null ? void 0 : T.message) || T));
|
|
2097
|
-
} finally {
|
|
2098
|
-
y(!1);
|
|
2099
|
-
}
|
|
2100
|
-
}, i = async () => {
|
|
2101
|
-
if (!l) {
|
|
2102
|
-
w.warning("请先解析");
|
|
2103
|
-
return;
|
|
2104
|
-
}
|
|
2105
|
-
let L;
|
|
2106
|
-
try {
|
|
2107
|
-
L = await u.validateFields();
|
|
2108
|
-
} catch {
|
|
2109
|
-
return;
|
|
2110
|
-
}
|
|
2111
|
-
y(!0);
|
|
2112
|
-
try {
|
|
2113
|
-
const T = await U.curl.importAsEndpoint({
|
|
2114
|
-
curl: s,
|
|
2115
|
-
mockName: L.mockName,
|
|
2116
|
-
envCode: L.envCode,
|
|
2117
|
-
projectCode: L.projectCode,
|
|
2118
|
-
responseTemplate: L.responseTemplate
|
|
2119
|
-
});
|
|
2120
|
-
T.success ? (w.success(`已导入 Mock 端点: ${T.mockCode}`), r && r("endpoint", T), f()) : w.error(T.message || "导入失败");
|
|
2121
|
-
} catch (T) {
|
|
2122
|
-
w.error(String((T == null ? void 0 : T.message) || T));
|
|
2123
|
-
} finally {
|
|
2124
|
-
y(!1);
|
|
2125
|
-
}
|
|
2126
|
-
};
|
|
2127
|
-
return /* @__PURE__ */ n(
|
|
2128
|
-
me,
|
|
2129
|
-
{
|
|
2130
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
2131
|
-
/* @__PURE__ */ e(fe, {}),
|
|
2132
|
-
" 粘贴 curl 一键导入"
|
|
2133
|
-
] }),
|
|
2134
|
-
open: t,
|
|
2135
|
-
onCancel: f,
|
|
2136
|
-
footer: null,
|
|
2137
|
-
size: "large",
|
|
2138
|
-
destroyOnHidden: !0,
|
|
2139
|
-
children: [
|
|
2140
|
-
/* @__PURE__ */ e(Nn, { type: "secondary", style: { marginBottom: 12 }, children: "从浏览器 DevTools / Postman / 终端复制 curl 命令,粘贴到下方即可解析、试跑、入库。" }),
|
|
2141
|
-
/* @__PURE__ */ e(
|
|
2142
|
-
it,
|
|
2143
|
-
{
|
|
2144
|
-
value: s,
|
|
2145
|
-
onChange: (L) => d(L.target.value),
|
|
2146
|
-
placeholder: `curl -X POST 'https://api.example.com/v1/users/login' \\
|
|
2147
|
-
-H 'Content-Type: application/json' \\
|
|
2148
|
-
-H 'Authorization: Bearer xxx' \\
|
|
2149
|
-
-d '{"username":"alice","password":"<your-password>"}'`,
|
|
2150
|
-
autoSize: { minRows: 4, maxRows: 10 },
|
|
2151
|
-
style: { fontFamily: "Menlo, Monaco, monospace", fontSize: 12 }
|
|
2152
|
-
}
|
|
2153
|
-
),
|
|
2154
|
-
/* @__PURE__ */ n(R, { style: { marginTop: 12 }, children: [
|
|
2155
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(Xe, {}), onClick: D, type: "primary", ghost: !0, children: "解析" }),
|
|
2156
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(be, {}), onClick: K, loading: b, children: "直接执行(试跑)" })
|
|
2157
|
-
] }),
|
|
2158
|
-
g && /* @__PURE__ */ e(W, { type: "error", showIcon: !0, style: { marginTop: 12 }, title: "解析失败", description: g }),
|
|
2159
|
-
l && /* @__PURE__ */ e($, { size: "small", style: { marginTop: 16 }, title: "解析结果", children: /* @__PURE__ */ n(z, { column: 1, size: "small", bordered: !0, children: [
|
|
2160
|
-
/* @__PURE__ */ e(z.Item, { label: "Method", children: /* @__PURE__ */ e(C, { color: Bn(l.method), children: l.method }) }),
|
|
2161
|
-
/* @__PURE__ */ e(z.Item, { label: "URL", children: /* @__PURE__ */ e(pe, { code: !0, copyable: !0, children: l.url }) }),
|
|
2162
|
-
/* @__PURE__ */ e(z.Item, { label: "Path", children: /* @__PURE__ */ e(pe, { code: !0, children: l.path }) }),
|
|
2163
|
-
l.query && /* @__PURE__ */ e(z.Item, { label: "Query", children: /* @__PURE__ */ e(pe, { code: !0, children: l.query }) }),
|
|
2164
|
-
/* @__PURE__ */ e(z.Item, { label: "Headers", children: Object.keys(l.headers || {}).length === 0 ? /* @__PURE__ */ e(pe, { type: "secondary", children: "(无)" }) : /* @__PURE__ */ e("div", { children: Object.entries(l.headers).map(([L, T]) => /* @__PURE__ */ n("div", { children: [
|
|
2165
|
-
/* @__PURE__ */ n(pe, { strong: !0, children: [
|
|
2166
|
-
L,
|
|
2167
|
-
":"
|
|
2168
|
-
] }),
|
|
2169
|
-
" ",
|
|
2170
|
-
/* @__PURE__ */ e(pe, { code: !0, children: T })
|
|
2171
|
-
] }, L)) }) }),
|
|
2172
|
-
l.body && /* @__PURE__ */ e(z.Item, { label: "Body", children: /* @__PURE__ */ e("pre", { style: {
|
|
2173
|
-
background: "#f5f5f5",
|
|
2174
|
-
padding: 8,
|
|
2175
|
-
margin: 0,
|
|
2176
|
-
fontSize: 12,
|
|
2177
|
-
maxHeight: 200,
|
|
2178
|
-
overflow: "auto"
|
|
2179
|
-
}, children: l.body }) })
|
|
2180
|
-
] }) }),
|
|
2181
|
-
c && /* @__PURE__ */ n($, { size: "small", style: { marginTop: 16 }, title: /* @__PURE__ */ n(R, { children: [
|
|
2182
|
-
/* @__PURE__ */ e(be, {}),
|
|
2183
|
-
/* @__PURE__ */ e("span", { children: "试跑结果" }),
|
|
2184
|
-
c.success ? /* @__PURE__ */ n(C, { color: "green", children: [
|
|
2185
|
-
c.status,
|
|
2186
|
-
" · ",
|
|
2187
|
-
c.durationMs,
|
|
2188
|
-
"ms · ",
|
|
2189
|
-
c.bodySize,
|
|
2190
|
-
"B"
|
|
2191
|
-
] }) : /* @__PURE__ */ e(C, { color: "red", children: "FAILED" })
|
|
2192
|
-
] }), children: [
|
|
2193
|
-
c.error && /* @__PURE__ */ e(W, { type: "error", showIcon: !0, title: c.error }),
|
|
2194
|
-
c.body != null && /* @__PURE__ */ e("pre", { style: {
|
|
2195
|
-
background: "#f5f5f5",
|
|
2196
|
-
padding: 8,
|
|
2197
|
-
margin: 0,
|
|
2198
|
-
fontSize: 12,
|
|
2199
|
-
maxHeight: 240,
|
|
2200
|
-
overflow: "auto"
|
|
2201
|
-
}, children: c.body })
|
|
2202
|
-
] }),
|
|
2203
|
-
l && /* @__PURE__ */ e(
|
|
2204
|
-
Se,
|
|
2205
|
-
{
|
|
2206
|
-
activeKey: I,
|
|
2207
|
-
onChange: o,
|
|
2208
|
-
style: { marginTop: 16 },
|
|
2209
|
-
items: [
|
|
2210
|
-
{
|
|
2211
|
-
key: "import",
|
|
2212
|
-
label: /* @__PURE__ */ n("span", { children: [
|
|
2213
|
-
/* @__PURE__ */ e(qe, {}),
|
|
2214
|
-
" 导入为测试用例"
|
|
2215
|
-
] }),
|
|
2216
|
-
children: /* @__PURE__ */ n(P, { form: v, layout: "vertical", children: [
|
|
2217
|
-
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
2218
|
-
/* @__PURE__ */ e(M, { span: 12, children: /* @__PURE__ */ e(P.Item, { name: "caseName", label: "用例名称", rules: [{ required: !0 }], children: /* @__PURE__ */ e(N, {}) }) }),
|
|
2219
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "caseGroup", label: "用例分组", children: /* @__PURE__ */ e(N, {}) }) }),
|
|
2220
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", children: S.length > 0 ? /* @__PURE__ */ e(Z, { options: S.map((L) => ({ value: L, label: L })) }) : /* @__PURE__ */ e(N, {}) }) })
|
|
2221
|
-
] }),
|
|
2222
|
-
/* @__PURE__ */ e(
|
|
2223
|
-
E,
|
|
2224
|
-
{
|
|
2225
|
-
type: "primary",
|
|
2226
|
-
onClick: p,
|
|
2227
|
-
loading: O,
|
|
2228
|
-
icon: /* @__PURE__ */ e(qe, {}),
|
|
2229
|
-
children: "保存为测试用例"
|
|
2230
|
-
}
|
|
2231
|
-
)
|
|
2232
|
-
] })
|
|
2233
|
-
},
|
|
2234
|
-
{
|
|
2235
|
-
key: "mock",
|
|
2236
|
-
label: /* @__PURE__ */ n("span", { children: [
|
|
2237
|
-
/* @__PURE__ */ e(fe, {}),
|
|
2238
|
-
" 导入为 Mock 端点"
|
|
2239
|
-
] }),
|
|
2240
|
-
children: /* @__PURE__ */ n(P, { form: u, layout: "vertical", children: [
|
|
2241
|
-
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
2242
|
-
/* @__PURE__ */ e(M, { span: 12, children: /* @__PURE__ */ e(P.Item, { name: "mockName", label: "Mock 名称", rules: [{ required: !0 }], children: /* @__PURE__ */ e(N, {}) }) }),
|
|
2243
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", children: S.length > 0 ? /* @__PURE__ */ e(Z, { options: S.map((L) => ({ value: L, label: L })) }) : /* @__PURE__ */ e(N, {}) }) }),
|
|
2244
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "projectCode", label: "项目", children: /* @__PURE__ */ e(N, {}) }) })
|
|
2245
|
-
] }),
|
|
2246
|
-
/* @__PURE__ */ e(P.Item, { name: "responseTemplate", label: "响应模板 (JSON)", children: /* @__PURE__ */ e(
|
|
2247
|
-
it,
|
|
2248
|
-
{
|
|
2249
|
-
autoSize: { minRows: 3, maxRows: 8 },
|
|
2250
|
-
style: { fontFamily: "Menlo, Monaco, monospace" }
|
|
2251
|
-
}
|
|
2252
|
-
) }),
|
|
2253
|
-
/* @__PURE__ */ e(
|
|
2254
|
-
E,
|
|
2255
|
-
{
|
|
2256
|
-
type: "primary",
|
|
2257
|
-
onClick: i,
|
|
2258
|
-
loading: O,
|
|
2259
|
-
icon: /* @__PURE__ */ e(fe, {}),
|
|
2260
|
-
children: "保存为 Mock 端点"
|
|
2261
|
-
}
|
|
2262
|
-
)
|
|
2263
|
-
] })
|
|
2264
|
-
}
|
|
2265
|
-
]
|
|
2266
|
-
}
|
|
2267
|
-
)
|
|
2268
|
-
]
|
|
2269
|
-
}
|
|
2270
|
-
);
|
|
2271
|
-
}
|
|
2272
|
-
function Bn(t) {
|
|
2273
|
-
return { GET: "blue", POST: "green", PUT: "orange", DELETE: "red", PATCH: "purple" }[t] || "default";
|
|
2274
|
-
}
|
|
2275
|
-
const { TextArea: ct } = N;
|
|
2276
|
-
function Ir({ open: t, onClose: a, onSuccess: r, envOptions: S = [] }) {
|
|
2277
|
-
const [s, d] = h("paste"), [l, A] = h(""), [g, x] = h(null), [b, m] = h(null), [c, k] = h(!1), [O, y] = h([]), [I, o] = h(!1), [v] = P.useForm(), u = ht(null), _ = () => {
|
|
2278
|
-
A(""), x(null), m(null), y([]), v.resetFields();
|
|
2279
|
-
}, f = () => {
|
|
2280
|
-
_(), a();
|
|
2281
|
-
}, D = async () => {
|
|
2282
|
-
if (!l.trim()) {
|
|
2283
|
-
w.warning("请先粘贴或上传 API 规约");
|
|
2284
|
-
return;
|
|
2285
|
-
}
|
|
2286
|
-
m(null), k(!0);
|
|
2287
|
-
try {
|
|
2288
|
-
const T = await U.openapi.parse(l);
|
|
2289
|
-
T.success ? (x(T), y((T.endpoints || []).map((j, V) => V)), v.setFieldsValue({
|
|
2290
|
-
envCode: S[0] || "default",
|
|
2291
|
-
projectCode: "default",
|
|
2292
|
-
defaultResponse: `{
|
|
2293
|
-
"code": 0,
|
|
2294
|
-
"message": "ok",
|
|
2295
|
-
"data": {}
|
|
2296
|
-
}`,
|
|
2297
|
-
defaultStatus: 200,
|
|
2298
|
-
priority: 5,
|
|
2299
|
-
tagPrefix: "openapi-import"
|
|
2300
|
-
}), w.success(`识别为 ${T.format},共 ${T.count} 个端点`)) : m(T.message || "解析失败");
|
|
2301
|
-
} catch (T) {
|
|
2302
|
-
m(String((T == null ? void 0 : T.message) || T));
|
|
2303
|
-
} finally {
|
|
2304
|
-
k(!1);
|
|
2305
|
-
}
|
|
2306
|
-
}, K = async (T) => {
|
|
2307
|
-
try {
|
|
2308
|
-
const j = await U.openapi.sample(T);
|
|
2309
|
-
j.success && (A(j.content), w.success(`已加载 ${j.format} 示例`));
|
|
2310
|
-
} catch (j) {
|
|
2311
|
-
w.error("加载示例失败: " + j.message);
|
|
2312
|
-
}
|
|
2313
|
-
}, p = (T) => {
|
|
2314
|
-
const j = new FileReader();
|
|
2315
|
-
return j.onload = (V) => {
|
|
2316
|
-
var q;
|
|
2317
|
-
A(String(((q = V.target) == null ? void 0 : q.result) || "")), w.success(`已读取 ${T.name}(${(T.size / 1024).toFixed(1)}KB)`);
|
|
2318
|
-
}, j.onerror = () => w.error("文件读取失败"), j.readAsText(T), !1;
|
|
2319
|
-
}, i = async () => {
|
|
2320
|
-
if (!g) {
|
|
2321
|
-
w.warning("请先解析");
|
|
2322
|
-
return;
|
|
2323
|
-
}
|
|
2324
|
-
let T;
|
|
2325
|
-
try {
|
|
2326
|
-
T = await v.validateFields();
|
|
2327
|
-
} catch {
|
|
2328
|
-
return;
|
|
2329
|
-
}
|
|
2330
|
-
o(!0);
|
|
2331
|
-
try {
|
|
2332
|
-
const j = (g.endpoints || []).map((q, Ve) => ({
|
|
2333
|
-
method: q.method,
|
|
2334
|
-
path: q.path
|
|
2335
|
-
})).filter((q, Ve) => O.includes(Ve)), V = await U.openapi.importBatch({
|
|
2336
|
-
content: l,
|
|
2337
|
-
selected: j,
|
|
2338
|
-
envCode: T.envCode,
|
|
2339
|
-
projectCode: T.projectCode,
|
|
2340
|
-
defaultResponse: T.defaultResponse,
|
|
2341
|
-
defaultStatus: T.defaultStatus,
|
|
2342
|
-
priority: T.priority,
|
|
2343
|
-
tagPrefix: T.tagPrefix
|
|
2344
|
-
});
|
|
2345
|
-
V.success ? (w.success(`已导入 ${V.imported} 个 Mock 端点${V.failed > 0 ? `,失败 ${V.failed}` : ""}`), r && r(V), f()) : w.error(V.message || "导入失败");
|
|
2346
|
-
} catch (j) {
|
|
2347
|
-
w.error(String((j == null ? void 0 : j.message) || j));
|
|
2348
|
-
} finally {
|
|
2349
|
-
o(!1);
|
|
2350
|
-
}
|
|
2351
|
-
}, L = [
|
|
2352
|
-
{
|
|
2353
|
-
title: "Method",
|
|
2354
|
-
dataIndex: "method",
|
|
2355
|
-
width: 90,
|
|
2356
|
-
render: (T) => /* @__PURE__ */ e(C, { color: jn(T), children: T })
|
|
2357
|
-
},
|
|
2358
|
-
{ title: "Path", dataIndex: "path", width: 240, ellipsis: !0 },
|
|
2359
|
-
{ title: "Summary", dataIndex: "summary", ellipsis: !0 },
|
|
2360
|
-
{
|
|
2361
|
-
title: "Tags",
|
|
2362
|
-
dataIndex: "tags",
|
|
2363
|
-
width: 160,
|
|
2364
|
-
render: (T) => (T || []).map((j) => /* @__PURE__ */ e(C, { children: j }, j))
|
|
2365
|
-
},
|
|
2366
|
-
{
|
|
2367
|
-
title: "Params",
|
|
2368
|
-
dataIndex: "parameters",
|
|
2369
|
-
width: 80,
|
|
2370
|
-
render: (T) => (T == null ? void 0 : T.length) || 0,
|
|
2371
|
-
align: "center"
|
|
2372
|
-
},
|
|
2373
|
-
{
|
|
2374
|
-
// `ApiSpecParser.ParsedEndpoint` 是 **POJO**(public 字段)⇒ 被全局 SNAKE_CASE 改名
|
|
2375
|
-
title: "示例",
|
|
2376
|
-
dataIndex: "response_example",
|
|
2377
|
-
width: 80,
|
|
2378
|
-
render: (T) => T ? /* @__PURE__ */ e(C, { color: "green", children: "有" }) : /* @__PURE__ */ e(C, { children: "无" })
|
|
2379
|
-
}
|
|
2380
|
-
];
|
|
2381
|
-
return /* @__PURE__ */ n(
|
|
2382
|
-
me,
|
|
2383
|
-
{
|
|
2384
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
2385
|
-
/* @__PURE__ */ e(Qe, {}),
|
|
2386
|
-
" 批量导入 API 规约"
|
|
2387
|
-
] }),
|
|
2388
|
-
open: t,
|
|
2389
|
-
onCancel: f,
|
|
2390
|
-
footer: null,
|
|
2391
|
-
size: "large",
|
|
2392
|
-
destroyOnHidden: !0,
|
|
2393
|
-
children: [
|
|
2394
|
-
/* @__PURE__ */ e(
|
|
2395
|
-
Se,
|
|
2396
|
-
{
|
|
2397
|
-
activeKey: s,
|
|
2398
|
-
onChange: d,
|
|
2399
|
-
items: [
|
|
2400
|
-
{
|
|
2401
|
-
key: "paste",
|
|
2402
|
-
label: /* @__PURE__ */ n("span", { children: [
|
|
2403
|
-
/* @__PURE__ */ e(Xe, {}),
|
|
2404
|
-
" 粘贴 JSON"
|
|
2405
|
-
] }),
|
|
2406
|
-
children: /* @__PURE__ */ n("div", { children: [
|
|
2407
|
-
/* @__PURE__ */ e(
|
|
2408
|
-
ct,
|
|
2409
|
-
{
|
|
2410
|
-
value: l,
|
|
2411
|
-
onChange: (T) => A(T.target.value),
|
|
2412
|
-
placeholder: "粘贴 OpenAPI 3.x / Swagger 2.0 / Postman v2.1 JSON 内容…",
|
|
2413
|
-
autoSize: { minRows: 6, maxRows: 16 },
|
|
2414
|
-
style: { fontFamily: "Menlo, Monaco, monospace", fontSize: 12 }
|
|
2415
|
-
}
|
|
2416
|
-
),
|
|
2417
|
-
/* @__PURE__ */ n(R, { style: { marginTop: 8 }, children: [
|
|
2418
|
-
/* @__PURE__ */ e(E, { size: "small", onClick: () => K("openapi3"), children: "加载 OpenAPI 3 示例" }),
|
|
2419
|
-
/* @__PURE__ */ e(E, { size: "small", onClick: () => K("swagger2"), children: "加载 Swagger 2 示例" }),
|
|
2420
|
-
/* @__PURE__ */ e(E, { size: "small", onClick: () => K("postman"), children: "加载 Postman 示例" })
|
|
2421
|
-
] })
|
|
2422
|
-
] })
|
|
2423
|
-
},
|
|
2424
|
-
{
|
|
2425
|
-
key: "upload",
|
|
2426
|
-
label: /* @__PURE__ */ n("span", { children: [
|
|
2427
|
-
/* @__PURE__ */ e(Ut, {}),
|
|
2428
|
-
" 上传文件"
|
|
2429
|
-
] }),
|
|
2430
|
-
children: /* @__PURE__ */ n(
|
|
2431
|
-
Et.Dragger,
|
|
2432
|
-
{
|
|
2433
|
-
ref: u,
|
|
2434
|
-
accept: ".json,.yaml,.yml,application/json,text/yaml",
|
|
2435
|
-
beforeUpload: p,
|
|
2436
|
-
showUploadList: !1,
|
|
2437
|
-
style: { padding: 24 },
|
|
2438
|
-
children: [
|
|
2439
|
-
/* @__PURE__ */ e("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ e(Qe, { style: { fontSize: 48, color: "#1890ff" } }) }),
|
|
2440
|
-
/* @__PURE__ */ e("p", { className: "ant-upload-text", children: "点击或拖拽 JSON / YAML 文件到此处" }),
|
|
2441
|
-
/* @__PURE__ */ e("p", { className: "ant-upload-hint", children: "支持 OpenAPI 3.x / Swagger 2.0 / Postman v2.1" })
|
|
2442
|
-
]
|
|
2443
|
-
}
|
|
2444
|
-
)
|
|
2445
|
-
}
|
|
2446
|
-
]
|
|
2447
|
-
}
|
|
2448
|
-
),
|
|
2449
|
-
/* @__PURE__ */ n(R, { style: { marginTop: 12 }, children: [
|
|
2450
|
-
/* @__PURE__ */ e(E, { type: "primary", icon: /* @__PURE__ */ e(be, {}), onClick: D, loading: c, children: "解析" }),
|
|
2451
|
-
g && /* @__PURE__ */ e(C, { color: "blue", children: g.format }),
|
|
2452
|
-
g && /* @__PURE__ */ n(C, { children: [
|
|
2453
|
-
"共 ",
|
|
2454
|
-
g.count,
|
|
2455
|
-
" 个端点,已选 ",
|
|
2456
|
-
O.length
|
|
2457
|
-
] })
|
|
2458
|
-
] }),
|
|
2459
|
-
b && /* @__PURE__ */ e(W, { type: "error", showIcon: !0, style: { marginTop: 12 }, title: "解析失败", description: b }),
|
|
2460
|
-
g && /* 端点预览 —— 走基座 ListTable(lead 008 §2 三件套):
|
|
2461
|
-
标准分页 + 端侧过滤 + EmptyState。
|
|
2462
|
-
原来那层 <Card size="small" title="预览(可勾选要导入的)"> 已去掉,
|
|
2463
|
-
标题落到 ListTable 的 cardTitle,避免卡片套卡片。 */
|
|
2464
|
-
/* @__PURE__ */ e(
|
|
2465
|
-
le,
|
|
2466
|
-
{
|
|
2467
|
-
cardTitle: "预览(可勾选要导入的)",
|
|
2468
|
-
rows: g.endpoints || [],
|
|
2469
|
-
columns: L,
|
|
2470
|
-
rowKey: (T, j) => j,
|
|
2471
|
-
rowSelection: {
|
|
2472
|
-
selectedRowKeys: O,
|
|
2473
|
-
onChange: y
|
|
2474
|
-
},
|
|
2475
|
-
searchKeys: ["method", "path", "summary"],
|
|
2476
|
-
searchPlaceholder: "按 Method / Path / Summary 过滤",
|
|
2477
|
-
emptyTitle: "没有可导入的端点",
|
|
2478
|
-
emptyDescription: "解析结果里没有端点,换一个 OpenAPI 文档试试。",
|
|
2479
|
-
scroll: { y: 280 },
|
|
2480
|
-
cardProps: { size: "small", style: { marginTop: 16 } }
|
|
2481
|
-
}
|
|
2482
|
-
),
|
|
2483
|
-
g && /* @__PURE__ */ e($, { size: "small", style: { marginTop: 16 }, title: "导入配置", children: /* @__PURE__ */ n(P, { form: v, layout: "vertical", children: [
|
|
2484
|
-
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
2485
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", rules: [{ required: !0 }], children: S.length > 0 ? /* @__PURE__ */ e(Z, { options: S.map((T) => ({ value: T, label: T })) }) : /* @__PURE__ */ e(N, {}) }) }),
|
|
2486
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "projectCode", label: "项目", children: /* @__PURE__ */ e(N, {}) }) }),
|
|
2487
|
-
/* @__PURE__ */ e(M, { span: 4, children: /* @__PURE__ */ e(P.Item, { name: "defaultStatus", label: "默认状态码", children: /* @__PURE__ */ e(N, { type: "number" }) }) }),
|
|
2488
|
-
/* @__PURE__ */ e(M, { span: 4, children: /* @__PURE__ */ e(P.Item, { name: "priority", label: "优先级", children: /* @__PURE__ */ e(N, { type: "number" }) }) }),
|
|
2489
|
-
/* @__PURE__ */ e(M, { span: 4, children: /* @__PURE__ */ e(P.Item, { name: "tagPrefix", label: "Tag 前缀", children: /* @__PURE__ */ e(N, {}) }) })
|
|
2490
|
-
] }),
|
|
2491
|
-
/* @__PURE__ */ e(P.Item, { name: "defaultResponse", label: "默认响应(无 example 时使用)", children: /* @__PURE__ */ e(
|
|
2492
|
-
ct,
|
|
2493
|
-
{
|
|
2494
|
-
autoSize: { minRows: 3, maxRows: 6 },
|
|
2495
|
-
style: { fontFamily: "Menlo, Monaco, monospace" }
|
|
2496
|
-
}
|
|
2497
|
-
) }),
|
|
2498
|
-
/* @__PURE__ */ n(
|
|
2499
|
-
E,
|
|
2500
|
-
{
|
|
2501
|
-
type: "primary",
|
|
2502
|
-
size: "large",
|
|
2503
|
-
icon: /* @__PURE__ */ e(qe, {}),
|
|
2504
|
-
onClick: i,
|
|
2505
|
-
loading: I,
|
|
2506
|
-
disabled: O.length === 0,
|
|
2507
|
-
children: [
|
|
2508
|
-
"批量导入 ",
|
|
2509
|
-
O.length,
|
|
2510
|
-
" 个端点"
|
|
2511
|
-
]
|
|
2512
|
-
}
|
|
2513
|
-
)
|
|
2514
|
-
] }) })
|
|
2515
|
-
]
|
|
2516
|
-
}
|
|
2517
|
-
);
|
|
2518
|
-
}
|
|
2519
|
-
function jn(t) {
|
|
2520
|
-
return { GET: "blue", POST: "green", PUT: "orange", DELETE: "red", PATCH: "purple" }[t] || "default";
|
|
2521
|
-
}
|
|
2522
|
-
const Un = {
|
|
2523
|
-
STANDARD_JSON: { label: "标准 JSON", color: "blue" },
|
|
2524
|
-
RSS_XML: { label: "RSS 2.0", color: "orange" },
|
|
2525
|
-
ATOM_XML: { label: "Atom 1.0", color: "gold" },
|
|
2526
|
-
CUSTOM_SCRIPT: { label: "自定义脚本", color: "purple" },
|
|
2527
|
-
INTERNAL_BEAN: { label: "内部 Bean", color: "cyan" }
|
|
2528
|
-
}, qn = {
|
|
2529
|
-
PENDING_VERIFY: { color: "default", text: "待验证" },
|
|
2530
|
-
VERIFIED: { color: "green", text: "已验证" },
|
|
2531
|
-
INVALID_AUTH: { color: "red", text: "鉴权失败" },
|
|
2532
|
-
FATAL: { color: "red", text: "永久失败" },
|
|
2533
|
-
DISABLED: { color: "default", text: "已停用" }
|
|
2534
|
-
}, dt = {
|
|
2535
|
-
PENDING: { color: "default" },
|
|
2536
|
-
RUNNING: { color: "processing" },
|
|
2537
|
-
SUCCESS: { color: "green" },
|
|
2538
|
-
EMPTY: { color: "default" },
|
|
2539
|
-
FAILED: { color: "red" },
|
|
2540
|
-
FATAL: { color: "red" }
|
|
2541
|
-
};
|
|
2542
|
-
function Fn() {
|
|
2543
|
-
const t = ke(), [a, r] = h([]), [S, s] = h(!1), [d, l] = h(null), [A, g] = h([]), [x, b] = h({}), [m, c] = h(null), [k, O] = h([]), y = async () => {
|
|
2544
|
-
s(!0);
|
|
2545
|
-
try {
|
|
2546
|
-
const p = await B.get("/subscribe/subscription/list");
|
|
2547
|
-
p && p.success !== !1 && r(Array.isArray(p.data) ? p.data : Array.isArray(p) ? p : []);
|
|
2548
|
-
} catch (p) {
|
|
2549
|
-
w.error("获取订阅列表失败: " + ((p == null ? void 0 : p.message) || ""));
|
|
2550
|
-
} finally {
|
|
2551
|
-
s(!1);
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
G(() => {
|
|
2555
|
-
y();
|
|
2556
|
-
}, []);
|
|
2557
|
-
const I = (p) => {
|
|
2558
|
-
me.confirm({
|
|
2559
|
-
title: "确认删除",
|
|
2560
|
-
icon: /* @__PURE__ */ e(Ht, {}),
|
|
2561
|
-
content: `确定要删除订阅 "${p.name}" 吗? 运行历史会保留.`,
|
|
2562
|
-
onOk: async () => {
|
|
2563
|
-
try {
|
|
2564
|
-
const i = await B.delete(`/subscribe/subscription/${p.id}`);
|
|
2565
|
-
i && i.success !== !1 ? (w.success("删除成功"), y()) : w.error((i == null ? void 0 : i.message) || "删除失败");
|
|
2566
|
-
} catch (i) {
|
|
2567
|
-
w.error("删除失败: " + ((i == null ? void 0 : i.message) || ""));
|
|
2568
|
-
}
|
|
2569
|
-
}
|
|
2570
|
-
});
|
|
2571
|
-
}, o = async (p) => {
|
|
2572
|
-
try {
|
|
2573
|
-
const i = await B.post(`/subscribe/subscription/${p}/enable`);
|
|
2574
|
-
i && i.success !== !1 ? (w.success("已启用"), y()) : w.error((i == null ? void 0 : i.message) || "启用失败");
|
|
2575
|
-
} catch (i) {
|
|
2576
|
-
w.error("启用失败: " + ((i == null ? void 0 : i.message) || ""));
|
|
2577
|
-
}
|
|
2578
|
-
}, v = async (p) => {
|
|
2579
|
-
try {
|
|
2580
|
-
const i = await B.post(`/subscribe/subscription/${p}/disable`);
|
|
2581
|
-
i && i.success !== !1 ? (w.success("已停用"), y()) : w.error((i == null ? void 0 : i.message) || "停用失败");
|
|
2582
|
-
} catch (i) {
|
|
2583
|
-
w.error("停用失败: " + ((i == null ? void 0 : i.message) || ""));
|
|
2584
|
-
}
|
|
2585
|
-
}, u = async (p) => {
|
|
2586
|
-
me.confirm({
|
|
2587
|
-
title: "手动触发",
|
|
2588
|
-
content: `将立即执行一次 "${p.name}" 的抽取, 同步返回 runId.`,
|
|
2589
|
-
onOk: async () => {
|
|
2590
|
-
try {
|
|
2591
|
-
const i = await B.post(`/subscribe/subscription/${p.id}/trigger?triggerBy=ceo`);
|
|
2592
|
-
if (i && (i.data !== void 0 || i.success !== !1)) {
|
|
2593
|
-
const L = i.data ?? i;
|
|
2594
|
-
w.success(`已触发, runId = ${L}`), f(p);
|
|
2595
|
-
} else
|
|
2596
|
-
w.error((i == null ? void 0 : i.message) || "触发失败");
|
|
2597
|
-
} catch (i) {
|
|
2598
|
-
w.error("触发失败: " + ((i == null ? void 0 : i.message) || ""));
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
});
|
|
2602
|
-
}, _ = async (p) => {
|
|
2603
|
-
try {
|
|
2604
|
-
const i = await B.post(`/subscribe/subscription/${p.id}/dry-run`);
|
|
2605
|
-
l({ sub: p, result: (i == null ? void 0 : i.data) ?? i });
|
|
2606
|
-
} catch (i) {
|
|
2607
|
-
l({ sub: p, result: { success: !1, errorMessage: (i == null ? void 0 : i.message) || "请求失败" } });
|
|
2608
|
-
}
|
|
2609
|
-
}, f = async (p) => {
|
|
2610
|
-
try {
|
|
2611
|
-
const i = await B.get(`/subscribe/run/list?subscriptionId=${p.id}&limit=20`), L = (i == null ? void 0 : i.data) ?? i ?? [];
|
|
2612
|
-
g(Array.isArray(L) ? L : []), c(null), b({}), O([]), l({ sub: p, tab: "runs" });
|
|
2613
|
-
} catch {
|
|
2614
|
-
w.error("获取运行历史失败");
|
|
2615
|
-
}
|
|
2616
|
-
}, D = async (p) => {
|
|
2617
|
-
if (x[p]) {
|
|
2618
|
-
c(p);
|
|
2619
|
-
return;
|
|
2620
|
-
}
|
|
2621
|
-
try {
|
|
2622
|
-
const i = await B.get(`/subscribe/run/${p}/items?limit=200`), L = (i == null ? void 0 : i.data) ?? i ?? [];
|
|
2623
|
-
b((T) => ({ ...T, [p]: Array.isArray(L) ? L : [] })), c(p);
|
|
2624
|
-
} catch {
|
|
2625
|
-
w.error("获取抽取项失败");
|
|
2626
|
-
}
|
|
2627
|
-
};
|
|
2628
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
2629
|
-
/* @__PURE__ */ e(
|
|
2630
|
-
ye,
|
|
2631
|
-
{
|
|
2632
|
-
title: "订阅中心 - 数据源订阅",
|
|
2633
|
-
subtitle: "负责把三方 / 内部 / RSS 等数据源按 Cron 定时抽取, 归一化后落到本地"
|
|
2634
|
-
}
|
|
2635
|
-
),
|
|
2636
|
-
/* @__PURE__ */ e(
|
|
2637
|
-
W,
|
|
2638
|
-
{
|
|
2639
|
-
type: "info",
|
|
2640
|
-
showIcon: !0,
|
|
2641
|
-
style: { marginBottom: 16 },
|
|
2642
|
-
message: "订阅中心负责把三方 / 内部 / RSS 等数据源按 Cron 定时抽取, 归一化后落到本地, 供 CEO 立项和 Agent 协作使用."
|
|
2643
|
-
}
|
|
2644
|
-
),
|
|
2645
|
-
/* @__PURE__ */ e(
|
|
2646
|
-
le,
|
|
2647
|
-
{
|
|
2648
|
-
rows: a,
|
|
2649
|
-
columns: [
|
|
2650
|
-
{
|
|
2651
|
-
title: "ID",
|
|
2652
|
-
dataIndex: "id",
|
|
2653
|
-
width: 70
|
|
2654
|
-
},
|
|
2655
|
-
{
|
|
2656
|
-
title: "名称",
|
|
2657
|
-
dataIndex: "name",
|
|
2658
|
-
render: (p, i) => /* @__PURE__ */ n(R, { orientation: "vertical", size: 0, children: [
|
|
2659
|
-
/* @__PURE__ */ e("span", { style: { fontWeight: 500 }, children: p }),
|
|
2660
|
-
i.description && /* @__PURE__ */ e("span", { style: { color: "#999", fontSize: 12 }, children: i.description })
|
|
2661
|
-
] })
|
|
2662
|
-
},
|
|
2663
|
-
{
|
|
2664
|
-
title: "数据源",
|
|
2665
|
-
dataIndex: "sourceType",
|
|
2666
|
-
width: 90,
|
|
2667
|
-
render: (p) => /* @__PURE__ */ e(C, { children: p })
|
|
2668
|
-
},
|
|
2669
|
-
{
|
|
2670
|
-
title: "抽取器",
|
|
2671
|
-
dataIndex: "extractorType",
|
|
2672
|
-
width: 140,
|
|
2673
|
-
render: (p) => {
|
|
2674
|
-
const i = Un[p] || { label: p, color: "default" };
|
|
2675
|
-
return /* @__PURE__ */ e(C, { color: i.color, children: i.label });
|
|
2676
|
-
}
|
|
2677
|
-
},
|
|
2678
|
-
{
|
|
2679
|
-
title: "Cron",
|
|
2680
|
-
dataIndex: "cronExpr",
|
|
2681
|
-
width: 150,
|
|
2682
|
-
render: (p) => /* @__PURE__ */ e("code", { style: { fontSize: 12 }, children: p })
|
|
2683
|
-
},
|
|
2684
|
-
{
|
|
2685
|
-
title: "状态",
|
|
2686
|
-
dataIndex: "status",
|
|
2687
|
-
width: 110,
|
|
2688
|
-
render: (p) => {
|
|
2689
|
-
const i = qn[p] || { color: "default", text: p };
|
|
2690
|
-
return /* @__PURE__ */ e(C, { color: i.color, children: i.text });
|
|
2691
|
-
}
|
|
2692
|
-
},
|
|
2693
|
-
{
|
|
2694
|
-
title: "启用",
|
|
2695
|
-
dataIndex: "enabled",
|
|
2696
|
-
width: 80,
|
|
2697
|
-
render: (p, i) => p ? /* @__PURE__ */ e(C, { color: "green", children: "是" }) : /* @__PURE__ */ e(C, { children: "否" })
|
|
2698
|
-
},
|
|
2699
|
-
{
|
|
2700
|
-
title: "最近 run",
|
|
2701
|
-
dataIndex: "lastStatus",
|
|
2702
|
-
width: 110,
|
|
2703
|
-
render: (p, i) => {
|
|
2704
|
-
var L;
|
|
2705
|
-
return p ? /* @__PURE__ */ e(he, { title: i.lastError || "", children: /* @__PURE__ */ e(C, { color: ((L = dt[p]) == null ? void 0 : L.color) || "default", children: p }) }) : /* @__PURE__ */ e("span", { style: { color: "#ccc" }, children: "-" });
|
|
2706
|
-
}
|
|
2707
|
-
},
|
|
2708
|
-
{
|
|
2709
|
-
title: "累计",
|
|
2710
|
-
width: 130,
|
|
2711
|
-
render: (p, i) => /* @__PURE__ */ n(R, { size: 4, children: [
|
|
2712
|
-
/* @__PURE__ */ n(C, { color: "green", children: [
|
|
2713
|
-
"✓ ",
|
|
2714
|
-
i.successCountTotal || 0
|
|
2715
|
-
] }),
|
|
2716
|
-
/* @__PURE__ */ n(C, { color: "red", children: [
|
|
2717
|
-
"✗ ",
|
|
2718
|
-
i.failCountTotal || 0
|
|
2719
|
-
] })
|
|
2720
|
-
] })
|
|
2721
|
-
},
|
|
2722
|
-
{
|
|
2723
|
-
title: "操作",
|
|
2724
|
-
width: 280,
|
|
2725
|
-
fixed: "right",
|
|
2726
|
-
render: (p, i) => /* @__PURE__ */ n(R, { size: 4, wrap: !0, children: [
|
|
2727
|
-
/* @__PURE__ */ e(
|
|
2728
|
-
E,
|
|
2729
|
-
{
|
|
2730
|
-
type: "link",
|
|
2731
|
-
size: "small",
|
|
2732
|
-
icon: /* @__PURE__ */ e(qt, {}),
|
|
2733
|
-
onClick: () => t(`/subscribe/edit/${i.id}`),
|
|
2734
|
-
children: "编辑"
|
|
2735
|
-
}
|
|
2736
|
-
),
|
|
2737
|
-
/* @__PURE__ */ e(
|
|
2738
|
-
E,
|
|
2739
|
-
{
|
|
2740
|
-
type: "link",
|
|
2741
|
-
size: "small",
|
|
2742
|
-
icon: /* @__PURE__ */ e(be, {}),
|
|
2743
|
-
onClick: () => _(i),
|
|
2744
|
-
children: "试运行"
|
|
2745
|
-
}
|
|
2746
|
-
),
|
|
2747
|
-
/* @__PURE__ */ e(
|
|
2748
|
-
E,
|
|
2749
|
-
{
|
|
2750
|
-
type: "link",
|
|
2751
|
-
size: "small",
|
|
2752
|
-
icon: /* @__PURE__ */ e(ze, {}),
|
|
2753
|
-
onClick: () => u(i),
|
|
2754
|
-
children: "触发"
|
|
2755
|
-
}
|
|
2756
|
-
),
|
|
2757
|
-
/* @__PURE__ */ e(
|
|
2758
|
-
E,
|
|
2759
|
-
{
|
|
2760
|
-
type: "link",
|
|
2761
|
-
size: "small",
|
|
2762
|
-
onClick: () => f(i),
|
|
2763
|
-
children: "历史"
|
|
2764
|
-
}
|
|
2765
|
-
),
|
|
2766
|
-
i.enabled ? /* @__PURE__ */ e(
|
|
2767
|
-
E,
|
|
2768
|
-
{
|
|
2769
|
-
type: "link",
|
|
2770
|
-
size: "small",
|
|
2771
|
-
icon: /* @__PURE__ */ e(Ft, {}),
|
|
2772
|
-
onClick: () => v(i.id),
|
|
2773
|
-
children: "停用"
|
|
2774
|
-
}
|
|
2775
|
-
) : /* @__PURE__ */ e(
|
|
2776
|
-
E,
|
|
2777
|
-
{
|
|
2778
|
-
type: "link",
|
|
2779
|
-
size: "small",
|
|
2780
|
-
icon: /* @__PURE__ */ e(We, {}),
|
|
2781
|
-
onClick: () => o(i.id),
|
|
2782
|
-
children: "启用"
|
|
2783
|
-
}
|
|
2784
|
-
),
|
|
2785
|
-
/* @__PURE__ */ e(He, { title: "确认删除?", onConfirm: () => I(i), okText: "删除", cancelText: "取消", children: /* @__PURE__ */ e(E, { type: "link", size: "small", danger: !0, icon: /* @__PURE__ */ e(Kt, {}), children: "删除" }) })
|
|
2786
|
-
] })
|
|
2787
|
-
}
|
|
2788
|
-
],
|
|
2789
|
-
rowKey: "id",
|
|
2790
|
-
loading: S,
|
|
2791
|
-
scroll: { x: 1400 },
|
|
2792
|
-
tableProps: { size: "middle" },
|
|
2793
|
-
searchKeys: ["name", "id", "sourceType"],
|
|
2794
|
-
searchPlaceholder: "按订阅名称 / ID / 数据源类型过滤",
|
|
2795
|
-
emptyTitle: "暂无订阅",
|
|
2796
|
-
emptyDescription: "订阅负责把三方数据源按 Cron 定时抽取归一化,先建一个订阅试试。",
|
|
2797
|
-
cardExtra: /* @__PURE__ */ n(R, { children: [
|
|
2798
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: y, children: "刷新" }),
|
|
2799
|
-
/* @__PURE__ */ e(
|
|
2800
|
-
E,
|
|
2801
|
-
{
|
|
2802
|
-
type: "primary",
|
|
2803
|
-
icon: /* @__PURE__ */ e(kt, {}),
|
|
2804
|
-
onClick: () => t("/subscribe/new"),
|
|
2805
|
-
children: "新建订阅"
|
|
2806
|
-
}
|
|
2807
|
-
)
|
|
2808
|
-
] })
|
|
2809
|
-
}
|
|
2810
|
-
),
|
|
2811
|
-
/* @__PURE__ */ e(
|
|
2812
|
-
Ie,
|
|
2813
|
-
{
|
|
2814
|
-
title: d != null && d.sub ? `试运行 - ${d.sub.name}` : "运行历史",
|
|
2815
|
-
open: !!d,
|
|
2816
|
-
onClose: () => l(null),
|
|
2817
|
-
size: "large",
|
|
2818
|
-
children: (d == null ? void 0 : d.tab) === "runs" ? /* @__PURE__ */ e(
|
|
2819
|
-
Se,
|
|
2820
|
-
{
|
|
2821
|
-
activeKey: m ? "items" : "list",
|
|
2822
|
-
onChange: (p) => p === "list" && c(null),
|
|
2823
|
-
items: [
|
|
2824
|
-
{
|
|
2825
|
-
key: "list",
|
|
2826
|
-
label: `运行列表 (${A.length})`,
|
|
2827
|
-
children: (
|
|
2828
|
-
/* 运行列表 —— 走基座 ListTable(lead 008 §2 三件套)。
|
|
2829
|
-
原来 pagination={false}(不分页),改用基座标准分页:
|
|
2830
|
-
行数由订阅的运行次数决定,会增长,不适合按「≤10 且不变」豁免。
|
|
2831
|
-
Drawer 里没有外层卡片,故用 borderless 让它与抽屉融成一块。 */
|
|
2832
|
-
/* @__PURE__ */ e(
|
|
2833
|
-
le,
|
|
2834
|
-
{
|
|
2835
|
-
rows: A,
|
|
2836
|
-
rowKey: "id",
|
|
2837
|
-
searchKeys: ["id", "status"],
|
|
2838
|
-
searchPlaceholder: "按 run ID / 状态过滤",
|
|
2839
|
-
emptyTitle: "暂无运行记录",
|
|
2840
|
-
emptyDescription: "该订阅还没有运行过。",
|
|
2841
|
-
cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
|
|
2842
|
-
onRow: (p) => ({ onClick: () => D(p.id) }),
|
|
2843
|
-
columns: [
|
|
2844
|
-
{ title: "runId", dataIndex: "id", width: 70 },
|
|
2845
|
-
{
|
|
2846
|
-
title: "计划",
|
|
2847
|
-
dataIndex: "scheduledAt",
|
|
2848
|
-
width: 160,
|
|
2849
|
-
render: (p) => p ? new Date(p).toLocaleString() : "-"
|
|
2850
|
-
},
|
|
2851
|
-
{ title: "耗时(ms)", dataIndex: "durationMs", width: 90 },
|
|
2852
|
-
{
|
|
2853
|
-
title: "状态",
|
|
2854
|
-
dataIndex: "status",
|
|
2855
|
-
width: 90,
|
|
2856
|
-
render: (p) => {
|
|
2857
|
-
var i;
|
|
2858
|
-
return /* @__PURE__ */ e(C, { color: (i = dt[p]) == null ? void 0 : i.color, children: p });
|
|
2859
|
-
}
|
|
2860
|
-
},
|
|
2861
|
-
{
|
|
2862
|
-
title: "拉取/成功/重复/死信",
|
|
2863
|
-
width: 200,
|
|
2864
|
-
render: (p, i) => `${i.fetchedCount} / ${i.successCount} / ${i.duplicateCount || 0} / ${i.deadLetterCount}`
|
|
2865
|
-
},
|
|
2866
|
-
{
|
|
2867
|
-
title: "错误",
|
|
2868
|
-
dataIndex: "errorMessage",
|
|
2869
|
-
render: (p) => p ? /* @__PURE__ */ e("span", { style: { color: "#cf1322", fontSize: 12 }, children: p }) : "-"
|
|
2870
|
-
}
|
|
2871
|
-
]
|
|
2872
|
-
}
|
|
2873
|
-
)
|
|
2874
|
-
)
|
|
2875
|
-
},
|
|
2876
|
-
{
|
|
2877
|
-
key: "items",
|
|
2878
|
-
label: m ? `run#${m} 抽取项` : "抽取项",
|
|
2879
|
-
disabled: !m,
|
|
2880
|
-
children: /* @__PURE__ */ n(R, { orientation: "vertical", style: { width: "100%" }, children: [
|
|
2881
|
-
/* @__PURE__ */ n(R, { children: [
|
|
2882
|
-
/* @__PURE__ */ n(C, { color: "blue", children: [
|
|
2883
|
-
"已选 ",
|
|
2884
|
-
k.length,
|
|
2885
|
-
" 条"
|
|
2886
|
-
] }),
|
|
2887
|
-
/* @__PURE__ */ n(
|
|
2888
|
-
E,
|
|
2889
|
-
{
|
|
2890
|
-
size: "small",
|
|
2891
|
-
type: "primary",
|
|
2892
|
-
icon: /* @__PURE__ */ e(Re, {}),
|
|
2893
|
-
disabled: k.length === 0,
|
|
2894
|
-
onClick: () => {
|
|
2895
|
-
const p = k.join(",");
|
|
2896
|
-
t(`/project/new?subscriptionId=${d.sub.id}&itemIds=${p}`);
|
|
2897
|
-
},
|
|
2898
|
-
children: [
|
|
2899
|
-
"用所选 ",
|
|
2900
|
-
k.length,
|
|
2901
|
-
" 条立项"
|
|
2902
|
-
]
|
|
2903
|
-
}
|
|
2904
|
-
)
|
|
2905
|
-
] }),
|
|
2906
|
-
/* @__PURE__ */ e(
|
|
2907
|
-
le,
|
|
2908
|
-
{
|
|
2909
|
-
rows: x[m] || [],
|
|
2910
|
-
rowKey: "id",
|
|
2911
|
-
rowSelection: {
|
|
2912
|
-
selectedRowKeys: k,
|
|
2913
|
-
onChange: O
|
|
2914
|
-
},
|
|
2915
|
-
searchKeys: ["dedupKey", "status"],
|
|
2916
|
-
searchPlaceholder: "按 dedupKey / 状态过滤",
|
|
2917
|
-
emptyTitle: "暂无抽取项",
|
|
2918
|
-
emptyDescription: "这次运行没有产生抽取项。",
|
|
2919
|
-
cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
|
|
2920
|
-
columns: [
|
|
2921
|
-
{ title: "id", dataIndex: "dedupKey", width: 180, ellipsis: !0 },
|
|
2922
|
-
{
|
|
2923
|
-
title: "title",
|
|
2924
|
-
dataIndex: "normalized",
|
|
2925
|
-
render: (p) => {
|
|
2926
|
-
try {
|
|
2927
|
-
return JSON.parse(p).title || "(无标题)";
|
|
2928
|
-
} catch {
|
|
2929
|
-
return p;
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
},
|
|
2933
|
-
{
|
|
2934
|
-
title: "link",
|
|
2935
|
-
dataIndex: "normalized",
|
|
2936
|
-
render: (p) => {
|
|
2937
|
-
try {
|
|
2938
|
-
const i = JSON.parse(p);
|
|
2939
|
-
return i.link ? /* @__PURE__ */ e("a", { href: i.link, target: "_blank", children: "↗" }) : "-";
|
|
2940
|
-
} catch {
|
|
2941
|
-
return "-";
|
|
2942
|
-
}
|
|
2943
|
-
}
|
|
2944
|
-
},
|
|
2945
|
-
{
|
|
2946
|
-
title: "状态",
|
|
2947
|
-
dataIndex: "status",
|
|
2948
|
-
width: 110,
|
|
2949
|
-
render: (p) => /* @__PURE__ */ e(C, { children: p })
|
|
2950
|
-
}
|
|
2951
|
-
]
|
|
2952
|
-
}
|
|
2953
|
-
)
|
|
2954
|
-
] })
|
|
2955
|
-
}
|
|
2956
|
-
]
|
|
2957
|
-
}
|
|
2958
|
-
) : /* @__PURE__ */ e(Kn, { result: d == null ? void 0 : d.result })
|
|
2959
|
-
}
|
|
2960
|
-
)
|
|
2961
|
-
] });
|
|
2962
|
-
}
|
|
2963
|
-
function Kn({ result: t }) {
|
|
2964
|
-
return t ? t.success ? /* @__PURE__ */ n(R, { orientation: "vertical", style: { width: "100%" }, size: "middle", children: [
|
|
2965
|
-
/* @__PURE__ */ e($, { size: "small", title: "调用结果", children: /* @__PURE__ */ n(R, { size: "large", wrap: !0, children: [
|
|
2966
|
-
/* @__PURE__ */ n("span", { children: [
|
|
2967
|
-
/* @__PURE__ */ e("b", { children: "HTTP:" }),
|
|
2968
|
-
" ",
|
|
2969
|
-
t.httpStatus || "-"
|
|
2970
|
-
] }),
|
|
2971
|
-
/* @__PURE__ */ n("span", { children: [
|
|
2972
|
-
/* @__PURE__ */ e("b", { children: "耗时:" }),
|
|
2973
|
-
" ",
|
|
2974
|
-
t.latencyMs,
|
|
2975
|
-
"ms"
|
|
2976
|
-
] }),
|
|
2977
|
-
/* @__PURE__ */ n("span", { children: [
|
|
2978
|
-
/* @__PURE__ */ e("b", { children: "大小:" }),
|
|
2979
|
-
" ",
|
|
2980
|
-
t.responseSize,
|
|
2981
|
-
"B"
|
|
2982
|
-
] }),
|
|
2983
|
-
/* @__PURE__ */ n("span", { children: [
|
|
2984
|
-
/* @__PURE__ */ e("b", { children: "样本:" }),
|
|
2985
|
-
" ",
|
|
2986
|
-
t.sampleCount,
|
|
2987
|
-
" 条"
|
|
2988
|
-
] })
|
|
2989
|
-
] }) }),
|
|
2990
|
-
t.firstItem && /* @__PURE__ */ e($, { size: "small", title: "第一条样本 (归一化后)", children: /* @__PURE__ */ e(
|
|
2991
|
-
"pre",
|
|
2992
|
-
{
|
|
2993
|
-
style: { background: "#f5f5f5", padding: 12, borderRadius: 4, maxHeight: 300, overflow: "auto" },
|
|
2994
|
-
children: JSON.stringify(t.firstItem, null, 2)
|
|
2995
|
-
}
|
|
2996
|
-
) }),
|
|
2997
|
-
t.responsePreview && /* @__PURE__ */ e($, { size: "small", title: "响应预览 (前 4KB)", children: /* @__PURE__ */ e("pre", { style: {
|
|
2998
|
-
background: "#f5f5f5",
|
|
2999
|
-
padding: 12,
|
|
3000
|
-
borderRadius: 4,
|
|
3001
|
-
maxHeight: 300,
|
|
3002
|
-
overflow: "auto",
|
|
3003
|
-
fontSize: 12
|
|
3004
|
-
}, children: t.responsePreview }) }),
|
|
3005
|
-
t.fieldErrors && t.fieldErrors.length > 0 && /* @__PURE__ */ e(W, { type: "warning", showIcon: !0, message: "字段问题", description: /* @__PURE__ */ e("ul", { children: t.fieldErrors.map((a, r) => /* @__PURE__ */ e("li", { children: a }, r)) }) })
|
|
3006
|
-
] }) : /* @__PURE__ */ e(W, { type: "error", showIcon: !0, title: "试运行失败", description: t.errorMessage || "未知错误" }) : null;
|
|
3007
|
-
}
|
|
3008
|
-
const Hn = [
|
|
3009
|
-
{ value: "STANDARD_JSON", label: "标准 JSON (按统一契约返回的 JSON)" },
|
|
3010
|
-
{ value: "RSS_XML", label: "RSS 2.0 (XML feed)" },
|
|
3011
|
-
{ value: "ATOM_XML", label: "Atom 1.0 (XML feed)" },
|
|
3012
|
-
{ value: "CUSTOM_SCRIPT", label: "自定义脚本 (z-script 平台)" },
|
|
3013
|
-
{ value: "INTERNAL_BEAN", label: "内部 Bean (我们自己的模块, 暂未启用)" }
|
|
3014
|
-
], Gn = [
|
|
3015
|
-
{ value: "NONE", label: "无鉴权" },
|
|
3016
|
-
{ value: "BEARER", label: "Bearer (Authorization: Bearer xxx)" },
|
|
3017
|
-
{ value: "API_KEY", label: "API Key (Authorization: xxx)" },
|
|
3018
|
-
{ value: "BASIC", label: "Basic (user:password base64)" }
|
|
3019
|
-
], Xn = [
|
|
3020
|
-
{ label: "每 5 分钟", value: "0 */5 * * * ?" },
|
|
3021
|
-
{ label: "每 15 分钟", value: "0 */15 * * * ?" },
|
|
3022
|
-
{ label: "每小时", value: "0 0 * * * ?" },
|
|
3023
|
-
{ label: "每 6 小时", value: "0 0 */6 * * ?" },
|
|
3024
|
-
{ label: "每天 8 点", value: "0 0 8 * * ?" }
|
|
3025
|
-
];
|
|
3026
|
-
function ut() {
|
|
3027
|
-
const { id: t } = mt(), a = ke(), r = !!t, [S] = P.useForm(), [s, d] = h(!1), [l, A] = h(!1), [g, x] = h([]), [b, m] = h([]), c = P.useWatch("sourceType", S), k = P.useWatch("extractorType", S), O = P.useWatch("authType", S);
|
|
3028
|
-
G(() => {
|
|
3029
|
-
y(), I(), r && o();
|
|
3030
|
-
}, [t]);
|
|
3031
|
-
const y = async () => {
|
|
3032
|
-
try {
|
|
3033
|
-
const u = await B.get("/secret/list"), _ = (u == null ? void 0 : u.data) ?? u ?? [];
|
|
3034
|
-
x(Array.isArray(_) ? _ : []);
|
|
3035
|
-
} catch {
|
|
3036
|
-
}
|
|
3037
|
-
}, I = async () => {
|
|
3038
|
-
try {
|
|
3039
|
-
const u = await B.get("/script/list"), _ = (u == null ? void 0 : u.data) ?? u ?? [];
|
|
3040
|
-
m(Array.isArray(_) ? _.filter((f) => f.status === 1) : []);
|
|
3041
|
-
} catch {
|
|
3042
|
-
}
|
|
3043
|
-
}, o = async () => {
|
|
3044
|
-
d(!0);
|
|
3045
|
-
try {
|
|
3046
|
-
const u = await B.get(`/subscribe/subscription/${t}`), _ = (u == null ? void 0 : u.data) ?? u;
|
|
3047
|
-
_ && S.setFieldsValue({
|
|
3048
|
-
..._,
|
|
3049
|
-
enabled: _.enabled === 1 || _.enabled === !0
|
|
3050
|
-
});
|
|
3051
|
-
} catch (u) {
|
|
3052
|
-
w.error("加载订阅失败: " + ((u == null ? void 0 : u.message) || ""));
|
|
3053
|
-
} finally {
|
|
3054
|
-
d(!1);
|
|
3055
|
-
}
|
|
3056
|
-
}, v = async () => {
|
|
3057
|
-
try {
|
|
3058
|
-
const u = await S.validateFields();
|
|
3059
|
-
A(!0);
|
|
3060
|
-
const _ = {
|
|
3061
|
-
...u,
|
|
3062
|
-
enabled: u.enabled ? 1 : 0
|
|
3063
|
-
};
|
|
3064
|
-
let f;
|
|
3065
|
-
if (r ? f = await B.put("/subscribe/subscription", _) : f = await B.post("/subscribe/subscription", _), f && f.success === !1) {
|
|
3066
|
-
w.error(f.message || "保存失败");
|
|
3067
|
-
return;
|
|
3068
|
-
}
|
|
3069
|
-
w.success(r ? "已更新 (注意: 修改 cron / url / 抽取器后会自动重置为 PENDING_VERIFY)" : "已创建, 已自动验证"), a("/subscribe/list");
|
|
3070
|
-
} catch (u) {
|
|
3071
|
-
u != null && u.errorFields ? w.warning("请检查表单") : w.error("保存失败: " + ((u == null ? void 0 : u.message) || ""));
|
|
3072
|
-
} finally {
|
|
3073
|
-
A(!1);
|
|
3074
|
-
}
|
|
3075
|
-
};
|
|
3076
|
-
return /* @__PURE__ */ n("div", { style: { padding: 24 }, children: [
|
|
3077
|
-
/* @__PURE__ */ e(
|
|
3078
|
-
ye,
|
|
3079
|
-
{
|
|
3080
|
-
title: r ? `编辑订阅 #${t}` : "新建订阅",
|
|
3081
|
-
subtitle: "配置数据源、抽取器、鉴权与调度策略",
|
|
3082
|
-
back: !0,
|
|
3083
|
-
extra: /* @__PURE__ */ n(R, { children: [
|
|
3084
|
-
/* @__PURE__ */ e(E, { onClick: () => a("/subscribe/list"), children: "取消" }),
|
|
3085
|
-
/* @__PURE__ */ e(E, { type: "primary", icon: /* @__PURE__ */ e(It, {}), loading: l, onClick: v, children: "保存 (自动验证)" })
|
|
3086
|
-
] })
|
|
3087
|
-
}
|
|
3088
|
-
),
|
|
3089
|
-
/* @__PURE__ */ e($, { children: /* @__PURE__ */ e(Pe, { spinning: s, children: /* @__PURE__ */ n(
|
|
3090
|
-
P,
|
|
3091
|
-
{
|
|
3092
|
-
form: S,
|
|
3093
|
-
layout: "vertical",
|
|
3094
|
-
initialValues: {
|
|
3095
|
-
sourceType: "HTTP",
|
|
3096
|
-
httpMethod: "GET",
|
|
3097
|
-
authType: "NONE",
|
|
3098
|
-
extractorType: "STANDARD_JSON",
|
|
3099
|
-
enabled: !0,
|
|
3100
|
-
minIntervalSec: 60,
|
|
3101
|
-
maxItemsPerRun: 1e3,
|
|
3102
|
-
timeoutMs: 15e3
|
|
3103
|
-
},
|
|
3104
|
-
children: [
|
|
3105
|
-
/* @__PURE__ */ n($, { type: "inner", title: "基本信息", style: { marginBottom: 16 }, children: [
|
|
3106
|
-
/* @__PURE__ */ e(P.Item, { label: "名称", name: "name", rules: [{ required: !0, message: "请输入名称" }], children: /* @__PURE__ */ e(N, { placeholder: "例如: GitHub PR 通知" }) }),
|
|
3107
|
-
/* @__PURE__ */ e(P.Item, { label: "说明", name: "description", children: /* @__PURE__ */ e(N.TextArea, { rows: 2, placeholder: "(可选)" }) })
|
|
3108
|
-
] }),
|
|
3109
|
-
/* @__PURE__ */ n($, { type: "inner", title: "数据源", style: { marginBottom: 16 }, children: [
|
|
3110
|
-
/* @__PURE__ */ e(P.Item, { label: "数据源形态", name: "sourceType", rules: [{ required: !0 }], children: /* @__PURE__ */ n(ne.Group, { children: [
|
|
3111
|
-
/* @__PURE__ */ e(ne.Button, { value: "HTTP", children: "HTTP / HTTPS" }),
|
|
3112
|
-
/* @__PURE__ */ e(ne.Button, { value: "INTERNAL", disabled: !0, children: "内部 Bean" })
|
|
3113
|
-
] }) }),
|
|
3114
|
-
c === "HTTP" && /* @__PURE__ */ n(Be, { children: [
|
|
3115
|
-
/* @__PURE__ */ e(
|
|
3116
|
-
P.Item,
|
|
3117
|
-
{
|
|
3118
|
-
label: "目标 URL",
|
|
3119
|
-
name: "targetUrl",
|
|
3120
|
-
rules: [{ required: !0, message: "请输入 URL" }],
|
|
3121
|
-
children: /* @__PURE__ */ e(N, { placeholder: "https://api.github.com/repos/.../pulls?state=open" })
|
|
3122
|
-
}
|
|
3123
|
-
),
|
|
3124
|
-
/* @__PURE__ */ n(R, { size: "large", style: { width: "100%" }, children: [
|
|
3125
|
-
/* @__PURE__ */ e(P.Item, { label: "HTTP 方法", name: "httpMethod", children: /* @__PURE__ */ e(Z, { style: { width: 120 }, options: [
|
|
3126
|
-
{ value: "GET", label: "GET" },
|
|
3127
|
-
{ value: "POST", label: "POST" },
|
|
3128
|
-
{ value: "PUT", label: "PUT" }
|
|
3129
|
-
] }) }),
|
|
3130
|
-
/* @__PURE__ */ e(P.Item, { label: "超时 (ms)", name: "timeoutMs", children: /* @__PURE__ */ e(Le, { min: 1e3, max: 12e4, step: 1e3 }) })
|
|
3131
|
-
] }),
|
|
3132
|
-
/* @__PURE__ */ e(P.Item, { label: "自定义 HTTP 头 (JSON)", name: "httpHeaders", children: /* @__PURE__ */ e(N.TextArea, { rows: 2, placeholder: '{"X-Trace-Id":"abc"}' }) }),
|
|
3133
|
-
/* @__PURE__ */ e(P.Item, { label: "请求体 (POST/PUT)", name: "requestBody", children: /* @__PURE__ */ e(N.TextArea, { rows: 3, placeholder: "(可选)" }) })
|
|
3134
|
-
] })
|
|
3135
|
-
] }),
|
|
3136
|
-
/* @__PURE__ */ n($, { type: "inner", title: "鉴权 (从 z-mist 拉取 secret)", style: { marginBottom: 16 }, children: [
|
|
3137
|
-
/* @__PURE__ */ e(P.Item, { label: "鉴权方式", name: "authType", children: /* @__PURE__ */ e(Z, { options: Gn }) }),
|
|
3138
|
-
O && O !== "NONE" && /* @__PURE__ */ e(
|
|
3139
|
-
P.Item,
|
|
3140
|
-
{
|
|
3141
|
-
label: "z-mist 凭据引用",
|
|
3142
|
-
name: "authSecretKey",
|
|
3143
|
-
extra: "从密钥中心 (z-mist) 选一个 secret; secret 的解密值会作为 secret 注入",
|
|
3144
|
-
children: /* @__PURE__ */ e(
|
|
3145
|
-
Z,
|
|
3146
|
-
{
|
|
3147
|
-
showSearch: !0,
|
|
3148
|
-
allowClear: !0,
|
|
3149
|
-
placeholder: "选择 secret (key)",
|
|
3150
|
-
options: g.map((u) => ({
|
|
3151
|
-
value: u.secretKey,
|
|
3152
|
-
label: `${u.secretKey}${u.secretName ? " (" + u.secretName + ")" : ""}`
|
|
3153
|
-
}))
|
|
3154
|
-
}
|
|
3155
|
-
)
|
|
3156
|
-
}
|
|
3157
|
-
)
|
|
3158
|
-
] }),
|
|
3159
|
-
/* @__PURE__ */ n($, { type: "inner", title: "抽取器", style: { marginBottom: 16 }, children: [
|
|
3160
|
-
/* @__PURE__ */ e(
|
|
3161
|
-
P.Item,
|
|
3162
|
-
{
|
|
3163
|
-
label: "抽取器类型",
|
|
3164
|
-
name: "extractorType",
|
|
3165
|
-
rules: [{ required: !0 }],
|
|
3166
|
-
extra: "STANDARD_JSON/RSS_XML/ATOM_XML 直接解析; CUSTOM_SCRIPT 调 z-script 平台",
|
|
3167
|
-
children: /* @__PURE__ */ e(Z, { options: Hn })
|
|
3168
|
-
}
|
|
3169
|
-
),
|
|
3170
|
-
k === "CUSTOM_SCRIPT" && /* @__PURE__ */ e(
|
|
3171
|
-
P.Item,
|
|
3172
|
-
{
|
|
3173
|
-
label: "z-script 脚本",
|
|
3174
|
-
name: "extractorScriptCode",
|
|
3175
|
-
rules: [{ required: !0, message: "请选择脚本" }],
|
|
3176
|
-
extra: "在 智能中心 > 脚本中心 维护脚本. 脚本返回 { items: [...], nextCursor: '...' }",
|
|
3177
|
-
children: /* @__PURE__ */ e(
|
|
3178
|
-
Z,
|
|
3179
|
-
{
|
|
3180
|
-
showSearch: !0,
|
|
3181
|
-
placeholder: "选择已启用的脚本",
|
|
3182
|
-
options: b.map((u) => ({
|
|
3183
|
-
value: u.scriptCode,
|
|
3184
|
-
label: `${u.scriptCode} (${u.dslType})${u.scriptName ? " - " + u.scriptName : ""}`
|
|
3185
|
-
}))
|
|
3186
|
-
}
|
|
3187
|
-
)
|
|
3188
|
-
}
|
|
3189
|
-
)
|
|
3190
|
-
] }),
|
|
3191
|
-
/* @__PURE__ */ n($, { type: "inner", title: "调度", style: { marginBottom: 16 }, children: [
|
|
3192
|
-
/* @__PURE__ */ e(
|
|
3193
|
-
P.Item,
|
|
3194
|
-
{
|
|
3195
|
-
label: "Cron 表达式",
|
|
3196
|
-
name: "cronExpr",
|
|
3197
|
-
rules: [{ required: !0, message: "请输入 Cron" }],
|
|
3198
|
-
extra: "Quartz 兼容, 例如 0 */5 * * * ? = 每 5 分钟",
|
|
3199
|
-
children: /* @__PURE__ */ e(N, { addonAfter: /* @__PURE__ */ e(
|
|
3200
|
-
Z,
|
|
3201
|
-
{
|
|
3202
|
-
style: { width: 140 },
|
|
3203
|
-
placeholder: "常用",
|
|
3204
|
-
options: Xn,
|
|
3205
|
-
onChange: (u) => S.setFieldValue("cronExpr", u),
|
|
3206
|
-
value: null
|
|
3207
|
-
}
|
|
3208
|
-
) })
|
|
3209
|
-
}
|
|
3210
|
-
),
|
|
3211
|
-
/* @__PURE__ */ n(R, { size: "large", children: [
|
|
3212
|
-
/* @__PURE__ */ e(P.Item, { label: "启用", name: "enabled", valuePropName: "checked", children: /* @__PURE__ */ n(ne.Group, { children: [
|
|
3213
|
-
/* @__PURE__ */ e(ne.Button, { value: !0, children: "启用" }),
|
|
3214
|
-
/* @__PURE__ */ e(ne.Button, { value: !1, children: "停用" })
|
|
3215
|
-
] }) }),
|
|
3216
|
-
/* @__PURE__ */ e(
|
|
3217
|
-
P.Item,
|
|
3218
|
-
{
|
|
3219
|
-
label: "最小间隔 (秒)",
|
|
3220
|
-
name: "minIntervalSec",
|
|
3221
|
-
extra: "距上次 run 至少 N 秒",
|
|
3222
|
-
children: /* @__PURE__ */ e(Le, { min: 0, max: 3600 })
|
|
3223
|
-
}
|
|
3224
|
-
),
|
|
3225
|
-
/* @__PURE__ */ e(P.Item, { label: "单次最多条数", name: "maxItemsPerRun", children: /* @__PURE__ */ e(Le, { min: 1, max: 1e4 }) })
|
|
3226
|
-
] })
|
|
3227
|
-
] }),
|
|
3228
|
-
/* @__PURE__ */ e(
|
|
3229
|
-
W,
|
|
3230
|
-
{
|
|
3231
|
-
type: "success",
|
|
3232
|
-
showIcon: !0,
|
|
3233
|
-
title: "保存后会自动 dry-run: 真实 HTTP 一次, 把响应喂给抽取器, 失败时订阅进入 INVALID_AUTH 状态, 不会自动调度."
|
|
3234
|
-
}
|
|
3235
|
-
)
|
|
3236
|
-
]
|
|
3237
|
-
}
|
|
3238
|
-
) }) })
|
|
3239
|
-
] });
|
|
3240
|
-
}
|
|
3241
|
-
const Wn = {
|
|
3242
|
-
PENDING: "default",
|
|
3243
|
-
RUNNING: "processing",
|
|
3244
|
-
SUCCESS: "green",
|
|
3245
|
-
EMPTY: "default",
|
|
3246
|
-
FAILED: "red",
|
|
3247
|
-
FATAL: "red"
|
|
3248
|
-
};
|
|
3249
|
-
function Zn() {
|
|
3250
|
-
const [t, a] = h([]), [r, S] = h(null), [s, d] = h([]), [l, A] = h([]), [g, x] = h(null), [b, m] = h(!1);
|
|
3251
|
-
G(() => {
|
|
3252
|
-
c();
|
|
3253
|
-
}, []), G(() => {
|
|
3254
|
-
r && k(r);
|
|
3255
|
-
}, [r]);
|
|
3256
|
-
const c = async () => {
|
|
3257
|
-
try {
|
|
3258
|
-
const v = await B.get("/subscribe/subscription/list"), u = (v == null ? void 0 : v.data) ?? v ?? [];
|
|
3259
|
-
a(Array.isArray(u) ? u : []), Array.isArray(u) && u.length > 0 && S(u[0].id);
|
|
3260
|
-
} catch {
|
|
3261
|
-
w.error("加载订阅列表失败");
|
|
3262
|
-
}
|
|
3263
|
-
}, k = async (v) => {
|
|
3264
|
-
m(!0);
|
|
3265
|
-
try {
|
|
3266
|
-
const u = await B.get(`/subscribe/run/list?subscriptionId=${v}&limit=50`), _ = (u == null ? void 0 : u.data) ?? u ?? [];
|
|
3267
|
-
d(Array.isArray(_) ? _ : []);
|
|
3268
|
-
} catch {
|
|
3269
|
-
w.error("加载运行历史失败");
|
|
3270
|
-
} finally {
|
|
3271
|
-
m(!1);
|
|
3272
|
-
}
|
|
3273
|
-
}, O = async (v) => {
|
|
3274
|
-
x(v);
|
|
3275
|
-
try {
|
|
3276
|
-
const u = await B.get(`/subscribe/run/${v}/items?limit=200`), _ = (u == null ? void 0 : u.data) ?? u ?? [];
|
|
3277
|
-
A(Array.isArray(_) ? _ : []);
|
|
3278
|
-
} catch {
|
|
3279
|
-
w.error("加载抽取项失败");
|
|
3280
|
-
}
|
|
3281
|
-
}, y = s.reduce((v, u) => v + (u.successCount || 0), 0), I = s.reduce((v, u) => v + (u.deadLetterCount || 0), 0), o = s.reduce((v, u) => v + (u.duplicateCount || 0), 0);
|
|
3282
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
3283
|
-
/* @__PURE__ */ e(
|
|
3284
|
-
ye,
|
|
3285
|
-
{
|
|
3286
|
-
title: "订阅中心 - 运行历史",
|
|
3287
|
-
subtitle: "查看各订阅的抽取运行记录与统计"
|
|
3288
|
-
}
|
|
3289
|
-
),
|
|
3290
|
-
/* @__PURE__ */ e(
|
|
3291
|
-
Jt,
|
|
3292
|
-
{
|
|
3293
|
-
left: /* @__PURE__ */ e(
|
|
3294
|
-
Z,
|
|
3295
|
-
{
|
|
3296
|
-
style: { width: 280 },
|
|
3297
|
-
placeholder: "选择订阅",
|
|
3298
|
-
value: r,
|
|
3299
|
-
onChange: S,
|
|
3300
|
-
options: t.map((v) => ({ value: v.id, label: v.name })),
|
|
3301
|
-
showSearch: !0,
|
|
3302
|
-
optionFilterProp: "label"
|
|
3303
|
-
}
|
|
3304
|
-
),
|
|
3305
|
-
right: /* @__PURE__ */ n("a", { onClick: () => r && k(r), children: [
|
|
3306
|
-
/* @__PURE__ */ e(ee, {}),
|
|
3307
|
-
" 刷新"
|
|
3308
|
-
] })
|
|
3309
|
-
}
|
|
3310
|
-
),
|
|
3311
|
-
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
3312
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(H, { title: "run 总数", value: s.length }) }) }),
|
|
3313
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
3314
|
-
H,
|
|
3315
|
-
{
|
|
3316
|
-
title: "成功条数",
|
|
3317
|
-
value: y,
|
|
3318
|
-
styles: { content: { color: "#3f8600" } }
|
|
3319
|
-
}
|
|
3320
|
-
) }) }),
|
|
3321
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(
|
|
3322
|
-
H,
|
|
3323
|
-
{
|
|
3324
|
-
title: "死信条数",
|
|
3325
|
-
value: I,
|
|
3326
|
-
styles: { content: { color: "#cf1322" } }
|
|
3327
|
-
}
|
|
3328
|
-
) }) }),
|
|
3329
|
-
/* @__PURE__ */ e(M, { span: 6, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(H, { title: "重复跳过", value: o }) }) })
|
|
3330
|
-
] }),
|
|
3331
|
-
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
3332
|
-
/* @__PURE__ */ e(M, { span: 12, children: /* @__PURE__ */ e(
|
|
3333
|
-
le,
|
|
3334
|
-
{
|
|
3335
|
-
cardTitle: `运行列表 (${s.length})`,
|
|
3336
|
-
rows: s,
|
|
3337
|
-
rowKey: "id",
|
|
3338
|
-
loading: b,
|
|
3339
|
-
searchKeys: ["id", "status"],
|
|
3340
|
-
searchPlaceholder: "按 run ID / 状态过滤",
|
|
3341
|
-
emptyTitle: "暂无运行记录",
|
|
3342
|
-
emptyDescription: "该订阅还没有运行过,点右上角「刷新」或等下一次调度。",
|
|
3343
|
-
cardProps: { variant: "borderless", size: "small" },
|
|
3344
|
-
onRow: (v) => ({
|
|
3345
|
-
onClick: () => O(v.id),
|
|
3346
|
-
style: { cursor: "pointer", background: v.id === g ? "#e6f7ff" : "" }
|
|
3347
|
-
}),
|
|
3348
|
-
columns: [
|
|
3349
|
-
{ title: "ID", dataIndex: "id", width: 60 },
|
|
3350
|
-
{
|
|
3351
|
-
title: "计划",
|
|
3352
|
-
dataIndex: "scheduledAt",
|
|
3353
|
-
width: 150,
|
|
3354
|
-
render: (v) => v ? new Date(v).toLocaleString() : "-"
|
|
3355
|
-
},
|
|
3356
|
-
{ title: "耗时", dataIndex: "durationMs", width: 80 },
|
|
3357
|
-
{
|
|
3358
|
-
title: "状态",
|
|
3359
|
-
dataIndex: "status",
|
|
3360
|
-
width: 80,
|
|
3361
|
-
render: (v) => /* @__PURE__ */ e(C, { color: Wn[v], children: v })
|
|
3362
|
-
},
|
|
3363
|
-
{
|
|
3364
|
-
title: "拉取/成功/死信",
|
|
3365
|
-
width: 150,
|
|
3366
|
-
render: (v, u) => `${u.fetchedCount} / ${u.successCount} / ${u.deadLetterCount}`
|
|
3367
|
-
}
|
|
3368
|
-
]
|
|
3369
|
-
}
|
|
3370
|
-
) }),
|
|
3371
|
-
/* @__PURE__ */ e(M, { span: 12, children: /* @__PURE__ */ e(
|
|
3372
|
-
le,
|
|
3373
|
-
{
|
|
3374
|
-
cardTitle: g ? `run#${g} 抽取项 (${l.length})` : "抽取项",
|
|
3375
|
-
rows: l,
|
|
3376
|
-
rowKey: "id",
|
|
3377
|
-
searchKeys: ["dedupKey", "status"],
|
|
3378
|
-
searchPlaceholder: "按 dedupKey / 状态过滤",
|
|
3379
|
-
emptyTitle: g ? "该 run 无抽取项" : "暂无抽取项",
|
|
3380
|
-
emptyDescription: g ? "这次运行没有产生抽取项。" : "点击左侧「运行列表」中的 run 查看抽取项。",
|
|
3381
|
-
cardProps: { variant: "borderless", size: "small" },
|
|
3382
|
-
columns: [
|
|
3383
|
-
{ title: "id", dataIndex: "dedupKey", width: 160, ellipsis: !0 },
|
|
3384
|
-
{
|
|
3385
|
-
title: "title",
|
|
3386
|
-
dataIndex: "normalized",
|
|
3387
|
-
render: (v) => {
|
|
3388
|
-
try {
|
|
3389
|
-
return JSON.parse(v).title || "(无标题)";
|
|
3390
|
-
} catch {
|
|
3391
|
-
return v;
|
|
3392
|
-
}
|
|
3393
|
-
}
|
|
3394
|
-
},
|
|
3395
|
-
{
|
|
3396
|
-
title: "link",
|
|
3397
|
-
dataIndex: "normalized",
|
|
3398
|
-
width: 60,
|
|
3399
|
-
render: (v) => {
|
|
3400
|
-
try {
|
|
3401
|
-
const u = JSON.parse(v);
|
|
3402
|
-
return u.link ? /* @__PURE__ */ e("a", { href: u.link, target: "_blank", children: "↗" }) : "-";
|
|
3403
|
-
} catch {
|
|
3404
|
-
return "-";
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
},
|
|
3408
|
-
{
|
|
3409
|
-
title: "状态",
|
|
3410
|
-
dataIndex: "status",
|
|
3411
|
-
width: 100,
|
|
3412
|
-
render: (v) => /* @__PURE__ */ e(C, { children: v })
|
|
3413
|
-
}
|
|
3414
|
-
]
|
|
3415
|
-
}
|
|
3416
|
-
) })
|
|
3417
|
-
] })
|
|
3418
|
-
] });
|
|
3419
|
-
}
|
|
3420
|
-
function Jn() {
|
|
3421
|
-
return /* @__PURE__ */ n(yt, { children: [
|
|
3422
|
-
/* @__PURE__ */ e(re, { index: !0, element: /* @__PURE__ */ e(gt, { to: "list", replace: !0 }) }),
|
|
3423
|
-
/* @__PURE__ */ e(re, { path: "list", element: /* @__PURE__ */ e(Fn, {}) }),
|
|
3424
|
-
/* @__PURE__ */ e(re, { path: "new", element: /* @__PURE__ */ e(ut, {}) }),
|
|
3425
|
-
/* @__PURE__ */ e(re, { path: "edit/:id", element: /* @__PURE__ */ e(ut, {}) }),
|
|
3426
|
-
/* @__PURE__ */ e(re, { path: "runs", element: /* @__PURE__ */ e(Zn, {}) })
|
|
3427
|
-
] });
|
|
3428
|
-
}
|
|
3429
|
-
const Sr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3430
|
-
__proto__: null,
|
|
3431
|
-
default: Jn
|
|
3432
|
-
}, Symbol.toStringTag, { value: "Module" })), Vn = {
|
|
3433
|
-
OPEN: { color: "blue", text: "待开始" },
|
|
3434
|
-
IN_PROGRESS: { color: "green", text: "进行中" },
|
|
3435
|
-
COMPLETED: { color: "default", text: "已完成" },
|
|
3436
|
-
ARCHIVED: { color: "default", text: "已归档" }
|
|
3437
|
-
};
|
|
3438
|
-
function Yn() {
|
|
3439
|
-
const t = ke(), [a, r] = h("mine"), [S, s] = h([]), [d, l] = h(!1), [A, g] = h(null), x = async () => {
|
|
3440
|
-
l(!0), g(null);
|
|
3441
|
-
try {
|
|
3442
|
-
const c = a === "mine" ? "/project/list/mine?limit=100" : `/project/list/by-status?status=${a}&limit=100`, k = await B.get(c), O = (k == null ? void 0 : k.data) ?? k ?? [];
|
|
3443
|
-
s(Array.isArray(O) ? O : []);
|
|
3444
|
-
} catch (c) {
|
|
3445
|
-
g((c == null ? void 0 : c.message) || (c == null ? void 0 : c.msg) || "加载失败");
|
|
3446
|
-
} finally {
|
|
3447
|
-
l(!1);
|
|
3448
|
-
}
|
|
3449
|
-
};
|
|
3450
|
-
G(() => {
|
|
3451
|
-
x();
|
|
3452
|
-
}, [a]);
|
|
3453
|
-
const b = async (c) => {
|
|
3454
|
-
try {
|
|
3455
|
-
const k = await B.post(`/project/${c}/status?status=COMPLETED`);
|
|
3456
|
-
k && k.success !== !1 && (w.success("已标记完成"), x());
|
|
3457
|
-
} catch (k) {
|
|
3458
|
-
w.error("操作失败: " + ((k == null ? void 0 : k.message) || ""));
|
|
3459
|
-
}
|
|
3460
|
-
};
|
|
3461
|
-
return /* @__PURE__ */ n("div", { children: [
|
|
3462
|
-
/* @__PURE__ */ e(
|
|
3463
|
-
ye,
|
|
3464
|
-
{
|
|
3465
|
-
title: "项目中心",
|
|
3466
|
-
subtitle: "管理由 CEO 立项的项目与 Agent 对话上下文",
|
|
3467
|
-
breadcrumb: [{ label: "项目中心" }]
|
|
3468
|
-
}
|
|
3469
|
-
),
|
|
3470
|
-
A && !d && /* @__PURE__ */ e("div", { style: { marginBottom: 16 }, children: /* @__PURE__ */ e(Vt, { error: A, onRetry: x }) }),
|
|
3471
|
-
/* @__PURE__ */ n("div", { style: {
|
|
3472
|
-
background: "#ffffff",
|
|
3473
|
-
borderRadius: 16,
|
|
3474
|
-
padding: 20,
|
|
3475
|
-
boxShadow: "0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06)"
|
|
3476
|
-
}, children: [
|
|
3477
|
-
/* @__PURE__ */ e(
|
|
3478
|
-
Se,
|
|
3479
|
-
{
|
|
3480
|
-
activeKey: a,
|
|
3481
|
-
onChange: r,
|
|
3482
|
-
tabBarExtraContent: /* @__PURE__ */ n(R, { children: [
|
|
3483
|
-
/* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(ee, {}), onClick: x, loading: d, children: "刷新" }),
|
|
3484
|
-
/* @__PURE__ */ e(
|
|
3485
|
-
E,
|
|
3486
|
-
{
|
|
3487
|
-
type: "primary",
|
|
3488
|
-
icon: /* @__PURE__ */ e(kt, {}),
|
|
3489
|
-
onClick: () => t("/project/new"),
|
|
3490
|
-
children: "新建项目"
|
|
3491
|
-
}
|
|
3492
|
-
)
|
|
3493
|
-
] }),
|
|
3494
|
-
items: [
|
|
3495
|
-
{ key: "mine", label: "我的进行中" },
|
|
3496
|
-
{ key: "OPEN", label: "待开始" },
|
|
3497
|
-
{ key: "IN_PROGRESS", label: "进行中" },
|
|
3498
|
-
{ key: "COMPLETED", label: "已完成" }
|
|
3499
|
-
]
|
|
3500
|
-
}
|
|
3501
|
-
),
|
|
3502
|
-
/* @__PURE__ */ e(
|
|
3503
|
-
le,
|
|
3504
|
-
{
|
|
3505
|
-
rows: S,
|
|
3506
|
-
columns: [
|
|
3507
|
-
{ title: "ID", dataIndex: "id", width: 60 },
|
|
3508
|
-
{
|
|
3509
|
-
title: "名称",
|
|
3510
|
-
dataIndex: "name",
|
|
3511
|
-
render: (c, k) => /* @__PURE__ */ n(R, { orientation: "vertical", size: 0, children: [
|
|
3512
|
-
/* @__PURE__ */ e("a", { onClick: () => t(`/project/${k.id}`), style: { fontWeight: 500 }, children: c }),
|
|
3513
|
-
k.description && /* @__PURE__ */ e("span", { style: { color: "#999", fontSize: 12 }, children: k.description })
|
|
3514
|
-
] })
|
|
3515
|
-
},
|
|
3516
|
-
{ title: "来源", dataIndex: "sourceType", width: 100, render: (c) => /* @__PURE__ */ e(C, { children: c }) },
|
|
3517
|
-
{
|
|
3518
|
-
title: "订阅",
|
|
3519
|
-
dataIndex: "sourceSubscriptionId",
|
|
3520
|
-
width: 80,
|
|
3521
|
-
render: (c) => c ? `#${c}` : /* @__PURE__ */ e("span", { style: { color: "#ccc" }, children: "-" })
|
|
3522
|
-
},
|
|
3523
|
-
{
|
|
3524
|
-
title: "状态",
|
|
3525
|
-
dataIndex: "status",
|
|
3526
|
-
width: 100,
|
|
3527
|
-
render: (c) => {
|
|
3528
|
-
const k = Vn[c] || { color: "default", text: c };
|
|
3529
|
-
return /* @__PURE__ */ e(C, { color: k.color, children: k.text });
|
|
3530
|
-
}
|
|
3531
|
-
},
|
|
3532
|
-
{ title: "消息数", dataIndex: "messageCount", width: 80 },
|
|
3533
|
-
{
|
|
3534
|
-
title: "上下文",
|
|
3535
|
-
width: 130,
|
|
3536
|
-
render: (c, k) => /* @__PURE__ */ n(C, { color: "blue", children: [
|
|
3537
|
-
k.contextSize || 0,
|
|
3538
|
-
"B"
|
|
3539
|
-
] })
|
|
3540
|
-
},
|
|
3541
|
-
{
|
|
3542
|
-
title: "最近活动",
|
|
3543
|
-
dataIndex: "lastMessageAt",
|
|
3544
|
-
width: 150,
|
|
3545
|
-
render: (c) => c ? new Date(c).toLocaleString() : /* @__PURE__ */ e("span", { style: { color: "#ccc" }, children: "-" })
|
|
3546
|
-
},
|
|
3547
|
-
{
|
|
3548
|
-
title: "操作",
|
|
3549
|
-
width: 160,
|
|
3550
|
-
render: (c, k) => /* @__PURE__ */ n(R, { size: 4, children: [
|
|
3551
|
-
/* @__PURE__ */ e(E, { type: "link", size: "small", onClick: () => t(`/project/${k.id}`), children: "对话" }),
|
|
3552
|
-
k.status !== "COMPLETED" && k.status !== "ARCHIVED" && /* @__PURE__ */ e(
|
|
3553
|
-
He,
|
|
3554
|
-
{
|
|
3555
|
-
title: "标记为已完成?",
|
|
3556
|
-
onConfirm: () => b(k.id),
|
|
3557
|
-
okButtonProps: { danger: !0 },
|
|
3558
|
-
children: /* @__PURE__ */ e(E, { type: "link", size: "small", icon: /* @__PURE__ */ e(We, {}), children: "完成" })
|
|
3559
|
-
}
|
|
3560
|
-
)
|
|
3561
|
-
] })
|
|
3562
|
-
}
|
|
3563
|
-
],
|
|
3564
|
-
rowKey: "id",
|
|
3565
|
-
loading: d,
|
|
3566
|
-
searchKeys: ["name", "id"],
|
|
3567
|
-
searchPlaceholder: "按项目名称 / ID 过滤",
|
|
3568
|
-
emptyTitle: "还没有项目",
|
|
3569
|
-
emptyDescription: "立项一个项目, 让 Agent 围绕目标持续推进对话与任务",
|
|
3570
|
-
emptyActionText: "新建第一个项目",
|
|
3571
|
-
emptyOnAction: () => t("/project/new"),
|
|
3572
|
-
tableProps: { size: "middle" },
|
|
3573
|
-
cardProps: { variant: "borderless", styles: { body: { padding: 0 } } }
|
|
3574
|
-
}
|
|
3575
|
-
)
|
|
3576
|
-
] })
|
|
3577
|
-
] });
|
|
3578
|
-
}
|
|
3579
|
-
const Qn = [
|
|
3580
|
-
{ value: "general", label: "通用助手" },
|
|
3581
|
-
{ value: "analyst", label: "分析师" },
|
|
3582
|
-
{ value: "writer", label: "写手" },
|
|
3583
|
-
{ value: "pm", label: "产品经理" },
|
|
3584
|
-
{ value: "ops", label: "运营" }
|
|
3585
|
-
];
|
|
3586
|
-
function er() {
|
|
3587
|
-
const t = ke(), [a] = At(), [r] = P.useForm(), [S, s] = h(!1), [d, l] = h("from-subscribe"), [A, g] = h([]), [x, b] = h([]), [m, c] = h(!1), [k, O] = h([]), [y, I] = h(null);
|
|
3588
|
-
G(() => {
|
|
3589
|
-
const _ = a.get("subscriptionId"), f = a.get("itemIds");
|
|
3590
|
-
_ && (I(Number(_)), r.setFieldValue("sourceSubscriptionId", Number(_)), v(_)), f && O(f.split(",").map(Number).filter(Boolean));
|
|
3591
|
-
}, [a]), G(() => {
|
|
3592
|
-
o();
|
|
3593
|
-
}, []);
|
|
3594
|
-
const o = async () => {
|
|
3595
|
-
try {
|
|
3596
|
-
const _ = await B.get("/subscribe/subscription/list"), f = (_ == null ? void 0 : _.data) ?? _ ?? [];
|
|
3597
|
-
g(Array.isArray(f) ? f.filter((D) => D.status === "VERIFIED") : []);
|
|
3598
|
-
} catch {
|
|
3599
|
-
}
|
|
3600
|
-
}, v = async (_) => {
|
|
3601
|
-
c(!0);
|
|
3602
|
-
try {
|
|
3603
|
-
const f = await B.get(`/subscribe/run/list?subscriptionId=${_}&limit=1`), D = (f == null ? void 0 : f.data) ?? f ?? [];
|
|
3604
|
-
if (D.length === 0) {
|
|
3605
|
-
b([]);
|
|
3606
|
-
return;
|
|
3607
|
-
}
|
|
3608
|
-
const K = D[0], p = await B.get(`/subscribe/run/${K.id}/items?limit=100`), i = (p == null ? void 0 : p.data) ?? p ?? [];
|
|
3609
|
-
b(Array.isArray(i) ? i : []);
|
|
3610
|
-
} catch {
|
|
3611
|
-
w.error("加载抽取项失败");
|
|
3612
|
-
} finally {
|
|
3613
|
-
c(!1);
|
|
3614
|
-
}
|
|
3615
|
-
};
|
|
3616
|
-
return /* @__PURE__ */ e("div", { style: { padding: 24 }, children: /* @__PURE__ */ e(
|
|
3617
|
-
$,
|
|
3618
|
-
{
|
|
3619
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
3620
|
-
/* @__PURE__ */ e(E, { type: "text", icon: /* @__PURE__ */ e(St, {}), onClick: () => t("/project/list") }),
|
|
3621
|
-
/* @__PURE__ */ e(Ge, {}),
|
|
3622
|
-
"新建项目 (立项)"
|
|
3623
|
-
] }),
|
|
3624
|
-
extra: /* @__PURE__ */ n(R, { children: [
|
|
3625
|
-
/* @__PURE__ */ e(E, { onClick: () => t("/project/list"), children: "取消" }),
|
|
3626
|
-
/* @__PURE__ */ e(
|
|
3627
|
-
E,
|
|
3628
|
-
{
|
|
3629
|
-
type: "primary",
|
|
3630
|
-
icon: /* @__PURE__ */ e(It, {}),
|
|
3631
|
-
loading: S,
|
|
3632
|
-
onClick: async () => {
|
|
3633
|
-
try {
|
|
3634
|
-
const _ = await r.validateFields();
|
|
3635
|
-
if (d === "from-subscribe" && k.length === 0) {
|
|
3636
|
-
w.warning("请至少选 1 个 item");
|
|
3637
|
-
return;
|
|
3638
|
-
}
|
|
3639
|
-
s(!0);
|
|
3640
|
-
const f = {
|
|
3641
|
-
..._,
|
|
3642
|
-
sourceItemIds: d === "from-subscribe" ? k.map(String) : null
|
|
3643
|
-
}, D = d === "from-subscribe" ? "/project/create-from-items" : "/project/create-manual", K = await B.post(D, f);
|
|
3644
|
-
if (K && K.success !== !1) {
|
|
3645
|
-
const p = K.data ?? K;
|
|
3646
|
-
w.success("立项成功"), t(`/project/${p.id}`);
|
|
3647
|
-
} else
|
|
3648
|
-
w.error((K == null ? void 0 : K.message) || "立项失败");
|
|
3649
|
-
} catch (_) {
|
|
3650
|
-
_ != null && _.errorFields || w.error("立项失败: " + ((_ == null ? void 0 : _.message) || ""));
|
|
3651
|
-
} finally {
|
|
3652
|
-
s(!1);
|
|
3653
|
-
}
|
|
3654
|
-
},
|
|
3655
|
-
children: "立项"
|
|
3656
|
-
}
|
|
3657
|
-
)
|
|
3658
|
-
] }),
|
|
3659
|
-
children: /* @__PURE__ */ n(P, { form: r, layout: "vertical", initialValues: { agentRole: "general" }, children: [
|
|
3660
|
-
/* @__PURE__ */ e(P.Item, { label: "来源", children: /* @__PURE__ */ n(ne.Group, { value: d, onChange: (_) => l(_.target.value), children: [
|
|
3661
|
-
/* @__PURE__ */ e(ne.Button, { value: "from-subscribe", children: "从订阅线索立项 (主路径)" }),
|
|
3662
|
-
/* @__PURE__ */ e(ne.Button, { value: "manual", children: "手动立项 (无源数据)" })
|
|
3663
|
-
] }) }),
|
|
3664
|
-
/* @__PURE__ */ e(P.Item, { label: "项目名称", name: "name", rules: [{ required: !0, message: "请输入名称" }], children: /* @__PURE__ */ e(N, { placeholder: "例如: 跟进 GitHub 高优 Issue" }) }),
|
|
3665
|
-
/* @__PURE__ */ e(P.Item, { label: "项目描述", name: "description", children: /* @__PURE__ */ e(N.TextArea, { rows: 2, placeholder: "(可选) 这个项目要解决什么?" }) }),
|
|
3666
|
-
d === "from-subscribe" && /* @__PURE__ */ n($, { type: "inner", title: "源数据", style: { marginBottom: 16 }, children: [
|
|
3667
|
-
/* @__PURE__ */ e(
|
|
3668
|
-
P.Item,
|
|
3669
|
-
{
|
|
3670
|
-
label: "选择订阅",
|
|
3671
|
-
name: "sourceSubscriptionId",
|
|
3672
|
-
rules: [{ required: !0, message: "请选订阅" }],
|
|
3673
|
-
children: /* @__PURE__ */ e(
|
|
3674
|
-
Z,
|
|
3675
|
-
{
|
|
3676
|
-
placeholder: "选择订阅 (拉取最近一次 run 的 items)",
|
|
3677
|
-
options: A.map((_) => ({ value: _.id, label: `#${_.id} ${_.name}` })),
|
|
3678
|
-
onChange: (_) => {
|
|
3679
|
-
I(_), v(_), O([]);
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
)
|
|
3683
|
-
}
|
|
3684
|
-
),
|
|
3685
|
-
y && /* @__PURE__ */ n(Pe, { spinning: m, children: [
|
|
3686
|
-
/* @__PURE__ */ n("div", { style: { marginBottom: 8 }, children: [
|
|
3687
|
-
/* @__PURE__ */ n(C, { color: "blue", children: [
|
|
3688
|
-
"已选 ",
|
|
3689
|
-
k.length,
|
|
3690
|
-
" / ",
|
|
3691
|
-
x.length
|
|
3692
|
-
] }),
|
|
3693
|
-
/* @__PURE__ */ e(
|
|
3694
|
-
E,
|
|
3695
|
-
{
|
|
3696
|
-
size: "small",
|
|
3697
|
-
onClick: () => O(x.map((_) => _.id)),
|
|
3698
|
-
children: "全选"
|
|
3699
|
-
}
|
|
3700
|
-
),
|
|
3701
|
-
/* @__PURE__ */ e(
|
|
3702
|
-
E,
|
|
3703
|
-
{
|
|
3704
|
-
size: "small",
|
|
3705
|
-
onClick: () => O([]),
|
|
3706
|
-
style: { marginLeft: 4 },
|
|
3707
|
-
children: "清空"
|
|
3708
|
-
}
|
|
3709
|
-
)
|
|
3710
|
-
] }),
|
|
3711
|
-
/* @__PURE__ */ e(
|
|
3712
|
-
le,
|
|
3713
|
-
{
|
|
3714
|
-
rows: x,
|
|
3715
|
-
rowKey: "id",
|
|
3716
|
-
rowSelection: {
|
|
3717
|
-
selectedRowKeys: k,
|
|
3718
|
-
onChange: O
|
|
3719
|
-
},
|
|
3720
|
-
searchKeys: ["dedupKey"],
|
|
3721
|
-
searchPlaceholder: "按 dedupKey 过滤",
|
|
3722
|
-
emptyTitle: "暂无源数据",
|
|
3723
|
-
emptyDescription: "该订阅最近一次运行没有抽取项,换一个订阅或先让订阅跑一次。",
|
|
3724
|
-
cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
|
|
3725
|
-
columns: [
|
|
3726
|
-
{ title: "id", dataIndex: "dedupKey", width: 160, ellipsis: !0 },
|
|
3727
|
-
{
|
|
3728
|
-
title: "title",
|
|
3729
|
-
dataIndex: "normalized",
|
|
3730
|
-
render: (_) => {
|
|
3731
|
-
try {
|
|
3732
|
-
return JSON.parse(_).title || "(无)";
|
|
3733
|
-
} catch {
|
|
3734
|
-
return _;
|
|
3735
|
-
}
|
|
3736
|
-
}
|
|
3737
|
-
},
|
|
3738
|
-
{
|
|
3739
|
-
title: "fetched",
|
|
3740
|
-
dataIndex: "fetchedAt",
|
|
3741
|
-
width: 150,
|
|
3742
|
-
render: (_) => _ ? new Date(_).toLocaleString() : "-"
|
|
3743
|
-
}
|
|
3744
|
-
]
|
|
3745
|
-
}
|
|
3746
|
-
)
|
|
3747
|
-
] })
|
|
3748
|
-
] }),
|
|
3749
|
-
/* @__PURE__ */ n($, { type: "inner", title: "Agent 配置", style: { marginBottom: 16 }, children: [
|
|
3750
|
-
/* @__PURE__ */ e(P.Item, { label: "Agent 角色", name: "agentRole", extra: "决定 system prompt 的语气 / 视角", children: /* @__PURE__ */ e(Z, { options: Qn }) }),
|
|
3751
|
-
/* @__PURE__ */ e(
|
|
3752
|
-
P.Item,
|
|
3753
|
-
{
|
|
3754
|
-
label: "模型 (可选)",
|
|
3755
|
-
name: "modelCode",
|
|
3756
|
-
extra: "留空走默认 (智能中心 LLM 凭证里第一个 enabled)",
|
|
3757
|
-
children: /* @__PURE__ */ e(N, { placeholder: "例如: gpt-4 / deepseek-chat" })
|
|
3758
|
-
}
|
|
3759
|
-
)
|
|
3760
|
-
] }),
|
|
3761
|
-
/* @__PURE__ */ e(
|
|
3762
|
-
W,
|
|
3763
|
-
{
|
|
3764
|
-
type: "info",
|
|
3765
|
-
showIcon: !0,
|
|
3766
|
-
title: "立项后源数据会被快照 (context_snapshot), 后续订阅更新不会影响项目上下文."
|
|
3767
|
-
}
|
|
3768
|
-
)
|
|
3769
|
-
] })
|
|
3770
|
-
}
|
|
3771
|
-
) });
|
|
3772
|
-
}
|
|
3773
|
-
const pt = {
|
|
3774
|
-
USER: { color: "blue", icon: /* @__PURE__ */ e(ft, {}), label: "CEO" },
|
|
3775
|
-
ASSISTANT: { color: "purple", icon: /* @__PURE__ */ e(Ue, {}), label: "Agent" },
|
|
3776
|
-
SYSTEM: { color: "default", icon: null, label: "系统" }
|
|
3777
|
-
}, tr = {
|
|
3778
|
-
OPEN: { color: "blue", text: "待开始" },
|
|
3779
|
-
IN_PROGRESS: { color: "green", text: "进行中" },
|
|
3780
|
-
COMPLETED: { color: "default", text: "已完成" },
|
|
3781
|
-
ARCHIVED: { color: "default", text: "已归档" }
|
|
3782
|
-
};
|
|
3783
|
-
function nr() {
|
|
3784
|
-
const { id: t } = mt(), a = ke(), [r, S] = h(null), [s, d] = h([]), [l, A] = h(""), [g, x] = h(!1), b = ht(null);
|
|
3785
|
-
G(() => {
|
|
3786
|
-
t && m();
|
|
3787
|
-
}, [t]), G(() => {
|
|
3788
|
-
b.current && (b.current.scrollTop = b.current.scrollHeight);
|
|
3789
|
-
}, [s]);
|
|
3790
|
-
const m = async () => {
|
|
3791
|
-
try {
|
|
3792
|
-
const [y, I] = await Promise.all([
|
|
3793
|
-
B.get(`/project/${t}`),
|
|
3794
|
-
B.get(`/project/${t}/messages`)
|
|
3795
|
-
]);
|
|
3796
|
-
S((y == null ? void 0 : y.data) ?? y), d(Array.isArray((I == null ? void 0 : I.data) ?? I) ? (I == null ? void 0 : I.data) ?? I : []);
|
|
3797
|
-
} catch {
|
|
3798
|
-
w.error("加载项目失败");
|
|
3799
|
-
}
|
|
3800
|
-
}, c = async () => {
|
|
3801
|
-
if (!l.trim()) return;
|
|
3802
|
-
const y = l.trim();
|
|
3803
|
-
A(""), x(!0);
|
|
3804
|
-
const I = { seq: -1, role: "USER", content: y, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
3805
|
-
d((o) => [...o, I]);
|
|
3806
|
-
try {
|
|
3807
|
-
const o = await B.post(`/project/${t}/chat`, { message: y });
|
|
3808
|
-
if (o && o.success !== !1) {
|
|
3809
|
-
const u = (o.data ?? o).message;
|
|
3810
|
-
d((_) => [..._.filter((D) => D.seq !== -1), ...u ? [u] : []]), setTimeout(m, 100);
|
|
3811
|
-
} else
|
|
3812
|
-
w.error((o == null ? void 0 : o.message) || "发送失败");
|
|
3813
|
-
} catch (o) {
|
|
3814
|
-
w.error("发送失败: " + ((o == null ? void 0 : o.message) || ""));
|
|
3815
|
-
} finally {
|
|
3816
|
-
x(!1);
|
|
3817
|
-
}
|
|
3818
|
-
}, k = async () => {
|
|
3819
|
-
try {
|
|
3820
|
-
const y = await B.post(`/project/${t}/status?status=COMPLETED`);
|
|
3821
|
-
y && y.success !== !1 && (w.success("已标记完成"), m());
|
|
3822
|
-
} catch {
|
|
3823
|
-
w.error("操作失败");
|
|
3824
|
-
}
|
|
3825
|
-
};
|
|
3826
|
-
if (!r) return /* @__PURE__ */ e("div", { style: { padding: 24 }, children: /* @__PURE__ */ e(Pe, {}) });
|
|
3827
|
-
const O = tr[r.status] || { color: "default", text: r.status };
|
|
3828
|
-
return /* @__PURE__ */ n("div", { style: { padding: 24, height: "calc(100vh - 64px)", display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
3829
|
-
/* @__PURE__ */ n(
|
|
3830
|
-
$,
|
|
3831
|
-
{
|
|
3832
|
-
title: /* @__PURE__ */ n(R, { children: [
|
|
3833
|
-
/* @__PURE__ */ e(E, { type: "text", icon: /* @__PURE__ */ e(St, {}), onClick: () => a("/project/list") }),
|
|
3834
|
-
/* @__PURE__ */ e(Ge, {}),
|
|
3835
|
-
/* @__PURE__ */ e("span", { style: { fontWeight: 500 }, children: r.name }),
|
|
3836
|
-
/* @__PURE__ */ e(C, { color: O.color, children: O.text })
|
|
3837
|
-
] }),
|
|
3838
|
-
extra: /* @__PURE__ */ n(R, { children: [
|
|
3839
|
-
r.contextSize > 0 && /* @__PURE__ */ n(C, { color: "blue", children: [
|
|
3840
|
-
"上下文 ",
|
|
3841
|
-
r.contextSize,
|
|
3842
|
-
" B"
|
|
3843
|
-
] }),
|
|
3844
|
-
/* @__PURE__ */ e(C, { children: r.agentRole }),
|
|
3845
|
-
r.modelCode && /* @__PURE__ */ e(C, { color: "purple", children: r.modelCode }),
|
|
3846
|
-
r.status !== "COMPLETED" && r.status !== "ARCHIVED" && /* @__PURE__ */ e(He, { title: "标记完成?", onConfirm: k, children: /* @__PURE__ */ e(E, { icon: /* @__PURE__ */ e(We, {}), children: "标记完成" }) })
|
|
3847
|
-
] }),
|
|
3848
|
-
children: [
|
|
3849
|
-
r.description && /* @__PURE__ */ e("div", { style: { color: "#666", marginBottom: 8 }, children: r.description }),
|
|
3850
|
-
/* @__PURE__ */ n(R, { size: "large", children: [
|
|
3851
|
-
/* @__PURE__ */ e(H, { title: "消息数", value: r.messageCount || 0 }),
|
|
3852
|
-
r.sourceSubscriptionId && /* @__PURE__ */ e(H, { title: "来源订阅", value: `#${r.sourceSubscriptionId}` }),
|
|
3853
|
-
/* @__PURE__ */ e(
|
|
3854
|
-
H,
|
|
3855
|
-
{
|
|
3856
|
-
title: "立项",
|
|
3857
|
-
value: r.createdAt ? new Date(r.createdAt).toLocaleString() : "-"
|
|
3858
|
-
}
|
|
3859
|
-
)
|
|
3860
|
-
] })
|
|
3861
|
-
]
|
|
3862
|
-
}
|
|
3863
|
-
),
|
|
3864
|
-
/* @__PURE__ */ n(
|
|
3865
|
-
$,
|
|
3866
|
-
{
|
|
3867
|
-
style: { flex: 1, display: "flex", flexDirection: "column" },
|
|
3868
|
-
styles: { body: { flex: 1, display: "flex", flexDirection: "column", padding: 0 } },
|
|
3869
|
-
children: [
|
|
3870
|
-
/* @__PURE__ */ e("div", { ref: b, style: { flex: 1, overflow: "auto", padding: 16, background: "#fafafa" }, children: s.length === 0 ? /* @__PURE__ */ e(Pt, { description: "还没有消息, 跟 Agent 说点什么?" }) : /* @__PURE__ */ n(R, { orientation: "vertical", style: { width: "100%" }, size: "middle", children: [
|
|
3871
|
-
s.map((y) => {
|
|
3872
|
-
const I = pt[y.role] || pt.SYSTEM, o = y.role === "USER";
|
|
3873
|
-
return /* @__PURE__ */ e("div", { style: {
|
|
3874
|
-
display: "flex",
|
|
3875
|
-
justifyContent: o ? "flex-end" : "flex-start"
|
|
3876
|
-
}, children: /* @__PURE__ */ n("div", { style: {
|
|
3877
|
-
maxWidth: "70%",
|
|
3878
|
-
background: o ? "#1677ff" : "#fff",
|
|
3879
|
-
color: o ? "#fff" : "#000",
|
|
3880
|
-
border: o ? "none" : "1px solid #e8e8e8",
|
|
3881
|
-
borderRadius: 8,
|
|
3882
|
-
padding: "10px 14px",
|
|
3883
|
-
boxShadow: "0 1px 2px rgba(0,0,0,0.04)"
|
|
3884
|
-
}, children: [
|
|
3885
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 12, opacity: 0.7, marginBottom: 4 }, children: /* @__PURE__ */ n(R, { size: 4, children: [
|
|
3886
|
-
I.icon,
|
|
3887
|
-
I.label,
|
|
3888
|
-
y.seq > 0 && /* @__PURE__ */ n("span", { children: [
|
|
3889
|
-
"#",
|
|
3890
|
-
y.seq
|
|
3891
|
-
] }),
|
|
3892
|
-
y.latencyMs > 0 && /* @__PURE__ */ n("span", { children: [
|
|
3893
|
-
"· ",
|
|
3894
|
-
y.latencyMs,
|
|
3895
|
-
"ms"
|
|
3896
|
-
] }),
|
|
3897
|
-
y.modelCode && /* @__PURE__ */ n("span", { children: [
|
|
3898
|
-
"· ",
|
|
3899
|
-
y.modelCode
|
|
3900
|
-
] })
|
|
3901
|
-
] }) }),
|
|
3902
|
-
/* @__PURE__ */ e("div", { style: { whiteSpace: "pre-wrap", wordBreak: "break-word" }, children: y.content })
|
|
3903
|
-
] }) }, y.id || y.seq);
|
|
3904
|
-
}),
|
|
3905
|
-
g && /* @__PURE__ */ e("div", { style: { display: "flex", justifyContent: "flex-start" }, children: /* @__PURE__ */ n("div", { style: {
|
|
3906
|
-
background: "#fff",
|
|
3907
|
-
border: "1px solid #e8e8e8",
|
|
3908
|
-
borderRadius: 8,
|
|
3909
|
-
padding: "10px 14px"
|
|
3910
|
-
}, children: [
|
|
3911
|
-
/* @__PURE__ */ e(Pe, { size: "small" }),
|
|
3912
|
-
" 思考中..."
|
|
3913
|
-
] }) })
|
|
3914
|
-
] }) }),
|
|
3915
|
-
r.status === "COMPLETED" || r.status === "ARCHIVED" ? /* @__PURE__ */ e(
|
|
3916
|
-
W,
|
|
3917
|
-
{
|
|
3918
|
-
style: { margin: 12, marginBottom: 0 },
|
|
3919
|
-
type: "info",
|
|
3920
|
-
title: "项目已完成 / 归档, 不再接受新消息",
|
|
3921
|
-
showIcon: !0
|
|
3922
|
-
}
|
|
3923
|
-
) : /* @__PURE__ */ n("div", { style: { borderTop: "1px solid #f0f0f0", padding: 12, display: "flex", gap: 8 }, children: [
|
|
3924
|
-
/* @__PURE__ */ e(
|
|
3925
|
-
N.TextArea,
|
|
3926
|
-
{
|
|
3927
|
-
value: l,
|
|
3928
|
-
onChange: (y) => A(y.target.value),
|
|
3929
|
-
onPressEnter: (y) => {
|
|
3930
|
-
y.shiftKey || (y.preventDefault(), c());
|
|
3931
|
-
},
|
|
3932
|
-
placeholder: "输入消息, Enter 发送 (Shift+Enter 换行)",
|
|
3933
|
-
autoSize: { minRows: 1, maxRows: 6 },
|
|
3934
|
-
disabled: g
|
|
3935
|
-
}
|
|
3936
|
-
),
|
|
3937
|
-
/* @__PURE__ */ e(
|
|
3938
|
-
E,
|
|
3939
|
-
{
|
|
3940
|
-
type: "primary",
|
|
3941
|
-
icon: /* @__PURE__ */ e(Gt, {}),
|
|
3942
|
-
loading: g,
|
|
3943
|
-
onClick: c,
|
|
3944
|
-
disabled: !l.trim(),
|
|
3945
|
-
children: "发送"
|
|
3946
|
-
}
|
|
3947
|
-
)
|
|
3948
|
-
] })
|
|
3949
|
-
]
|
|
3950
|
-
}
|
|
3951
|
-
)
|
|
3952
|
-
] });
|
|
3953
|
-
}
|
|
3954
|
-
function rr() {
|
|
3955
|
-
return /* @__PURE__ */ n(yt, { children: [
|
|
3956
|
-
/* @__PURE__ */ e(re, { index: !0, element: /* @__PURE__ */ e(gt, { to: "list", replace: !0 }) }),
|
|
3957
|
-
/* @__PURE__ */ e(re, { path: "list", element: /* @__PURE__ */ e(Yn, {}) }),
|
|
3958
|
-
/* @__PURE__ */ e(re, { path: "new", element: /* @__PURE__ */ e(er, {}) }),
|
|
3959
|
-
/* @__PURE__ */ e(re, { path: ":id", element: /* @__PURE__ */ e(nr, {}) })
|
|
3960
|
-
] });
|
|
3961
|
-
}
|
|
3962
|
-
const Cr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3963
|
-
__proto__: null,
|
|
3964
|
-
default: rr
|
|
3965
|
-
}, Symbol.toStringTag, { value: "Module" })), ar = "# z-team-component\n\nz-team(团队工作台)的**跨仓唯一前端面**:把「多模式工作台 / 模式切换 / z-opc 业务套件聚合 / 订阅域 / 项目域」\n这一整套团队工作台页面收敛成一个可复用的 React 组件包,由主壳(z-opc 主前端)挂载。\n\n- **npm 包名**:`@yuku123/z-team-component`\n- **宿主接入**:双入口 —— `.`(`ZTeamApp` / `SubscribeApp` / `ProjectApp`)与 `./pages`(`routes` / `appMeta` / `menuItems`)\n- **后端**:与 z-opc 主壳同源的 `/api/**`(axios `baseURL = '/api'`,Cookie 模式 `withCredentials`)\n- **技术栈**:React 19 + antd 6 + react-router-dom 7 + vite(**library mode**,双入口 `index` / `pages`,\n 基座与全部 `@yuku123/*` 一律 **external**,由消费方用自己的 node_modules 解析)\n\n> ⚠ z-team 是**主壳的总控包**:它自己不承载某个业务域,而是把 z-opc 的业务套件(`/ctc/*`、`/ai/*`、`/config/*` …)\n> 聚合进工作台外壳里渲染。所以本文档描述的是 **z-team 自身的能力**(工作台 / 模式切换 / 套件聚合 / 订阅 / 项目)。\n\n---\n\n## 一、能力概览\n\n### 1.1 顶层路由(`src/pages-manifest.ts` 的 `routes`)\n\n| 路由 | 组件 | 能力 |\n|------|------|------|\n| `/team/subscribe` | `SubscribeApp` | 订阅域:订阅列表 / 编辑 / 运行历史 |\n| `/team/project` | `ProjectApp` | 项目域:项目列表 / 创建 / 详情 |\n| `/team/docs` | `ComponentDocPage` | 本文件渲染页(左侧 240px TOC + 右侧正文) |\n| `/team/:rest*` | `ZTeamApp` | **兜底**:`ZTeamApp` 内部按 `useLocation().pathname` 懒加载分发到下面 15 个域 |\n\n`menuItems`:`/team/subscribe`(订阅)/ `/team/project`(项目)/ `/team/workspace`(工作台)/ `/team/docs`(组件文档,末项)。\n\n### 1.2 `ZTeamApp` 顶层分发(`src/zteam-adapter/App.tsx`)\n\n| pathname | 渲染的域 | 源文件 |\n|----------|----------|--------|\n| `/workspace` | 工作台 | `src/zteam/pages/workspace/index.tsx` |\n| `/workspace/phone` | 移动端工作台 | `src/zteam/pages/workspace/phone/index.tsx` |\n| `/workspace/from-ticket` | 从工单进入 | `src/zteam/pages/workspace/from-ticket.tsx` |\n| `/workspace/from-scenario` | 从场景进入 | `src/zteam/pages/workspace/from-scenario.tsx` |\n| `/workspace/build-by-form` | 表单构建 | `src/zteam/pages/workspace/build-by-form.tsx` |\n| `/scenario` | 场景 | `src/zteam/pages/scenario/index.tsx` |\n| `/admin` | 管理后台(走工作台外壳的 admin 分支) | `src/zteam/pages/admin/index.tsx` |\n| `/welcome` | 产品介绍 | `src/zteam/pages/welcome/index.tsx` |\n| `/portal` | 场景入口 | `src/zteam/pages/portal/index.tsx` |\n| `/chatdemo` | 聊天演示 | `src/zteam/pages/chatdemo/index.tsx` |\n| `/embed/chat` | 嵌入式聊天 | `src/zteam/pages/embed/chat/index.tsx` |\n| `/change-log` | 变更记录 | `src/zteam/pages/change-log/index.tsx` |\n| `/docs` | **操作手册页**(52KB 手写暗色主题页,**与本文件的组件文档页不是一回事**) | `src/zteam/pages/docs/index.tsx` |\n\n`src/zteam/pages/` 下共 **15 个域目录**:`admin` / `agenthub-digital-brain-test` / `change-log` / `chatdemo` /\n`docs` / `download` / `embed` / `login` / `note` / `phone` / `portal` / `rpa` / `scenario` / `welcome` / `workspace`。\n其中 `agenthub-digital-brain-test` / `download` / `login` / `note` / `rpa` **没有** `ZTeamApp` 顶层分支,\n由域内路由或别的入口进入。\n\n### 1.3 工作台模式切换(`src/zteam/pages/workspace/utils/chatMode.ts`)\n\n`ChatMode` 共 13 种:`personal` / `collaboration` / `smart` / `product` / `dev` / `test` / `ops` / `admin` /\n`system` / `life` / `training` / `rpa` / `knowledge`(默认 `collaboration`)。\n\n模式切换统一走 `history.push` 到对应顶层路由(`Layout/index.tsx` 的 `handleModeSwitch`):\n\n| 模式 | 落点 |\n|------|------|\n| `system` | `/ctc/4a/account`(z-opc 业务路径;已在业务路径上时不重复跳) |\n| `test` | `/test/qa/dashboard` |\n| `admin` | `/admin?mode=admin` |\n| `rpa` | `/rpa/dashboard` |\n| 其余模式 | `/workspace?mode=xxx`(必须带 `?desktop=1`,否则窄视口会被重定向到移动端工作台) |\n\n模式持久化在 URL query 上(`?mode=xxx`,`replaceState` 不污染历史记录);\n`/admin*` → `admin`、`/ops/*` → `ops`、`/lc/*` → `dev` 由 `readModeFromUrl()` 自动识别。\n\n### 1.4 套件聚合(`src/zteam/pages/workspace/components/Layout/SystemShell.tsx`)\n\n`SystemShell` 用一张 `SYSTEM_ROUTES` 表把 **z-opc 的业务套件**接进工作台的右侧内容区,\n用 `matchSystemPath()` 做 pathname 匹配(精确 → 通配 `*` / 参数 `:param`),支持 `/ctc/*`、`/ai/*`、`/config/*`、\n`/task/*`、`/workflow/*`、`/schedule/*`、`/mist/*`、`/meta/*`、`/msg/*`、`/rpc/*`、`/kb/*`、`/product/*`、`/ops/*` 等前缀。\n\n## 二、导出面\n\n```js\n// 主入口(. 桶):工作台主壳 + 订阅 / 项目域 + 公共设施\nimport ZTeamApp, {SubscribeApp, ProjectApp, history, isTokenExpired, ComponentDocPage}\n from '@yuku123/z-team-component'\n\n// 宿主组装面(./pages 桶):路由清单 + 菜单\nimport {routes, appMeta, menuItems, ComponentDocPage} from '@yuku123/z-team-component/pages'\n```\n\n- `routes`:`/team/subscribe`、`/team/project`、`/team/docs`、`/team/:rest*`(兜底)。\n- `appMeta`:`{ title: 'Z-OPC 一人公司基建', short: 'team' }`。\n- `ComponentDocPage`:组件文档页,**主入口与 `./pages` 桶都具名导出**(名字全仓统一,主壳按这个名字取)。\n\n## 三、API 端点\n\n请求实例由 `src/common/services/api.js` 的 axios 工厂创建:`baseURL = '/api'`(可用 `configureBaseURL()` 改),\n`timeout = 15000`,`withCredentials = true`(**Cookie 模式,不设 Authorization Header**)。\n下表路径是 `src/common/services/`、`src/services/`、`src/subscribe/services/`、`src/project/services/` 里\n**实际调用**的路径(已补上 `/api` 前缀)。\n\n| 方法 | 路径 | 说明 |\n|---|---|---|\n| POST | `/api/ctc/authn/login` | 登录 |\n| GET | `/api/ctc/authn/my-tenants` | 我的租户 |\n| POST | `/api/ctc/authn/select-tenant` | 选择租户 |\n| POST | `/api/ctc/authn/switch-tenant` | 切换租户 |\n| GET | `/api/ctc/app-menu/tree` | 应用菜单树 |\n| GET/POST | `/api/ctc/ac/invitations`、`/accept`、`/redeem`、`/leave` | 邀请(加入 / 兑换 / 退出) |\n| GET/POST | `/api/ctc/ac/invitations/members`、`/members/{memberId}/remove`、`/{id}/revoke` | 邀请成员管理 |\n| GET/POST/PUT/DELETE | `/api/agent/team/workspace`、`/workspace/{id}` | Agent 团队工作区 |\n| GET | `/api/agent/team/workspace/list`、`/file-tree-by-path`、`/file-content` | 工作区列表 / 文件树 / 文件内容 |\n| GET/POST/PUT/DELETE | `/api/agent/team/work-item`、`/work-item/{id}` | 工作项 |\n| GET | `/api/agent/team/conversation/{conversationId}/work-items` | 会话下的工作项 |\n| POST | `/api/agent/skill/register`、`/heartbeat`、`/pull`、`/sync-logs` | 技能注册 / 心跳 / 拉取 / 日志回传 |\n| POST/GET | `/api/agent/skill/bind`、`/unbind`、`/bindings` | 技能绑定 |\n| GET/POST/DELETE | `/api/agent/instance/list`、`/get`、`/create`、`/create-container`、`/create-external`、`/destroy-container`、`/destroy-local-process`、`/agent-types`、`/health`、`/status` | Agent 实例(容器 / 外部 / 本地进程) |\n| POST/GET | `/api/bot/feedback`、`/feedback/recent`、`/feedback/score` | Bot 反馈 |\n| GET | `/api/skill/get`、`/api/skill/page` | 技能查询 |\n| GET/POST | `/api/task`、`/task/list`、`/task/complete`、`/task/move`、`/task/project/list` | 任务 |\n| GET/POST | `/api/project`、`/api/project/archive`、`/api/project/user/list` | 项目 |\n| GET/POST/PUT/DELETE | `/api/mock-platform/{environments,endpoints,scenarios,cases,recordings,...}` | Mock 平台(`z-script-web` 的 `MockPlatformController`) |\n| GET | `/api/{name}/list`、`/api/{name}/page`、`/api/{name}/byId` | 通用 CRUD 工厂(`makeApi(name)`,`src/common/services/api.js`) |\n\n各服务模块另有自己的探活端点(`/api/agentTeam/health`、`/api/ctcAc/health`、`/api/ctcAcDomain/health`、\n`/api/ctcSurl/health`、`/api/ctcUser/health`、`/api/job/health`、`/api/metaApp/health`、\n`/api/privateConfig/health`、`/api/webide/health`)。\n\n## 四、页面说明\n\n### 4.1 工作台(`src/zteam/pages/workspace/`)\n\n工作台是本包最大的域,含 `Layout`(顶栏 + 模式切换 + 内容区)、`ProductWorkbench` / `SmartWorkbench` /\n`DevWorkbench` / `OpsWorkbench` 等工作台壳,以及聊天、笔记、代码编辑、知识图谱等通用组件。\n\n### 4.2 套件聚合壳(`SystemShell`)\n\n工作台的「系统」模式用它把 z-opc 业务页面(账号 / 角色 / 应用 / 租户 / 组织 / 权限 / 短链 / 字典 / 审计 /\nwebide / Agent / LLM / MCP / 技能 / OSS / 任务 / 流程 / 调度 / 密钥 / 运维 等)渲染进工作台右侧内容区,\n而不是回到 z-opc 旧 Layout。\n\n### 4.3 订阅域(`src/subscribe/pages/`)\n\n`SubscribeApp` + `SubscriptionList` / `SubscriptionEdit` / `RunHistory`:订阅的列表、编辑与运行历史。\n\n### 4.4 项目域(`src/project/pages/`)\n\n`ProjectApp` + `ProjectList` / `ProjectCreate` / `ProjectDetail`:项目的列表、创建与详情。\n\n### 4.5 组件文档\n\n本文件。内容以 `?raw` 在编译期内联,零额外请求;左侧 240px TOC 随滚动联动。\n渲染用基座的 `ComponentDoc`(`@yuku123/z-frontend-common/ui`),不在本包重写 TOC / 两栏 / 滚动联动。\n\n## 五、配置\n\n| 配置项 | 默认值 | 说明 |\n|---|---|---|\n| `configureBaseURL(baseURL)` | `'/api'` | 改写 axios `baseURL`(`src/common/services/api.js`) |\n| 请求 `timeout` | `15000` | axios 实例默认值 |\n| `withCredentials` | `true` | Cookie 模式;**不设 Authorization Header** |\n| vite `external` | 25 个精确包 + 4 条前缀规则 | `react` / `react-dom` / `antd` / `@ant-design/icons` / `@yuku123/*` / `@zopc-mock/*` / `echarts/*` / `highlight.js/*` 等一律 external,**消费方必须自备** |\n| vite alias | `@` → `src/`、`@zteam` → `src/zteam/` | 仅 standalone 构建用;打包后路径已解析 |\n| 模式 URL 参数 | `?mode=xxx` | 持久化在 query 上;`collaboration` 是默认值,不写入 URL |\n| `?desktop=1` | — | 强制桌面版工作台(窄视口默认跳 `/workspace/phone`) |\n\n## 六、已知限制\n\n- **`/team/docs` 目前没有可达路径**:主壳 `z-opc-main-starter-frontend/src/domainRoutes.ts` 的 `DOMAINS` 数组里\n **没有注册 z-team 域**(截至 2026-10-23),所以 z-team 的 `routes` 清单还没有被主壳消费。\n ⇒ 需要主控决定是否接线(注册 z-team 域,或在主壳里显式挂 `ComponentDocPage`)。\n- **`ZTeamApp` 内部没有 `/team/docs` 分支**:它按**绝对 pathname** 分发(`/workspace`、`/scenario`、`/docs` …),\n 未知路径兜底渲染工作台。所以即使走了 `/team/:rest*` 兜底路由,`/team/docs` 也会落进工作台而不是文档页。\n (`ZTeamApp` 不在本批次的改动范围内,需要单独接线。)\n- **已有另一个「文档页」**:`src/zteam/pages/docs/index.tsx` 是 52KB 的手写暗色主题**操作手册**页,\n 路由是 `/docs`。它与本 §7 的**组件文档页**不是一回事(内容、样式、来源都不同),别混淆。\n- **本仓没有 `tsconfig.json`,构建不做类型检查**(`npm run build` = `vite build` + 产物守卫脚本)。\n 基座只发 JS 不发 `.d.ts`,`src/z-frontend-common-ui.d.ts` 是手写的最小声明;\n 新增基座组件时要同步补声明(当前该声明文件里**还没有** `ComponentDoc`,因为本包的文档页走的是 `.jsx`,不参与类型检查)。\n- **组件包必须 external 基座**:`@yuku123/z-frontend-common/ui` 在 dist 里保持裸 import,\n 消费方(主壳)必须自己装基座,否则会出现两份 UI 主题。\n- **工作台下的部分工作台壳仍在改造中**(`ProductWorkbench` / `SmartWorkbench` 等),页面结构可能继续变,\n 本文档只描述到「域 + 顶层路由 + 模式」这一层,域内二级页面未逐页展开。\n- **请求是 Cookie 模式**:后端 `SsoInterceptor` 靠 `Accept` / `Content-Type` 判断「是不是 API 请求」,\n 裸 `fetch` 不带 `Accept` 会被当成页面访问而 302 跳登录页(构建产物有 `guard-fetch-accept.mjs` 守卫)。\n\n## 七、变更记录\n\n| 版本 | 变更 |\n|---|---|\n| 0.2.30(未发布) | 新增组件文档页 `ComponentDocPage`(lead 008 §7):`src/DOC.md` + 基座 `ComponentDoc` 薄包装 + 菜单末项 `/team/docs` |\n| 0.2.30 | 工作台模式体系(13 种 `ChatMode`)+ `SystemShell` 套件聚合 + 订阅 / 项目双域 |\n";
|
|
3966
|
-
function Tr() {
|
|
3967
|
-
return /* @__PURE__ */ e(Yt, { markdown: ar, title: "组件文档 — Z-OPC 一人公司基建" });
|
|
3968
|
-
}
|
|
3969
|
-
export {
|
|
3970
|
-
Tr as C,
|
|
3971
|
-
Fe as E,
|
|
3972
|
-
Qt as M,
|
|
3973
|
-
Ir as O,
|
|
3974
|
-
rr as P,
|
|
3975
|
-
Ln as R,
|
|
3976
|
-
Jn as S,
|
|
3977
|
-
On as T,
|
|
3978
|
-
yr as Z,
|
|
3979
|
-
gr as a,
|
|
3980
|
-
sn as b,
|
|
3981
|
-
kr as c,
|
|
3982
|
-
Ke as d,
|
|
3983
|
-
$n as e,
|
|
3984
|
-
xr as f,
|
|
3985
|
-
hr as g,
|
|
3986
|
-
fr as h,
|
|
3987
|
-
xn as i,
|
|
3988
|
-
Dn as j,
|
|
3989
|
-
Rn as k,
|
|
3990
|
-
Je as l,
|
|
3991
|
-
Cn as m,
|
|
3992
|
-
nn as n,
|
|
3993
|
-
br as o,
|
|
3994
|
-
Sr as p,
|
|
3995
|
-
Cr as q,
|
|
3996
|
-
B as r,
|
|
3997
|
-
mr as s
|
|
3998
|
-
};
|