@yuku123/z-team-component 0.2.52 → 0.2.54
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-nPAmM1X0.js → ChangeLogView-Cstbioyw.js} +137 -137
- package/dist/{ComponentDoc-Cky9jCGu.js → ComponentDoc-yvIrAz9-.js} +506 -461
- package/dist/{InvitationManagementPage-BsbaIGvB.js → InvitationManagementPage-CIouC3Fn.js} +1 -1
- package/dist/{OnboardingPage-CHVgeBiO.js → OnboardingPage-DScwVCi-.js} +2 -2
- package/dist/ScheduledTasks-Dd2lJrBF.js +9449 -0
- package/dist/{SystemShell-4OiqvM11.js → SystemShell-DtvyWy0u.js} +1 -1
- package/dist/{admin-logs-D6HtRcK6.js → admin-logs-B9KS6VJz.js} +2 -2
- package/dist/{api-C78tCfne.js → api-CALqShkO.js} +288 -270
- package/dist/{api-BT968Uwc.js → api-CdVRdA0g.js} +1 -1
- package/dist/createWorkspaceWsHandler-CL5-4wFp.js +13037 -0
- package/dist/{index-BX1Wd9x9.js → index-4YxdJwFm.js} +3 -3
- package/dist/index-7Pe_xBrh.js +582 -0
- package/dist/{index-DFY3lzq0.js → index-C2Wkg1b5.js} +3 -3
- package/dist/{index-CdlfWFvS.js → index-C3B7CbHo.js} +610 -529
- package/dist/{index-BkX0I2aB.js → index-C6S3MIu4.js} +56 -56
- package/dist/{index-BAY37t4f.js → index-CGWttFLb.js} +41 -35
- package/dist/{index-LwKUkzKI.js → index-CKS65_Dw.js} +3 -3
- package/dist/{index-Bdu31aRV.js → index-CLWgeKwr.js} +2 -2
- package/dist/{index-DxFZKDq-.js → index-C_2o9qgM.js} +6 -6
- package/dist/index-CgQH7-9F.js +130 -0
- package/dist/{index-B_C7H9WL.js → index-D6V-4vNa.js} +5 -5
- package/dist/index-DC5lxCN8.js +474 -0
- package/dist/{index-D9AqC2O-.js → index-DET70T3j.js} +1 -1
- package/dist/index-DEx5rtXv.js +242 -0
- package/dist/{index-DpcrvKsK.js → index-DJOyOVn_.js} +87 -74
- package/dist/{index-qK6pyAGy.js → index-DKeYG0Fu.js} +4 -4
- package/dist/index-DLQoecEe.js +1143 -0
- package/dist/{index-CR3sbzOU.js → index-DLyAy3cr.js} +7 -7
- package/dist/index-DOygBsXO.js +2826 -0
- package/dist/index-DRrBkbr_.js +100 -0
- package/dist/index-DWsfQMp8.js +208 -0
- package/dist/index-Pk7OkJrk.js +1133 -0
- package/dist/index-TDZM-Zv3.js +9287 -0
- package/dist/index-WIsi8fln.js +339 -0
- package/dist/{index-BAK7UDvY.js → index-aw72ID7y.js} +1 -1
- package/dist/{index-ClA0896K.js → index-lftFkqfI.js} +4 -4
- package/dist/{index-JMzBzwiO.js → index-usrA11ZG.js} +618 -617
- package/dist/index.js +1 -1
- package/dist/{instance-D5dhjbgg.js → instance-f3C-1qYl.js} +3 -3
- package/dist/pages.js +1 -1
- package/dist/schedule-DfkgwPdE.js +497 -0
- package/dist/{send-default-agent-team-message-C882sJLV.js → send-default-agent-team-message-d_ECdczr.js} +1 -1
- package/dist/{sso-user-Bi9_l9yi.js → sso-user-HcsSzg8P.js} +1 -1
- package/dist/{training-Ba09KItE.js → training-DnNQN0An.js} +1 -1
- package/dist/{useAppStore-ibJyVIAX.js → useAppStore-kRZEA5WZ.js} +19 -19
- package/dist/webide-DPjFYxLl.js +7845 -0
- package/dist/z-team-component.css +2 -2
- package/package.json +1 -1
- package/dist/SmartWorkbench.module-xRRmpTTw.js +0 -85
- package/dist/createWorkspaceWsHandler-mq-UTF2O.js +0 -13028
- package/dist/index-7nSly-MA.js +0 -405
- package/dist/index-B11_fFjX.js +0 -1182
- package/dist/index-B3-0eXYQ.js +0 -844
- package/dist/index-Cp3DAwNx.js +0 -13862
- package/dist/index-NaBR2aQE.js +0 -6685
- package/dist/index-UsGqMo11.js +0 -848
- package/dist/schedule-C-4ksDPw.js +0 -239
- package/dist/webide-RsFP9pHM.js +0 -8087
|
@@ -1,41 +1,84 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as Me } from "react/jsx-runtime";
|
|
2
|
-
import { lazy as
|
|
3
|
-
import { useLocation as
|
|
4
|
-
import { Row as Y, Col as O, Typography as ae, Alert as
|
|
5
|
-
import { SettingOutlined as
|
|
2
|
+
import { lazy as wt, Suspense as kt, useState as m, useEffect as K, useRef as ot } from "react";
|
|
3
|
+
import { useLocation as It, useNavigate as xe, useParams as ct, Routes as dt, Route as re, Navigate as ut, useSearchParams as St } from "react-router-dom";
|
|
4
|
+
import { Row as Y, Col as O, Typography as ae, Alert as W, Card as L, Space as E, Button as A, Table as Q, Drawer as we, Descriptions as z, Tag as w, Tooltip as he, message as b, Modal as me, Statistic as F, Input as B, Select as Z, Tabs as ke, Form as P, Upload as Tt, Popconfirm as Ue, Spin as _e, Radio as ne, InputNumber as Re, Empty as Ct } from "antd";
|
|
5
|
+
import { SettingOutlined as vt, ProjectOutlined as Pe, UserOutlined as pt, AuditOutlined as De, RobotOutlined as $e, ApiOutlined as qe, AppstoreOutlined as At, ThunderboltOutlined as be, BarChartOutlined as _t, ScheduleOutlined as Pt, FileTextOutlined as Fe, ReloadOutlined as ee, ExperimentOutlined as Et, PlayCircleOutlined as Ee, CopyOutlined as ht, GlobalOutlined as mt, NodeIndexOutlined as zt, UndoOutlined as Rt, FileSearchOutlined as Ot, VideoCameraOutlined as Xe, SearchOutlined as yt, EyeOutlined as Lt, CodeOutlined as fe, InfoCircleOutlined as Mt, FunctionOutlined as Se, ImportOutlined as Ne, CloudUploadOutlined as Ze, FileAddOutlined as Dt, PlusOutlined as gt, EditOutlined as $t, PauseCircleOutlined as Nt, CheckCircleOutlined as Ke, DeleteOutlined as Bt, ExclamationCircleOutlined as jt, SaveOutlined as ft, ArrowLeftOutlined as bt, SendOutlined as Ut } from "@ant-design/icons";
|
|
6
6
|
import "@yuku123/z-frontend-common";
|
|
7
|
-
import { PageHeader as ye, GradientStatCard as Te, SectionHeader as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
import { PageHeader as ye, GradientStatCard as Te, SectionHeader as qt, FeatureCard as Ft, DarkBanner as Kt, ListTable as se, TableToolbar as Ht, ErrorState as Gt, ComponentDoc as Wt } from "@yuku123/z-frontend-common/ui";
|
|
8
|
+
import He from "axios";
|
|
9
|
+
const Xt = [
|
|
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
|
+
], Zt = [
|
|
35
|
+
"/script/keys",
|
|
36
|
+
"/script/monitor",
|
|
37
|
+
"/script/quota",
|
|
38
|
+
"/script/version",
|
|
39
|
+
"/script/tag"
|
|
40
|
+
], Jt = [
|
|
41
|
+
"/ops",
|
|
42
|
+
// DevOps 运维 + 部署编排(渠道/环境/部署/仓库)
|
|
43
|
+
"/resource"
|
|
44
|
+
// 资源管理(域名 / ECS / RDS / OSS)
|
|
45
|
+
];
|
|
46
|
+
function Je(t, l) {
|
|
47
|
+
return t === l || t.startsWith(l + "/");
|
|
48
|
+
}
|
|
49
|
+
function Vt(t) {
|
|
50
|
+
return t ? Jt.some((l) => Je(t, l)) ? "ops" : Zt.includes(t) || Xt.some((l) => Je(t, l)) ? "middleware" : "system" : "system";
|
|
18
51
|
}
|
|
19
|
-
|
|
52
|
+
const J = (t) => {
|
|
53
|
+
const l = wt(t);
|
|
54
|
+
return (r) => /* @__PURE__ */ e(kt, { fallback: null, children: /* @__PURE__ */ e(l, { ...r }) });
|
|
55
|
+
}, oe = J(() => import("./index-TDZM-Zv3.js").then((t) => t.a4)), Yt = J(() => import("./index-DC5lxCN8.js")), Qt = J(() => import("./index-4YxdJwFm.js")), en = J(() => import("./index-lftFkqfI.js")), tn = J(() => import("./index-DKeYG0Fu.js")), nn = J(() => import("./index-CLWgeKwr.js"));
|
|
56
|
+
J(() => import("./index-DLyAy3cr.js"));
|
|
57
|
+
const rn = J(() => import("./index-C815hPWS.js")), an = J(() => import("./index-Pk7OkJrk.js")), ln = J(() => import("./index-C6S3MIu4.js")), sn = J(() => import("./index-DET70T3j.js")), on = J(() => import("./index-DJOyOVn_.js")), cn = J(() => import("./index-WIsi8fln.js")), dn = J(() => import("./index-C2Wkg1b5.js"));
|
|
58
|
+
function lr({ forcedMode: t }) {
|
|
59
|
+
const { pathname: l } = It(), r = l.replace(/\/+$/, "") || "/";
|
|
60
|
+
return t === "system" ? /* @__PURE__ */ e(oe, { forcedChatMode: Vt(r) }) : t === "rpa" ? /* @__PURE__ */ e(oe, { forcedChatMode: "rpa" }) : t === "dev" ? /* @__PURE__ */ e(oe, { forcedChatMode: "dev" }) : r === "/workspace" ? /* @__PURE__ */ e(oe, {}) : r === "/workspace/phone" ? /* @__PURE__ */ e(Yt, {}) : r === "/workspace/from-ticket" ? /* @__PURE__ */ e(Qt, {}) : r === "/workspace/from-scenario" ? /* @__PURE__ */ e(en, {}) : r === "/workspace/build-by-form" ? /* @__PURE__ */ e(tn, {}) : r === "/scenario" ? /* @__PURE__ */ e(nn, {}) : r === "/admin" ? /* @__PURE__ */ e(oe, {}) : r === "/welcome" ? /* @__PURE__ */ e(an, {}) : r === "/portal" ? /* @__PURE__ */ e(ln, {}) : r === "/chatdemo" ? /* @__PURE__ */ e(rn, {}) : r === "/embed/chat" || r.startsWith("/embed/chat/") ? /* @__PURE__ */ e(dn, {}) : r === "/change-log" ? /* @__PURE__ */ e(sn, {}) : r === "/docs" ? /* @__PURE__ */ e(on, {}) : r === "/download" ? /* @__PURE__ */ e(cn, {}) : /* @__PURE__ */ e(oe, {});
|
|
61
|
+
}
|
|
62
|
+
function un(t) {
|
|
20
63
|
if (!t || typeof t != "string") return null;
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
64
|
+
const l = t.split(".");
|
|
65
|
+
if (l.length !== 3) return null;
|
|
23
66
|
try {
|
|
24
|
-
let r =
|
|
67
|
+
let r = l[1].replace(/-/g, "+").replace(/_/g, "/");
|
|
25
68
|
const S = r.length % 4;
|
|
26
69
|
S && (r += "=".repeat(4 - S));
|
|
27
|
-
const
|
|
70
|
+
const s = atob(r), y = Uint8Array.from(s, (x) => x.charCodeAt(0)), c = new TextDecoder().decode(y), f = JSON.parse(c);
|
|
28
71
|
return f && typeof f == "object" && !Array.isArray(f) ? f : null;
|
|
29
72
|
} catch {
|
|
30
73
|
return null;
|
|
31
74
|
}
|
|
32
75
|
}
|
|
33
|
-
function
|
|
34
|
-
const r =
|
|
35
|
-
return !r || typeof r.exp != "number" ? !0 : Date.now() / 1e3 > r.exp -
|
|
76
|
+
function pn(t, l = 30) {
|
|
77
|
+
const r = un(t);
|
|
78
|
+
return !r || typeof r.exp != "number" ? !0 : Date.now() / 1e3 > r.exp - l;
|
|
36
79
|
}
|
|
37
|
-
let
|
|
38
|
-
const
|
|
80
|
+
let Ve = !1;
|
|
81
|
+
const hn = [
|
|
39
82
|
"/ctc/authn/login",
|
|
40
83
|
"/ctc/authn/register",
|
|
41
84
|
"/ctc/authn/send-code",
|
|
@@ -53,67 +96,67 @@ const sn = [
|
|
|
53
96
|
"/sso/login",
|
|
54
97
|
"/sso/callback"
|
|
55
98
|
];
|
|
56
|
-
function
|
|
57
|
-
return
|
|
99
|
+
function mn(t) {
|
|
100
|
+
return hn.some((l) => t.includes(l));
|
|
58
101
|
}
|
|
59
|
-
function
|
|
60
|
-
if (
|
|
61
|
-
|
|
102
|
+
function Ye(t) {
|
|
103
|
+
if (Ve || typeof window > "u" || window.location.pathname.startsWith("/login")) return;
|
|
104
|
+
Ve = !0;
|
|
62
105
|
try {
|
|
63
106
|
localStorage.removeItem("token"), localStorage.removeItem("userInfo");
|
|
64
107
|
} catch {
|
|
65
108
|
}
|
|
66
109
|
console.warn(`[Auth] ${t}, 跳转到 /login`);
|
|
67
|
-
const
|
|
110
|
+
const l = window.location.pathname + window.location.search, r = encodeURIComponent(l);
|
|
68
111
|
window.location.href = `/login?redirect=${r}`;
|
|
69
112
|
}
|
|
70
|
-
function
|
|
113
|
+
function yn(t) {
|
|
71
114
|
if (t && typeof t == "object" && "code" in t && "data" in t) {
|
|
72
|
-
const
|
|
73
|
-
return (typeof
|
|
115
|
+
const l = t;
|
|
116
|
+
return (typeof l.success == "boolean" ? l.success : typeof l.code == "number" && l.code >= 200 && l.code < 300) ? l.data : Promise.reject(new Error(l.message || "请求失败"));
|
|
74
117
|
}
|
|
75
118
|
return t;
|
|
76
119
|
}
|
|
77
|
-
function
|
|
78
|
-
const { tokenKey: r = "token", userInfoKey: S = "userInfo" } =
|
|
79
|
-
t.interceptors.request.use((
|
|
120
|
+
function gn(t, l = {}) {
|
|
121
|
+
const { tokenKey: r = "token", userInfoKey: S = "userInfo" } = l;
|
|
122
|
+
t.interceptors.request.use((s) => {
|
|
80
123
|
const y = localStorage.getItem(r);
|
|
81
|
-
if (y &&
|
|
82
|
-
return
|
|
124
|
+
if (y && pn(y))
|
|
125
|
+
return Ye(`请求前检测到 token 已过期 (${s.url || ""})`), Promise.reject(new He.CanceledError("token expired"));
|
|
83
126
|
try {
|
|
84
127
|
const c = localStorage.getItem(S);
|
|
85
128
|
if (c) {
|
|
86
|
-
const f = JSON.parse(c), x = f.tenantCode || "default", C = f.domainCode || "default", _ = f.id ?? f.userId, h = (
|
|
87
|
-
if (typeof
|
|
88
|
-
const a =
|
|
129
|
+
const f = JSON.parse(c), x = f.tenantCode || "default", C = f.domainCode || "default", _ = f.id ?? f.userId, h = (s.method || "get").toLowerCase();
|
|
130
|
+
if (typeof s.url == "string" && s.url.includes("/ctc/ac/") && (s.params = { ...s.params || {} }, s.params.tenantCode || (s.params.tenantCode = x), s.params.domainCode || (s.params.domainCode = C)), _ != null && (s.headers["X-User-Id"] = String(_)), h !== "get" && h !== "delete" && s.data && typeof s.data == "object") {
|
|
131
|
+
const a = s.data;
|
|
89
132
|
a.tenantCode == null && (a.tenantCode = x), a.domainCode == null && (a.domainCode = C);
|
|
90
133
|
}
|
|
91
134
|
}
|
|
92
135
|
} catch {
|
|
93
136
|
}
|
|
94
|
-
return
|
|
137
|
+
return s;
|
|
95
138
|
}), t.interceptors.response.use(
|
|
96
|
-
(
|
|
97
|
-
(
|
|
139
|
+
(s) => yn(s.data),
|
|
140
|
+
(s) => {
|
|
98
141
|
var f, x;
|
|
99
|
-
const y = (f =
|
|
100
|
-
return y === 401 ?
|
|
142
|
+
const y = (f = s.response) == null ? void 0 : f.status, c = ((x = s.config) == null ? void 0 : x.url) || "";
|
|
143
|
+
return y === 401 ? mn(c) ? console.warn(`[401] 公开接口返回 401 (不是 token 问题): ${c}`) : Ye(`接口 ${c} 返回 401`) : y === 403 ? console.warn("[403] 没有权限访问该资源:", c) : y === 404 ? console.warn("[404] 接口不存在:", c) : y === 500 && console.error("[500] 服务器内部错误:", c), Promise.reject(s);
|
|
101
144
|
}
|
|
102
145
|
);
|
|
103
146
|
}
|
|
104
|
-
function
|
|
105
|
-
const
|
|
147
|
+
function Ge(t = {}) {
|
|
148
|
+
const l = He.create({
|
|
106
149
|
baseURL: t.baseURL ?? "/api",
|
|
107
150
|
timeout: t.timeout ?? 1e4,
|
|
108
151
|
withCredentials: !0
|
|
109
152
|
// Cookie 模式:浏览器自动携带 Cookie
|
|
110
153
|
});
|
|
111
|
-
return
|
|
154
|
+
return gn(l, {
|
|
112
155
|
tokenKey: t.tokenKey,
|
|
113
156
|
userInfoKey: t.userInfoKey
|
|
114
|
-
}),
|
|
157
|
+
}), l;
|
|
115
158
|
}
|
|
116
|
-
const $ =
|
|
159
|
+
const $ = Ge(), sr = Ge(), Ce = Ge({ baseURL: "/api", timeout: 1e4 }), ve = (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, fn = [
|
|
117
160
|
{
|
|
118
161
|
key: "ai",
|
|
119
162
|
color: "violet",
|
|
@@ -141,7 +184,7 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
141
184
|
{
|
|
142
185
|
title: "模板市场",
|
|
143
186
|
description: "精选 AI 应用模板, 一键复制即可使用",
|
|
144
|
-
icon: /* @__PURE__ */ e(
|
|
187
|
+
icon: /* @__PURE__ */ e(At, {}),
|
|
145
188
|
color: "pink",
|
|
146
189
|
tags: [{ label: "模板", color: "pink" }],
|
|
147
190
|
meta: "24 个模板"
|
|
@@ -167,14 +210,14 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
167
210
|
{
|
|
168
211
|
title: "任务仪表盘",
|
|
169
212
|
description: "实时任务执行情况, 成功率与时长统计",
|
|
170
|
-
icon: /* @__PURE__ */ e(
|
|
213
|
+
icon: /* @__PURE__ */ e(_t, {}),
|
|
171
214
|
color: "green",
|
|
172
215
|
tags: [{ label: "看板", color: "green" }]
|
|
173
216
|
},
|
|
174
217
|
{
|
|
175
218
|
title: "任务列表",
|
|
176
219
|
description: "所有定时/手动任务, 支持 Cron 表达式",
|
|
177
|
-
icon: /* @__PURE__ */ e(
|
|
220
|
+
icon: /* @__PURE__ */ e(Pt, {}),
|
|
178
221
|
color: "blue",
|
|
179
222
|
tags: [{ label: "调度", color: "blue" }]
|
|
180
223
|
},
|
|
@@ -205,31 +248,31 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
205
248
|
{
|
|
206
249
|
title: "待办任务",
|
|
207
250
|
description: "我的待审批任务, 实时推送",
|
|
208
|
-
icon: /* @__PURE__ */ e(
|
|
251
|
+
icon: /* @__PURE__ */ e(Fe, {}),
|
|
209
252
|
color: "red",
|
|
210
253
|
tags: [{ label: "待办", color: "red" }]
|
|
211
254
|
}
|
|
212
255
|
]
|
|
213
256
|
}
|
|
214
|
-
],
|
|
215
|
-
const [t,
|
|
257
|
+
], ir = () => {
|
|
258
|
+
const [t, l] = m({
|
|
216
259
|
configCount: null,
|
|
217
260
|
projectCount: null,
|
|
218
261
|
userCount: null,
|
|
219
262
|
roleCount: null
|
|
220
263
|
});
|
|
221
|
-
return
|
|
264
|
+
return K(() => {
|
|
222
265
|
let r = !0;
|
|
223
266
|
const S = [
|
|
224
|
-
Ce.get("/config/list", { params: { pageSize: 1 } }).then((
|
|
225
|
-
Ce.get("/project/user/list").then((
|
|
226
|
-
Ce.get("/ctc/ac/accounts", { params: { pageSize: 1 } }).then((
|
|
227
|
-
Ce.get("/ctc/authz/roles/list").then((
|
|
267
|
+
Ce.get("/config/list", { params: { pageSize: 1 } }).then((s) => ve(s)).then((s) => r && l((y) => ({ ...y, configCount: s }))).catch(() => r && l((s) => ({ ...s, configCount: 0 }))),
|
|
268
|
+
Ce.get("/project/user/list").then((s) => ve(s)).then((s) => r && l((y) => ({ ...y, projectCount: s }))).catch(() => r && l((s) => ({ ...s, projectCount: 0 }))),
|
|
269
|
+
Ce.get("/ctc/ac/accounts", { params: { pageSize: 1 } }).then((s) => ve(s)).then((s) => r && l((y) => ({ ...y, userCount: s }))).catch(() => r && l((s) => ({ ...s, userCount: 0 }))),
|
|
270
|
+
Ce.get("/ctc/authz/roles/list").then((s) => ve(s)).then((s) => r && l((y) => ({ ...y, roleCount: s }))).catch(() => r && l((s) => ({ ...s, roleCount: 0 })))
|
|
228
271
|
];
|
|
229
272
|
return () => {
|
|
230
|
-
r = !1, S.forEach((
|
|
273
|
+
r = !1, S.forEach((s) => {
|
|
231
274
|
var y;
|
|
232
|
-
return (y =
|
|
275
|
+
return (y = s == null ? void 0 : s.catch) == null ? void 0 : y.call(s, () => {
|
|
233
276
|
});
|
|
234
277
|
});
|
|
235
278
|
};
|
|
@@ -246,7 +289,7 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
246
289
|
/* @__PURE__ */ e(O, { xs: 24, sm: 12, md: 12, lg: 6, children: /* @__PURE__ */ e(
|
|
247
290
|
Te,
|
|
248
291
|
{
|
|
249
|
-
icon: /* @__PURE__ */ e(
|
|
292
|
+
icon: /* @__PURE__ */ e(vt, {}),
|
|
250
293
|
label: "配置中心",
|
|
251
294
|
value: t.configCount,
|
|
252
295
|
suffix: "条",
|
|
@@ -270,7 +313,7 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
270
313
|
/* @__PURE__ */ e(O, { xs: 24, sm: 12, md: 12, lg: 6, children: /* @__PURE__ */ e(
|
|
271
314
|
Te,
|
|
272
315
|
{
|
|
273
|
-
icon: /* @__PURE__ */ e(
|
|
316
|
+
icon: /* @__PURE__ */ e(pt, {}),
|
|
274
317
|
label: "账号数",
|
|
275
318
|
value: t.userCount,
|
|
276
319
|
suffix: "人",
|
|
@@ -292,9 +335,9 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
292
335
|
}
|
|
293
336
|
) })
|
|
294
337
|
] }),
|
|
295
|
-
|
|
338
|
+
fn.map((r) => /* @__PURE__ */ n("div", { style: { marginBottom: 32 }, children: [
|
|
296
339
|
/* @__PURE__ */ e(
|
|
297
|
-
|
|
340
|
+
qt,
|
|
298
341
|
{
|
|
299
342
|
color: r.color,
|
|
300
343
|
title: r.title,
|
|
@@ -302,7 +345,7 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
302
345
|
moreHref: r.href
|
|
303
346
|
}
|
|
304
347
|
),
|
|
305
|
-
/* @__PURE__ */ e(Y, { gutter: [16, 16], children: r.items.map((S,
|
|
348
|
+
/* @__PURE__ */ e(Y, { gutter: [16, 16], children: r.items.map((S, s) => /* @__PURE__ */ e(
|
|
306
349
|
O,
|
|
307
350
|
{
|
|
308
351
|
xs: 24,
|
|
@@ -312,7 +355,7 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
312
355
|
xl: 6,
|
|
313
356
|
xxl: 6,
|
|
314
357
|
children: /* @__PURE__ */ e(
|
|
315
|
-
|
|
358
|
+
Ft,
|
|
316
359
|
{
|
|
317
360
|
title: S.title,
|
|
318
361
|
description: S.description,
|
|
@@ -324,7 +367,7 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
324
367
|
}
|
|
325
368
|
)
|
|
326
369
|
},
|
|
327
|
-
|
|
370
|
+
s
|
|
328
371
|
)) })
|
|
329
372
|
] }, r.key)),
|
|
330
373
|
/* @__PURE__ */ e(
|
|
@@ -339,65 +382,65 @@ const $ = He(), er = He(), Ce = He({ baseURL: "/api", timeout: 1e4 }), ve = (t)
|
|
|
339
382
|
)
|
|
340
383
|
] });
|
|
341
384
|
};
|
|
342
|
-
let
|
|
343
|
-
function
|
|
344
|
-
return
|
|
385
|
+
let bn = "/api";
|
|
386
|
+
function xt() {
|
|
387
|
+
return He.create({ baseURL: bn, timeout: 15e3, withCredentials: !0 });
|
|
345
388
|
}
|
|
346
|
-
const Ie =
|
|
347
|
-
|
|
389
|
+
const Ie = xt(), xn = xt();
|
|
390
|
+
xn.interceptors.request.use((t) => t);
|
|
348
391
|
Ie.interceptors.request.use((t) => t);
|
|
349
|
-
const ze = "/mock-platform",
|
|
350
|
-
stats: () =>
|
|
392
|
+
const ze = "/mock-platform", G = (t, l) => Ie.get(`${ze}${t}`, { params: l }).then((r) => r.data), q = (t, l, r) => Ie.post(`${ze}${t}`, l, { params: r }).then((S) => S.data), Ae = (t, l, r) => Ie.put(`${ze}${t}`, l, { params: r }).then((S) => S.data), ce = (t, l) => Ie.delete(`${ze}${t}`, { params: l }).then((r) => r.data), j = {
|
|
393
|
+
stats: () => G("/stats"),
|
|
351
394
|
environments: {
|
|
352
|
-
list: () =>
|
|
395
|
+
list: () => G("/environments/list"),
|
|
353
396
|
create: (t) => q("/environments", t),
|
|
354
|
-
update: (t,
|
|
397
|
+
update: (t, l) => Ae("/environments", l, { envCode: t }),
|
|
355
398
|
delete: (t) => ce("/environments", { envCode: t })
|
|
356
399
|
},
|
|
357
400
|
endpoints: {
|
|
358
|
-
list: (t,
|
|
359
|
-
get: (t) =>
|
|
401
|
+
list: (t, l, r) => G("/endpoints/list", { envCode: t, scenarioCode: l, status: r }),
|
|
402
|
+
get: (t) => G("/endpoints/byCode", { mockCode: t }),
|
|
360
403
|
create: (t) => q("/endpoints", t),
|
|
361
|
-
update: (t,
|
|
404
|
+
update: (t, l) => Ae("/endpoints", l, { mockCode: t }),
|
|
362
405
|
delete: (t) => ce("/endpoints", { mockCode: t }),
|
|
363
|
-
toggle: (t,
|
|
406
|
+
toggle: (t, l) => q("/endpoints/toggle", null, { mockCode: t, status: l })
|
|
364
407
|
},
|
|
365
408
|
scenarios: {
|
|
366
|
-
list: () =>
|
|
367
|
-
get: (t) =>
|
|
409
|
+
list: () => G("/scenarios/list"),
|
|
410
|
+
get: (t) => G("/scenarios/byCode", { scenarioCode: t }),
|
|
368
411
|
create: (t) => q("/scenarios", t),
|
|
369
|
-
update: (t,
|
|
412
|
+
update: (t, l) => Ae("/scenarios", l, { scenarioCode: t }),
|
|
370
413
|
delete: (t) => ce("/scenarios", { scenarioCode: t }),
|
|
371
414
|
reset: (t) => q("/scenarios/reset", null, { scenarioCode: t }),
|
|
372
|
-
instances: (t) =>
|
|
415
|
+
instances: (t) => G("/scenarios/instances", { scenarioCode: t })
|
|
373
416
|
},
|
|
374
417
|
cases: {
|
|
375
|
-
list: () =>
|
|
376
|
-
get: (t) =>
|
|
418
|
+
list: () => G("/cases/list"),
|
|
419
|
+
get: (t) => G("/cases/byCode", { caseCode: t }),
|
|
377
420
|
create: (t) => q("/cases", t),
|
|
378
|
-
update: (t,
|
|
421
|
+
update: (t, l) => Ae("/cases", l, { caseCode: t }),
|
|
379
422
|
delete: (t) => ce("/cases", { caseCode: t }),
|
|
380
423
|
run: (t) => q("/cases/run", null, { caseCode: t }),
|
|
381
424
|
runBatch: (t) => q("/cases/run-batch", { caseCodes: t })
|
|
382
425
|
},
|
|
383
426
|
recordings: {
|
|
384
|
-
list: () =>
|
|
385
|
-
get: (t) =>
|
|
386
|
-
requests: (t) =>
|
|
387
|
-
start: (t,
|
|
427
|
+
list: () => G("/recordings/list"),
|
|
428
|
+
get: (t) => G("/recordings/byCode", { recordingCode: t }),
|
|
429
|
+
requests: (t) => G("/recordings/requests", { recordingCode: t }),
|
|
430
|
+
start: (t, l, r) => q("/recordings/start", {
|
|
388
431
|
recordingCode: t,
|
|
389
|
-
recordingName:
|
|
432
|
+
recordingName: l,
|
|
390
433
|
targetUrl: r
|
|
391
434
|
}),
|
|
392
435
|
stop: (t) => q("/recordings/stop", null, { recordingCode: t }),
|
|
393
|
-
export: (t,
|
|
394
|
-
import: (t,
|
|
395
|
-
playback: (t,
|
|
436
|
+
export: (t, l) => q("/recordings/export", { recordingCode: t, projectCode: l }),
|
|
437
|
+
import: (t, l) => q("/recordings/import", { recordingCode: t, projectCode: l }),
|
|
438
|
+
playback: (t, l) => q("/recordings/playback", { recordingCode: t, targetUrl: l }),
|
|
396
439
|
delete: (t) => ce("/recordings", { recordingCode: t })
|
|
397
440
|
},
|
|
398
441
|
requestLogs: {
|
|
399
|
-
list: (t) =>
|
|
400
|
-
stats: () =>
|
|
442
|
+
list: (t) => G("/request-logs/list", t),
|
|
443
|
+
stats: () => G("/request-logs/stats"),
|
|
401
444
|
clear: (t) => ce("/request-logs/clear", { limit: t })
|
|
402
445
|
},
|
|
403
446
|
curl: {
|
|
@@ -409,23 +452,23 @@ const ze = "/mock-platform", H = (t, i) => Ie.get(`${ze}${t}`, { params: i }).th
|
|
|
409
452
|
openapi: {
|
|
410
453
|
parse: (t) => q("/openapi/parse", { content: t }),
|
|
411
454
|
importBatch: (t) => q("/openapi/import-batch", t),
|
|
412
|
-
sample: (t) =>
|
|
455
|
+
sample: (t) => G("/openapi/sample", { format: t })
|
|
413
456
|
}
|
|
414
|
-
}, { Text: le, Paragraph:
|
|
457
|
+
}, { Text: le, Paragraph: wn } = ae, Qe = { GET: "green", POST: "blue", PUT: "orange", DELETE: "red", PATCH: "purple" };
|
|
415
458
|
function Be({ activeEnvCode: t }) {
|
|
416
|
-
const [
|
|
417
|
-
|
|
459
|
+
const [l, r] = m([]), [S, s] = m(!1), [y, c] = m(null), [f, x] = m(!1), [C, _] = m(null);
|
|
460
|
+
K(() => {
|
|
418
461
|
h();
|
|
419
462
|
}, [t]);
|
|
420
463
|
const h = async () => {
|
|
421
|
-
|
|
464
|
+
s(!0), c(null);
|
|
422
465
|
try {
|
|
423
466
|
const g = await j.endpoints.list(t);
|
|
424
467
|
r(Array.isArray(g) ? g : []);
|
|
425
468
|
} catch (g) {
|
|
426
469
|
c((g == null ? void 0 : g.message) || "API unavailable"), r([]);
|
|
427
470
|
} finally {
|
|
428
|
-
|
|
471
|
+
s(!1);
|
|
429
472
|
}
|
|
430
473
|
}, a = (g) => `${window.location.origin}/api/mock/${g.env_code || t || "default"}${g.path || ""}`, d = [
|
|
431
474
|
{
|
|
@@ -434,7 +477,7 @@ function Be({ activeEnvCode: t }) {
|
|
|
434
477
|
key: "path",
|
|
435
478
|
width: 280,
|
|
436
479
|
render: (g, v) => /* @__PURE__ */ n(E, { children: [
|
|
437
|
-
/* @__PURE__ */ e(w, { color:
|
|
480
|
+
/* @__PURE__ */ e(w, { color: Qe[v.method] || "default", children: v.method }),
|
|
438
481
|
/* @__PURE__ */ e(le, { code: !0, copyable: { text: g }, children: g })
|
|
439
482
|
] })
|
|
440
483
|
},
|
|
@@ -515,7 +558,7 @@ function Be({ activeEnvCode: t }) {
|
|
|
515
558
|
{
|
|
516
559
|
size: "small",
|
|
517
560
|
type: "link",
|
|
518
|
-
icon: /* @__PURE__ */ e(
|
|
561
|
+
icon: /* @__PURE__ */ e(ht, {}),
|
|
519
562
|
onClick: () => {
|
|
520
563
|
navigator.clipboard.writeText(a(v)), b.success("已复制");
|
|
521
564
|
}
|
|
@@ -526,7 +569,7 @@ function Be({ activeEnvCode: t }) {
|
|
|
526
569
|
];
|
|
527
570
|
return /* @__PURE__ */ n("div", { children: [
|
|
528
571
|
y && /* @__PURE__ */ e(
|
|
529
|
-
|
|
572
|
+
W,
|
|
530
573
|
{
|
|
531
574
|
type: "warning",
|
|
532
575
|
showIcon: !0,
|
|
@@ -538,29 +581,29 @@ function Be({ activeEnvCode: t }) {
|
|
|
538
581
|
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
539
582
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ n(L, { children: [
|
|
540
583
|
/* @__PURE__ */ e("strong", { children: "总端点" }),
|
|
541
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 22 }, children:
|
|
584
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 22 }, children: l.length })
|
|
542
585
|
] }) }),
|
|
543
586
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ n(L, { children: [
|
|
544
587
|
/* @__PURE__ */ e("strong", { children: "已启用" }),
|
|
545
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 22, color: "#52c41a" }, children:
|
|
588
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 22, color: "#52c41a" }, children: l.filter((g) => g.status === 1).length })
|
|
546
589
|
] }) }),
|
|
547
590
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ n(L, { children: [
|
|
548
591
|
/* @__PURE__ */ e("strong", { children: "已禁用" }),
|
|
549
|
-
/* @__PURE__ */ e("div", { style: { fontSize: 22, color: "#ff4d4f" }, children:
|
|
592
|
+
/* @__PURE__ */ e("div", { style: { fontSize: 22, color: "#ff4d4f" }, children: l.filter((g) => g.status === 0).length })
|
|
550
593
|
] }) }),
|
|
551
594
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ n(L, { children: [
|
|
552
595
|
/* @__PURE__ */ e("strong", { children: "总命中" }),
|
|
553
596
|
/* @__PURE__ */ e("div", { style: {
|
|
554
597
|
fontSize: 22,
|
|
555
598
|
color: "#1890ff"
|
|
556
|
-
}, children:
|
|
599
|
+
}, children: l.reduce((g, v) => g + (v.hit_count || 0), 0) })
|
|
557
600
|
] }) })
|
|
558
601
|
] }),
|
|
559
602
|
/* @__PURE__ */ e(E, { style: { marginBottom: 16 }, children: /* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(ee, {}), onClick: h, children: "刷新" }) }),
|
|
560
603
|
/* @__PURE__ */ e(
|
|
561
604
|
Q,
|
|
562
605
|
{
|
|
563
|
-
dataSource:
|
|
606
|
+
dataSource: l,
|
|
564
607
|
columns: d,
|
|
565
608
|
rowKey: "id",
|
|
566
609
|
loading: S,
|
|
@@ -573,7 +616,7 @@ function Be({ activeEnvCode: t }) {
|
|
|
573
616
|
we,
|
|
574
617
|
{
|
|
575
618
|
title: /* @__PURE__ */ n(E, { children: [
|
|
576
|
-
/* @__PURE__ */ e(
|
|
619
|
+
/* @__PURE__ */ e(Et, {}),
|
|
577
620
|
"端点详情: ",
|
|
578
621
|
C == null ? void 0 : C.mock_code
|
|
579
622
|
] }),
|
|
@@ -584,7 +627,7 @@ function Be({ activeEnvCode: t }) {
|
|
|
584
627
|
/* @__PURE__ */ n(z, { column: 2, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
585
628
|
/* @__PURE__ */ e(z.Item, { label: "编码", children: C.mock_code }),
|
|
586
629
|
/* @__PURE__ */ e(z.Item, { label: "名称", children: C.mock_name }),
|
|
587
|
-
/* @__PURE__ */ e(z.Item, { label: "方法", children: /* @__PURE__ */ e(w, { color:
|
|
630
|
+
/* @__PURE__ */ e(z.Item, { label: "方法", children: /* @__PURE__ */ e(w, { color: Qe[C.method], children: C.method }) }),
|
|
588
631
|
/* @__PURE__ */ e(z.Item, { label: "环境", children: C.env_code }),
|
|
589
632
|
/* @__PURE__ */ e(z.Item, { label: "路径", span: 2, children: C.path }),
|
|
590
633
|
/* @__PURE__ */ e(z.Item, { label: "状态码", children: C.status_code }),
|
|
@@ -602,7 +645,7 @@ function Be({ activeEnvCode: t }) {
|
|
|
602
645
|
/* @__PURE__ */ e(z.Item, { label: "状态", span: 2, children: C.status === 1 ? /* @__PURE__ */ e(w, { color: "green", children: "启用" }) : /* @__PURE__ */ e(w, { children: "禁用" }) }),
|
|
603
646
|
/* @__PURE__ */ e(z.Item, { label: "完整 URL", span: 2, children: /* @__PURE__ */ e(le, { copyable: !0, children: a(C) }) })
|
|
604
647
|
] }),
|
|
605
|
-
/* @__PURE__ */ e(
|
|
648
|
+
/* @__PURE__ */ e(wn, { strong: !0, children: "响应模板:" }),
|
|
606
649
|
/* @__PURE__ */ e("pre", { style: {
|
|
607
650
|
background: "#f5f5f5",
|
|
608
651
|
padding: 12,
|
|
@@ -619,26 +662,26 @@ function Be({ activeEnvCode: t }) {
|
|
|
619
662
|
)
|
|
620
663
|
] });
|
|
621
664
|
}
|
|
622
|
-
const { Text: Oe } = ae,
|
|
665
|
+
const { Text: Oe } = ae, kn = { MOCK: "green", REAL: "blue", MIXED: "orange" };
|
|
623
666
|
function je({ onEnvChange: t }) {
|
|
624
|
-
const [
|
|
625
|
-
|
|
667
|
+
const [l, r] = m([]), [S, s] = m(!1);
|
|
668
|
+
K(() => {
|
|
626
669
|
y();
|
|
627
670
|
}, []);
|
|
628
671
|
const y = async () => {
|
|
629
|
-
|
|
672
|
+
s(!0);
|
|
630
673
|
try {
|
|
631
674
|
const f = await j.environments.list();
|
|
632
675
|
r(Array.isArray(f) ? f : []);
|
|
633
676
|
} catch (f) {
|
|
634
677
|
b.warning("加载环境列表失败: " + (f == null ? void 0 : f.message));
|
|
635
678
|
} finally {
|
|
636
|
-
|
|
679
|
+
s(!1);
|
|
637
680
|
}
|
|
638
681
|
};
|
|
639
682
|
return /* @__PURE__ */ n("div", { children: [
|
|
640
683
|
/* @__PURE__ */ e(
|
|
641
|
-
|
|
684
|
+
W,
|
|
642
685
|
{
|
|
643
686
|
type: "info",
|
|
644
687
|
showIcon: !0,
|
|
@@ -664,7 +707,7 @@ function je({ onEnvChange: t }) {
|
|
|
664
707
|
/* @__PURE__ */ e(
|
|
665
708
|
Q,
|
|
666
709
|
{
|
|
667
|
-
dataSource:
|
|
710
|
+
dataSource: l,
|
|
668
711
|
columns: [
|
|
669
712
|
{
|
|
670
713
|
title: "环境编码",
|
|
@@ -679,7 +722,7 @@ function je({ onEnvChange: t }) {
|
|
|
679
722
|
dataIndex: "env_type",
|
|
680
723
|
key: "env_type",
|
|
681
724
|
width: 240,
|
|
682
|
-
render: (f) => /* @__PURE__ */ e(w, { color:
|
|
725
|
+
render: (f) => /* @__PURE__ */ e(w, { color: kn[f] || "default", children: f })
|
|
683
726
|
},
|
|
684
727
|
{
|
|
685
728
|
title: "真实服务地址",
|
|
@@ -711,7 +754,7 @@ function je({ onEnvChange: t }) {
|
|
|
711
754
|
{
|
|
712
755
|
size: "small",
|
|
713
756
|
type: "link",
|
|
714
|
-
icon: /* @__PURE__ */ e(
|
|
757
|
+
icon: /* @__PURE__ */ e(mt, {}),
|
|
715
758
|
onClick: () => {
|
|
716
759
|
t && t(x.env_code);
|
|
717
760
|
},
|
|
@@ -728,17 +771,17 @@ function je({ onEnvChange: t }) {
|
|
|
728
771
|
)
|
|
729
772
|
] });
|
|
730
773
|
}
|
|
731
|
-
const { Text:
|
|
732
|
-
function
|
|
733
|
-
const [t,
|
|
734
|
-
|
|
774
|
+
const { Text: In } = ae;
|
|
775
|
+
function Sn() {
|
|
776
|
+
const [t, l] = m([]), [r, S] = m(!1), [s, y] = m(!1), [c, f] = m(null);
|
|
777
|
+
K(() => {
|
|
735
778
|
x();
|
|
736
779
|
}, []);
|
|
737
780
|
const x = async () => {
|
|
738
781
|
S(!0);
|
|
739
782
|
try {
|
|
740
783
|
const a = await j.scenarios.list();
|
|
741
|
-
|
|
784
|
+
l(Array.isArray(a) ? a : []);
|
|
742
785
|
} catch {
|
|
743
786
|
b.warning("加载场景列表失败");
|
|
744
787
|
} finally {
|
|
@@ -760,7 +803,7 @@ function fn() {
|
|
|
760
803
|
};
|
|
761
804
|
return /* @__PURE__ */ n("div", { children: [
|
|
762
805
|
/* @__PURE__ */ e(
|
|
763
|
-
|
|
806
|
+
W,
|
|
764
807
|
{
|
|
765
808
|
type: "info",
|
|
766
809
|
showIcon: !0,
|
|
@@ -780,7 +823,7 @@ function fn() {
|
|
|
780
823
|
dataIndex: "scenario_code",
|
|
781
824
|
key: "scenario_code",
|
|
782
825
|
width: 160,
|
|
783
|
-
render: (a) => /* @__PURE__ */ e(
|
|
826
|
+
render: (a) => /* @__PURE__ */ e(In, { code: !0, children: a })
|
|
784
827
|
},
|
|
785
828
|
{ title: "场景名称", dataIndex: "scenario_name", key: "scenario_name", width: 200 },
|
|
786
829
|
{
|
|
@@ -808,7 +851,7 @@ function fn() {
|
|
|
808
851
|
{
|
|
809
852
|
size: "small",
|
|
810
853
|
type: "link",
|
|
811
|
-
icon: /* @__PURE__ */ e(
|
|
854
|
+
icon: /* @__PURE__ */ e(zt, {}),
|
|
812
855
|
onClick: () => _(d.scenario_code),
|
|
813
856
|
children: "实例"
|
|
814
857
|
}
|
|
@@ -818,7 +861,7 @@ function fn() {
|
|
|
818
861
|
{
|
|
819
862
|
size: "small",
|
|
820
863
|
type: "link",
|
|
821
|
-
icon: /* @__PURE__ */ e(
|
|
864
|
+
icon: /* @__PURE__ */ e(Rt, {}),
|
|
822
865
|
onClick: () => C(d.scenario_code),
|
|
823
866
|
children: "重置"
|
|
824
867
|
}
|
|
@@ -837,7 +880,7 @@ function fn() {
|
|
|
837
880
|
me,
|
|
838
881
|
{
|
|
839
882
|
title: `场景实例: ${c == null ? void 0 : c.code}`,
|
|
840
|
-
open:
|
|
883
|
+
open: s,
|
|
841
884
|
onCancel: () => y(!1),
|
|
842
885
|
footer: /* @__PURE__ */ e(A, { onClick: () => y(!1), children: "关闭" }),
|
|
843
886
|
size: "large",
|
|
@@ -864,17 +907,17 @@ function fn() {
|
|
|
864
907
|
)
|
|
865
908
|
] });
|
|
866
909
|
}
|
|
867
|
-
const { Text: ie } = ae, Le = { PASS: "green", FAIL: "red", SKIP: "default" },
|
|
868
|
-
function
|
|
869
|
-
const [t,
|
|
870
|
-
|
|
910
|
+
const { Text: ie } = ae, Le = { PASS: "green", FAIL: "red", SKIP: "default" }, Tn = { P0: "red", P1: "orange", P2: "blue", P3: "default" };
|
|
911
|
+
function Cn() {
|
|
912
|
+
const [t, l] = m([]), [r, S] = m(!1), [s, y] = m([]), [c, f] = m(!1), [x, C] = m(null), [_, h] = m(null), [a, d] = m(!1);
|
|
913
|
+
K(() => {
|
|
871
914
|
g();
|
|
872
915
|
}, []);
|
|
873
916
|
const g = async () => {
|
|
874
917
|
S(!0);
|
|
875
918
|
try {
|
|
876
919
|
const u = await j.cases.list();
|
|
877
|
-
|
|
920
|
+
l(Array.isArray(u) ? u : []);
|
|
878
921
|
} catch {
|
|
879
922
|
b.warning("加载用例列表失败");
|
|
880
923
|
} finally {
|
|
@@ -882,18 +925,18 @@ function xn() {
|
|
|
882
925
|
}
|
|
883
926
|
}, v = async (u) => {
|
|
884
927
|
try {
|
|
885
|
-
const
|
|
886
|
-
C(
|
|
887
|
-
} catch (
|
|
888
|
-
b.error("执行失败: " + (
|
|
928
|
+
const i = await j.cases.run(u.case_code);
|
|
929
|
+
C(i), f(!0), (i == null ? void 0 : i.status) === "PASS" ? b.success("用例通过") : b.error("用例失败: " + ((i == null ? void 0 : i.error) || (i == null ? void 0 : i.actualStatus))), g();
|
|
930
|
+
} catch (i) {
|
|
931
|
+
b.error("执行失败: " + (i == null ? void 0 : i.message));
|
|
889
932
|
}
|
|
890
933
|
}, D = async () => {
|
|
891
|
-
if (
|
|
934
|
+
if (s.length === 0) {
|
|
892
935
|
b.warning("请先选择用例");
|
|
893
936
|
return;
|
|
894
937
|
}
|
|
895
938
|
try {
|
|
896
|
-
const u = await j.cases.runBatch(
|
|
939
|
+
const u = await j.cases.runBatch(s);
|
|
897
940
|
h(u), d(!0), b.success(`批量执行完成: ${u == null ? void 0 : u.pass} 通过, ${u == null ? void 0 : u.fail} 失败`), g();
|
|
898
941
|
} catch {
|
|
899
942
|
b.error("批量执行失败");
|
|
@@ -934,7 +977,7 @@ function xn() {
|
|
|
934
977
|
key: "priority",
|
|
935
978
|
width: 80,
|
|
936
979
|
align: "center",
|
|
937
|
-
render: (u) => /* @__PURE__ */ e(w, { color:
|
|
980
|
+
render: (u) => /* @__PURE__ */ e(w, { color: Tn[u], children: u || "P1" })
|
|
938
981
|
},
|
|
939
982
|
{
|
|
940
983
|
title: "上次结果",
|
|
@@ -949,13 +992,13 @@ function xn() {
|
|
|
949
992
|
key: "stats",
|
|
950
993
|
width: 130,
|
|
951
994
|
align: "center",
|
|
952
|
-
render: (u,
|
|
953
|
-
/* @__PURE__ */ e(ie, { type: "success", children:
|
|
995
|
+
render: (u, i) => /* @__PURE__ */ n(E, { size: "small", children: [
|
|
996
|
+
/* @__PURE__ */ e(ie, { type: "success", children: i.pass_count || 0 }),
|
|
954
997
|
"/",
|
|
955
|
-
/* @__PURE__ */ e(ie, { type: "danger", children:
|
|
998
|
+
/* @__PURE__ */ e(ie, { type: "danger", children: i.fail_count || 0 }),
|
|
956
999
|
/* @__PURE__ */ n(ie, { type: "secondary", children: [
|
|
957
1000
|
"(",
|
|
958
|
-
|
|
1001
|
+
i.run_count || 0,
|
|
959
1002
|
")"
|
|
960
1003
|
] })
|
|
961
1004
|
] })
|
|
@@ -965,13 +1008,13 @@ function xn() {
|
|
|
965
1008
|
key: "action",
|
|
966
1009
|
width: 120,
|
|
967
1010
|
fixed: "right",
|
|
968
|
-
render: (u,
|
|
1011
|
+
render: (u, i) => /* @__PURE__ */ e(E, { size: "small", children: /* @__PURE__ */ e(
|
|
969
1012
|
A,
|
|
970
1013
|
{
|
|
971
1014
|
size: "small",
|
|
972
1015
|
type: "link",
|
|
973
1016
|
icon: /* @__PURE__ */ e(Ee, {}),
|
|
974
|
-
onClick: () => v(
|
|
1017
|
+
onClick: () => v(i),
|
|
975
1018
|
children: "运行"
|
|
976
1019
|
}
|
|
977
1020
|
) })
|
|
@@ -979,7 +1022,7 @@ function xn() {
|
|
|
979
1022
|
];
|
|
980
1023
|
return /* @__PURE__ */ n("div", { children: [
|
|
981
1024
|
/* @__PURE__ */ e(
|
|
982
|
-
|
|
1025
|
+
W,
|
|
983
1026
|
{
|
|
984
1027
|
type: "info",
|
|
985
1028
|
showIcon: !0,
|
|
@@ -996,10 +1039,10 @@ function xn() {
|
|
|
996
1039
|
type: "primary",
|
|
997
1040
|
icon: /* @__PURE__ */ e(Ee, {}),
|
|
998
1041
|
onClick: D,
|
|
999
|
-
disabled:
|
|
1042
|
+
disabled: s.length === 0,
|
|
1000
1043
|
children: [
|
|
1001
1044
|
"批量运行 (",
|
|
1002
|
-
|
|
1045
|
+
s.length,
|
|
1003
1046
|
")"
|
|
1004
1047
|
]
|
|
1005
1048
|
}
|
|
@@ -1013,10 +1056,10 @@ function xn() {
|
|
|
1013
1056
|
rowKey: "id",
|
|
1014
1057
|
loading: r,
|
|
1015
1058
|
rowSelection: {
|
|
1016
|
-
selectedRowKeys:
|
|
1059
|
+
selectedRowKeys: s,
|
|
1017
1060
|
// 批量执行收的是 **case_code 列表**(后端按 case_code 查行),
|
|
1018
1061
|
// 原来这里存的是 rowKey(=id) ⇒ 批量执行永远查不到行。
|
|
1019
|
-
onChange: (u,
|
|
1062
|
+
onChange: (u, i) => y(i.map((I) => I.case_code))
|
|
1020
1063
|
},
|
|
1021
1064
|
pagination: { pageSize: 10 },
|
|
1022
1065
|
scroll: { x: 1300 },
|
|
@@ -1027,7 +1070,7 @@ function xn() {
|
|
|
1027
1070
|
we,
|
|
1028
1071
|
{
|
|
1029
1072
|
title: /* @__PURE__ */ n(E, { children: [
|
|
1030
|
-
/* @__PURE__ */ e(
|
|
1073
|
+
/* @__PURE__ */ e(Ot, {}),
|
|
1031
1074
|
"用例执行结果"
|
|
1032
1075
|
] }),
|
|
1033
1076
|
open: c,
|
|
@@ -1036,15 +1079,15 @@ function xn() {
|
|
|
1036
1079
|
children: x && /* @__PURE__ */ n("div", { children: [
|
|
1037
1080
|
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
1038
1081
|
/* @__PURE__ */ e(O, { span: 8, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1039
|
-
|
|
1082
|
+
F,
|
|
1040
1083
|
{
|
|
1041
1084
|
title: "结果",
|
|
1042
1085
|
value: x.status,
|
|
1043
1086
|
styles: { content: { color: Le[x.status] === "green" ? "#52c41a" : "#ff4d4f" } }
|
|
1044
1087
|
}
|
|
1045
1088
|
) }) }),
|
|
1046
|
-
/* @__PURE__ */ e(O, { span: 8, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1047
|
-
/* @__PURE__ */ e(O, { span: 8, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1089
|
+
/* @__PURE__ */ e(O, { span: 8, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(F, { title: "实际状态码", value: x.actualStatus || "-" }) }) }),
|
|
1090
|
+
/* @__PURE__ */ e(O, { span: 8, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(F, { title: "耗时(ms)", value: x.durationMs || 0 }) }) })
|
|
1048
1091
|
] }),
|
|
1049
1092
|
/* @__PURE__ */ n(z, { column: 1, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
1050
1093
|
/* @__PURE__ */ e(z.Item, { label: "用例编码", children: x.caseCode }),
|
|
@@ -1101,9 +1144,9 @@ function xn() {
|
|
|
1101
1144
|
size: "large",
|
|
1102
1145
|
children: _ && /* @__PURE__ */ n(Me, { children: [
|
|
1103
1146
|
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
1104
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1147
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(F, { title: "总数", value: _.total }) }) }),
|
|
1105
1148
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1106
|
-
|
|
1149
|
+
F,
|
|
1107
1150
|
{
|
|
1108
1151
|
title: "通过",
|
|
1109
1152
|
value: _.pass,
|
|
@@ -1111,7 +1154,7 @@ function xn() {
|
|
|
1111
1154
|
}
|
|
1112
1155
|
) }) }),
|
|
1113
1156
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1114
|
-
|
|
1157
|
+
F,
|
|
1115
1158
|
{
|
|
1116
1159
|
title: "失败",
|
|
1117
1160
|
value: _.fail,
|
|
@@ -1119,7 +1162,7 @@ function xn() {
|
|
|
1119
1162
|
}
|
|
1120
1163
|
) }) }),
|
|
1121
1164
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1122
|
-
|
|
1165
|
+
F,
|
|
1123
1166
|
{
|
|
1124
1167
|
title: "通过率",
|
|
1125
1168
|
value: `${_.total > 0 ? Math.round(_.pass / _.total * 100) : 0}%`
|
|
@@ -1153,22 +1196,22 @@ function xn() {
|
|
|
1153
1196
|
)
|
|
1154
1197
|
] });
|
|
1155
1198
|
}
|
|
1156
|
-
const { Text: de } = ae,
|
|
1199
|
+
const { Text: de } = ae, et = {
|
|
1157
1200
|
IDLE: "default",
|
|
1158
1201
|
RECORDING: "red",
|
|
1159
1202
|
STOPPED: "green",
|
|
1160
1203
|
EXPIRED: "gray"
|
|
1161
1204
|
};
|
|
1162
|
-
function
|
|
1163
|
-
const [t,
|
|
1164
|
-
|
|
1205
|
+
function vn() {
|
|
1206
|
+
const [t, l] = m([]), [r, S] = m(!1), [s, y] = m(!1), [c, f] = m(null), [x, C] = m([]);
|
|
1207
|
+
K(() => {
|
|
1165
1208
|
_();
|
|
1166
1209
|
}, []);
|
|
1167
1210
|
const _ = async () => {
|
|
1168
1211
|
S(!0);
|
|
1169
1212
|
try {
|
|
1170
1213
|
const d = await j.recordings.list();
|
|
1171
|
-
|
|
1214
|
+
l(Array.isArray(d) ? d : []);
|
|
1172
1215
|
} catch {
|
|
1173
1216
|
b.warning("加载录制列表失败");
|
|
1174
1217
|
} finally {
|
|
@@ -1184,7 +1227,7 @@ function wn() {
|
|
|
1184
1227
|
};
|
|
1185
1228
|
return /* @__PURE__ */ n("div", { children: [
|
|
1186
1229
|
/* @__PURE__ */ e(
|
|
1187
|
-
|
|
1230
|
+
W,
|
|
1188
1231
|
{
|
|
1189
1232
|
type: "info",
|
|
1190
1233
|
showIcon: !0,
|
|
@@ -1220,7 +1263,7 @@ function wn() {
|
|
|
1220
1263
|
dataIndex: "record_status",
|
|
1221
1264
|
key: "record_status",
|
|
1222
1265
|
width: 110,
|
|
1223
|
-
render: (d) => /* @__PURE__ */ e(w, { color:
|
|
1266
|
+
render: (d) => /* @__PURE__ */ e(w, { color: et[d], children: d })
|
|
1224
1267
|
},
|
|
1225
1268
|
{
|
|
1226
1269
|
title: "请求数",
|
|
@@ -1248,7 +1291,7 @@ function wn() {
|
|
|
1248
1291
|
{
|
|
1249
1292
|
size: "small",
|
|
1250
1293
|
type: "link",
|
|
1251
|
-
icon: /* @__PURE__ */ e(
|
|
1294
|
+
icon: /* @__PURE__ */ e(Xe, {}),
|
|
1252
1295
|
onClick: () => h(g),
|
|
1253
1296
|
children: "详情"
|
|
1254
1297
|
}
|
|
@@ -1266,18 +1309,18 @@ function wn() {
|
|
|
1266
1309
|
we,
|
|
1267
1310
|
{
|
|
1268
1311
|
title: /* @__PURE__ */ n(E, { children: [
|
|
1269
|
-
/* @__PURE__ */ e(
|
|
1312
|
+
/* @__PURE__ */ e(Xe, {}),
|
|
1270
1313
|
"录制详情: ",
|
|
1271
1314
|
c == null ? void 0 : c.recording_code
|
|
1272
1315
|
] }),
|
|
1273
|
-
open:
|
|
1316
|
+
open: s,
|
|
1274
1317
|
onClose: () => y(!1),
|
|
1275
1318
|
size: "large",
|
|
1276
1319
|
children: c && /* @__PURE__ */ n("div", { children: [
|
|
1277
1320
|
/* @__PURE__ */ n(z, { column: 2, size: "small", bordered: !0, style: { marginBottom: 16 }, children: [
|
|
1278
1321
|
/* @__PURE__ */ e(z.Item, { label: "编码", children: c.recording_code }),
|
|
1279
1322
|
/* @__PURE__ */ e(z.Item, { label: "名称", children: c.recording_name }),
|
|
1280
|
-
/* @__PURE__ */ e(z.Item, { label: "状态", children: /* @__PURE__ */ e(w, { color:
|
|
1323
|
+
/* @__PURE__ */ e(z.Item, { label: "状态", children: /* @__PURE__ */ e(w, { color: et[c.record_status], children: c.record_status }) }),
|
|
1281
1324
|
/* @__PURE__ */ e(z.Item, { label: "请求数", children: c.total_requests }),
|
|
1282
1325
|
/* @__PURE__ */ e(z.Item, { label: "目标 URL", span: 2, children: /* @__PURE__ */ e(de, { copyable: !0, children: c.target_url }) }),
|
|
1283
1326
|
/* @__PURE__ */ e(z.Item, { label: "开始", children: c.start_time }),
|
|
@@ -1334,10 +1377,10 @@ function wn() {
|
|
|
1334
1377
|
)
|
|
1335
1378
|
] });
|
|
1336
1379
|
}
|
|
1337
|
-
const { Text: ue } = ae,
|
|
1338
|
-
function
|
|
1339
|
-
const [t,
|
|
1340
|
-
|
|
1380
|
+
const { Text: ue } = ae, An = { MOCK: "green", PROXY: "blue", 404: "red", 502: "orange" };
|
|
1381
|
+
function _n() {
|
|
1382
|
+
const [t, l] = m([]), [r, S] = m(null), [s, y] = m(!1), [c, f] = m(null), [x, C] = m(!1), [_, h] = m(""), [a, d] = m();
|
|
1383
|
+
K(() => {
|
|
1341
1384
|
g();
|
|
1342
1385
|
}, []);
|
|
1343
1386
|
const g = async () => {
|
|
@@ -1351,7 +1394,7 @@ function In() {
|
|
|
1351
1394
|
}),
|
|
1352
1395
|
j.requestLogs.stats().catch(() => null)
|
|
1353
1396
|
]);
|
|
1354
|
-
|
|
1397
|
+
l(Array.isArray(T) ? T : []), S(u);
|
|
1355
1398
|
} catch {
|
|
1356
1399
|
b.warning("加载失败");
|
|
1357
1400
|
} finally {
|
|
@@ -1409,7 +1452,7 @@ function In() {
|
|
|
1409
1452
|
dataIndex: "fallback_type",
|
|
1410
1453
|
key: "fallback_type",
|
|
1411
1454
|
width: 100,
|
|
1412
|
-
render: (T) => T ? /* @__PURE__ */ e(w, { color:
|
|
1455
|
+
render: (T) => T ? /* @__PURE__ */ e(w, { color: An[T], children: T }) : "-"
|
|
1413
1456
|
},
|
|
1414
1457
|
{
|
|
1415
1458
|
title: "耗时",
|
|
@@ -1436,7 +1479,7 @@ function In() {
|
|
|
1436
1479
|
{
|
|
1437
1480
|
size: "small",
|
|
1438
1481
|
type: "link",
|
|
1439
|
-
icon: /* @__PURE__ */ e(
|
|
1482
|
+
icon: /* @__PURE__ */ e(Lt, {}),
|
|
1440
1483
|
onClick: () => v(u),
|
|
1441
1484
|
children: "详情"
|
|
1442
1485
|
}
|
|
@@ -1445,7 +1488,7 @@ function In() {
|
|
|
1445
1488
|
];
|
|
1446
1489
|
return /* @__PURE__ */ n("div", { children: [
|
|
1447
1490
|
/* @__PURE__ */ e(
|
|
1448
|
-
|
|
1491
|
+
W,
|
|
1449
1492
|
{
|
|
1450
1493
|
type: "info",
|
|
1451
1494
|
showIcon: !0,
|
|
@@ -1455,9 +1498,9 @@ function In() {
|
|
|
1455
1498
|
}
|
|
1456
1499
|
),
|
|
1457
1500
|
r && /* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
1458
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1501
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(F, { title: "总请求数", value: r.total || 0 }) }) }),
|
|
1459
1502
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1460
|
-
|
|
1503
|
+
F,
|
|
1461
1504
|
{
|
|
1462
1505
|
title: "Mock 命中",
|
|
1463
1506
|
value: r.matched || 0,
|
|
@@ -1465,7 +1508,7 @@ function In() {
|
|
|
1465
1508
|
}
|
|
1466
1509
|
) }) }),
|
|
1467
1510
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1468
|
-
|
|
1511
|
+
F,
|
|
1469
1512
|
{
|
|
1470
1513
|
title: "未匹配",
|
|
1471
1514
|
value: r.unmatched || 0,
|
|
@@ -1473,7 +1516,7 @@ function In() {
|
|
|
1473
1516
|
}
|
|
1474
1517
|
) }) }),
|
|
1475
1518
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
1476
|
-
|
|
1519
|
+
F,
|
|
1477
1520
|
{
|
|
1478
1521
|
title: "命中率",
|
|
1479
1522
|
value: `${r.total > 0 ? Math.round(r.matched / r.total * 100) : 0}%`
|
|
@@ -1485,7 +1528,7 @@ function In() {
|
|
|
1485
1528
|
B,
|
|
1486
1529
|
{
|
|
1487
1530
|
placeholder: "搜索路径",
|
|
1488
|
-
prefix: /* @__PURE__ */ e(
|
|
1531
|
+
prefix: /* @__PURE__ */ e(yt, {}),
|
|
1489
1532
|
allowClear: !0,
|
|
1490
1533
|
style: { width: 240 },
|
|
1491
1534
|
value: _,
|
|
@@ -1494,7 +1537,7 @@ function In() {
|
|
|
1494
1537
|
}
|
|
1495
1538
|
),
|
|
1496
1539
|
/* @__PURE__ */ e(
|
|
1497
|
-
|
|
1540
|
+
Z,
|
|
1498
1541
|
{
|
|
1499
1542
|
placeholder: "匹配状态",
|
|
1500
1543
|
allowClear: !0,
|
|
@@ -1515,7 +1558,7 @@ function In() {
|
|
|
1515
1558
|
dataSource: t,
|
|
1516
1559
|
columns: D,
|
|
1517
1560
|
rowKey: "id",
|
|
1518
|
-
loading:
|
|
1561
|
+
loading: s,
|
|
1519
1562
|
pagination: { pageSize: 20 },
|
|
1520
1563
|
scroll: { x: 1300 },
|
|
1521
1564
|
size: "small"
|
|
@@ -1611,24 +1654,24 @@ function In() {
|
|
|
1611
1654
|
)
|
|
1612
1655
|
] });
|
|
1613
1656
|
}
|
|
1614
|
-
const { Text: te } = ae,
|
|
1657
|
+
const { Text: te } = ae, tt = [
|
|
1615
1658
|
{ key: "endpoints", label: "Mock 端点", component: Be },
|
|
1616
1659
|
{ key: "environments", label: "环境 (MOCK/REAL/MIXED)", component: je },
|
|
1617
|
-
{ key: "scenarios", label: "场景状态机", component:
|
|
1618
|
-
{ key: "cases", label: "测试用例", component:
|
|
1619
|
-
{ key: "recordings", label: "录制回放", component:
|
|
1620
|
-
{ key: "request-logs", label: "请求日志", component:
|
|
1660
|
+
{ key: "scenarios", label: "场景状态机", component: Sn },
|
|
1661
|
+
{ key: "cases", label: "测试用例", component: Cn },
|
|
1662
|
+
{ key: "recordings", label: "录制回放", component: vn },
|
|
1663
|
+
{ key: "request-logs", label: "请求日志", component: _n }
|
|
1621
1664
|
];
|
|
1622
|
-
function
|
|
1665
|
+
function Pn() {
|
|
1623
1666
|
var _;
|
|
1624
|
-
const [t,
|
|
1625
|
-
|
|
1667
|
+
const [t, l] = m("endpoints"), [r, S] = m([]), [s, y] = m("default"), [c, f] = m(null);
|
|
1668
|
+
K(() => {
|
|
1626
1669
|
x(), C();
|
|
1627
1670
|
}, []);
|
|
1628
1671
|
const x = async () => {
|
|
1629
1672
|
try {
|
|
1630
1673
|
const h = await j.environments.list(), a = Array.isArray(h) ? h : [];
|
|
1631
|
-
if (S(a), a.length > 0 && !a.find((d) => d.env_code ===
|
|
1674
|
+
if (S(a), a.length > 0 && !a.find((d) => d.env_code === s)) {
|
|
1632
1675
|
const d = a.find((g) => g.is_default === 1) || a[0];
|
|
1633
1676
|
y(d.env_code);
|
|
1634
1677
|
}
|
|
@@ -1641,7 +1684,7 @@ function Sn() {
|
|
|
1641
1684
|
} catch {
|
|
1642
1685
|
}
|
|
1643
1686
|
};
|
|
1644
|
-
return (_ =
|
|
1687
|
+
return (_ = tt.find((h) => h.key === t)) == null || _.component, /* @__PURE__ */ n("div", { children: [
|
|
1645
1688
|
/* @__PURE__ */ e(
|
|
1646
1689
|
ye,
|
|
1647
1690
|
{
|
|
@@ -1653,16 +1696,16 @@ function Sn() {
|
|
|
1653
1696
|
ke,
|
|
1654
1697
|
{
|
|
1655
1698
|
activeKey: t,
|
|
1656
|
-
onChange:
|
|
1699
|
+
onChange: l,
|
|
1657
1700
|
type: "card",
|
|
1658
1701
|
tabBarExtraContent: /* @__PURE__ */ n(E, { size: "large", wrap: !0, children: [
|
|
1659
1702
|
/* @__PURE__ */ n(E, { children: [
|
|
1660
|
-
/* @__PURE__ */ e(
|
|
1703
|
+
/* @__PURE__ */ e(mt, {}),
|
|
1661
1704
|
/* @__PURE__ */ e(te, { children: "当前环境:" }),
|
|
1662
1705
|
/* @__PURE__ */ e(
|
|
1663
|
-
|
|
1706
|
+
Z,
|
|
1664
1707
|
{
|
|
1665
|
-
value:
|
|
1708
|
+
value: s,
|
|
1666
1709
|
onChange: y,
|
|
1667
1710
|
style: { width: 200 },
|
|
1668
1711
|
options: r.map((h) => ({
|
|
@@ -1701,10 +1744,10 @@ function Sn() {
|
|
|
1701
1744
|
x(), C();
|
|
1702
1745
|
}, children: "刷新" })
|
|
1703
1746
|
] }),
|
|
1704
|
-
items:
|
|
1747
|
+
items: tt.map((h) => ({
|
|
1705
1748
|
key: h.key,
|
|
1706
1749
|
label: h.label,
|
|
1707
|
-
children: h.component === Be ? /* @__PURE__ */ e(Be, { activeEnvCode:
|
|
1750
|
+
children: h.component === Be ? /* @__PURE__ */ e(Be, { activeEnvCode: s }) : h.component === je ? /* @__PURE__ */ e(je, { onEnvChange: (a) => {
|
|
1708
1751
|
y(a), b.success(`已切换到环境: ${a}`);
|
|
1709
1752
|
} }) : /* @__PURE__ */ e(h.component, {})
|
|
1710
1753
|
}))
|
|
@@ -1712,10 +1755,10 @@ function Sn() {
|
|
|
1712
1755
|
)
|
|
1713
1756
|
] });
|
|
1714
1757
|
}
|
|
1715
|
-
const
|
|
1758
|
+
const or = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1716
1759
|
__proto__: null,
|
|
1717
|
-
default:
|
|
1718
|
-
}, Symbol.toStringTag, { value: "Module" })), { Text: ge, Paragraph:
|
|
1760
|
+
default: Pn
|
|
1761
|
+
}, Symbol.toStringTag, { value: "Module" })), { Text: ge, Paragraph: cr } = ae, nt = [
|
|
1719
1762
|
{
|
|
1720
1763
|
group: "基础数据",
|
|
1721
1764
|
icon: /* @__PURE__ */ e(fe, {}),
|
|
@@ -1771,8 +1814,8 @@ const nr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
1771
1814
|
]
|
|
1772
1815
|
}
|
|
1773
1816
|
];
|
|
1774
|
-
function
|
|
1775
|
-
const [S,
|
|
1817
|
+
function dr({ onInsert: t, form: l, formField: r = "responseTemplate" }) {
|
|
1818
|
+
const [S, s] = m(""), y = (h) => {
|
|
1776
1819
|
var a;
|
|
1777
1820
|
try {
|
|
1778
1821
|
(a = navigator.clipboard) == null || a.writeText(h);
|
|
@@ -1780,9 +1823,9 @@ function ar({ onInsert: t, form: i, formField: r = "responseTemplate" }) {
|
|
|
1780
1823
|
}
|
|
1781
1824
|
if (t)
|
|
1782
1825
|
t(h);
|
|
1783
|
-
else if (
|
|
1784
|
-
const d =
|
|
1785
|
-
|
|
1826
|
+
else if (l) {
|
|
1827
|
+
const d = l.getFieldValue(r) || "";
|
|
1828
|
+
l.setFieldsValue({ [r]: d + (d.endsWith(`
|
|
1786
1829
|
`) || !d ? "" : " ") + h });
|
|
1787
1830
|
}
|
|
1788
1831
|
b.success(`已插入: ${h}`);
|
|
@@ -1793,12 +1836,12 @@ function ar({ onInsert: t, form: i, formField: r = "responseTemplate" }) {
|
|
|
1793
1836
|
} catch {
|
|
1794
1837
|
b.warning("复制失败,请手动选择");
|
|
1795
1838
|
}
|
|
1796
|
-
}, f = S.toLowerCase(), x =
|
|
1839
|
+
}, f = S.toLowerCase(), x = nt.map((h) => ({
|
|
1797
1840
|
...h,
|
|
1798
1841
|
items: h.items.filter(
|
|
1799
1842
|
(a) => !f || a.syntax.toLowerCase().includes(f) || a.desc.toLowerCase().includes(f) || a.example.toLowerCase().includes(f)
|
|
1800
1843
|
)
|
|
1801
|
-
})).filter((h) => h.items.length > 0), C =
|
|
1844
|
+
})).filter((h) => h.items.length > 0), C = nt.reduce((h, a) => h + a.items.length, 0), _ = x.reduce((h, a) => h + a.items.length, 0);
|
|
1802
1845
|
return /* @__PURE__ */ n(
|
|
1803
1846
|
L,
|
|
1804
1847
|
{
|
|
@@ -1811,16 +1854,16 @@ function ar({ onInsert: t, form: i, formField: r = "responseTemplate" }) {
|
|
|
1811
1854
|
"/",
|
|
1812
1855
|
C
|
|
1813
1856
|
] }),
|
|
1814
|
-
/* @__PURE__ */ e(he, { title: "点击按钮即可插入到上方响应模板;点击 syntax 文本可复制", children: /* @__PURE__ */ e(
|
|
1857
|
+
/* @__PURE__ */ e(he, { title: "点击按钮即可插入到上方响应模板;点击 syntax 文本可复制", children: /* @__PURE__ */ e(Mt, { style: { color: "#999" } }) })
|
|
1815
1858
|
] }),
|
|
1816
1859
|
extra: /* @__PURE__ */ e(
|
|
1817
1860
|
B,
|
|
1818
1861
|
{
|
|
1819
1862
|
size: "small",
|
|
1820
1863
|
placeholder: "搜索 @ 表达式",
|
|
1821
|
-
prefix: /* @__PURE__ */ e(
|
|
1864
|
+
prefix: /* @__PURE__ */ e(yt, {}),
|
|
1822
1865
|
value: S,
|
|
1823
|
-
onChange: (h) =>
|
|
1866
|
+
onChange: (h) => s(h.target.value),
|
|
1824
1867
|
style: { width: 180 },
|
|
1825
1868
|
allowClear: !0
|
|
1826
1869
|
}
|
|
@@ -1864,7 +1907,7 @@ function ar({ onInsert: t, form: i, formField: r = "responseTemplate" }) {
|
|
|
1864
1907
|
{
|
|
1865
1908
|
size: "small",
|
|
1866
1909
|
type: "text",
|
|
1867
|
-
icon: /* @__PURE__ */ e(
|
|
1910
|
+
icon: /* @__PURE__ */ e(ht, {}),
|
|
1868
1911
|
onClick: () => y(a.syntax)
|
|
1869
1912
|
}
|
|
1870
1913
|
) })
|
|
@@ -1876,27 +1919,27 @@ function ar({ onInsert: t, form: i, formField: r = "responseTemplate" }) {
|
|
|
1876
1919
|
}
|
|
1877
1920
|
);
|
|
1878
1921
|
}
|
|
1879
|
-
const { TextArea:
|
|
1880
|
-
function
|
|
1881
|
-
const [
|
|
1882
|
-
y(""), f(null), C(null), d(null), u.resetFields(),
|
|
1922
|
+
const { TextArea: rt } = B, { Text: pe, Paragraph: En } = ae;
|
|
1923
|
+
function ur({ open: t, onClose: l, onSuccess: r, envOptions: S = [] }) {
|
|
1924
|
+
const [s, y] = m(""), [c, f] = m(null), [x, C] = m(null), [_, h] = m(!1), [a, d] = m(null), [g, v] = m(!1), [D, T] = m("import"), [u] = P.useForm(), [i] = P.useForm(), I = () => {
|
|
1925
|
+
y(""), f(null), C(null), d(null), u.resetFields(), i.resetFields();
|
|
1883
1926
|
}, M = () => {
|
|
1884
|
-
I(),
|
|
1885
|
-
},
|
|
1886
|
-
var R, k, N,
|
|
1887
|
-
if (!
|
|
1927
|
+
I(), l();
|
|
1928
|
+
}, X = async () => {
|
|
1929
|
+
var R, k, N, V;
|
|
1930
|
+
if (!s.trim()) {
|
|
1888
1931
|
b.warning("请先粘贴 curl 命令");
|
|
1889
1932
|
return;
|
|
1890
1933
|
}
|
|
1891
1934
|
C(null), f(null), d(null);
|
|
1892
1935
|
try {
|
|
1893
|
-
const U = await j.curl.parse(
|
|
1936
|
+
const U = await j.curl.parse(s);
|
|
1894
1937
|
U.success ? (f(U.data), u.setFieldsValue({
|
|
1895
1938
|
caseName: `from-curl-${((R = U.data) == null ? void 0 : R.method) || "GET"}-${(((k = U.data) == null ? void 0 : k.path) || "").replace(/\W+/g, "-")}`,
|
|
1896
1939
|
caseGroup: "imported",
|
|
1897
1940
|
envCode: S[0] || "default"
|
|
1898
|
-
}),
|
|
1899
|
-
mockName: `mock-${((N = U.data) == null ? void 0 : N.method) || "GET"}-${(((
|
|
1941
|
+
}), i.setFieldsValue({
|
|
1942
|
+
mockName: `mock-${((N = U.data) == null ? void 0 : N.method) || "GET"}-${(((V = U.data) == null ? void 0 : V.path) || "").replace(/\W+/g, "-")}`,
|
|
1900
1943
|
envCode: S[0] || "default",
|
|
1901
1944
|
projectCode: "default",
|
|
1902
1945
|
responseTemplate: `{
|
|
@@ -1908,14 +1951,14 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
1908
1951
|
} catch (U) {
|
|
1909
1952
|
C(String((U == null ? void 0 : U.message) || U));
|
|
1910
1953
|
}
|
|
1911
|
-
},
|
|
1912
|
-
if (!
|
|
1954
|
+
}, H = async () => {
|
|
1955
|
+
if (!s.trim()) {
|
|
1913
1956
|
b.warning("请先粘贴 curl 命令");
|
|
1914
1957
|
return;
|
|
1915
1958
|
}
|
|
1916
1959
|
h(!0), d(null);
|
|
1917
1960
|
try {
|
|
1918
|
-
const R = await j.curl.run(
|
|
1961
|
+
const R = await j.curl.run(s);
|
|
1919
1962
|
d(R);
|
|
1920
1963
|
} catch (R) {
|
|
1921
1964
|
d({ success: !1, error: String((R == null ? void 0 : R.message) || R) });
|
|
@@ -1936,7 +1979,7 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
1936
1979
|
v(!0);
|
|
1937
1980
|
try {
|
|
1938
1981
|
const k = await j.curl.importAsCase({
|
|
1939
|
-
curl:
|
|
1982
|
+
curl: s,
|
|
1940
1983
|
caseName: R.caseName,
|
|
1941
1984
|
caseGroup: R.caseGroup,
|
|
1942
1985
|
envCode: R.envCode
|
|
@@ -1954,14 +1997,14 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
1954
1997
|
}
|
|
1955
1998
|
let R;
|
|
1956
1999
|
try {
|
|
1957
|
-
R = await
|
|
2000
|
+
R = await i.validateFields();
|
|
1958
2001
|
} catch {
|
|
1959
2002
|
return;
|
|
1960
2003
|
}
|
|
1961
2004
|
v(!0);
|
|
1962
2005
|
try {
|
|
1963
2006
|
const k = await j.curl.importAsEndpoint({
|
|
1964
|
-
curl:
|
|
2007
|
+
curl: s,
|
|
1965
2008
|
mockName: R.mockName,
|
|
1966
2009
|
envCode: R.envCode,
|
|
1967
2010
|
projectCode: R.projectCode,
|
|
@@ -1987,11 +2030,11 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
1987
2030
|
size: "large",
|
|
1988
2031
|
destroyOnHidden: !0,
|
|
1989
2032
|
children: [
|
|
1990
|
-
/* @__PURE__ */ e(
|
|
2033
|
+
/* @__PURE__ */ e(En, { type: "secondary", style: { marginBottom: 12 }, children: "从浏览器 DevTools / Postman / 终端复制 curl 命令,粘贴到下方即可解析、试跑、入库。" }),
|
|
1991
2034
|
/* @__PURE__ */ e(
|
|
1992
|
-
|
|
2035
|
+
rt,
|
|
1993
2036
|
{
|
|
1994
|
-
value:
|
|
2037
|
+
value: s,
|
|
1995
2038
|
onChange: (R) => y(R.target.value),
|
|
1996
2039
|
placeholder: `curl -X POST 'https://api.example.com/v1/users/login' \\
|
|
1997
2040
|
-H 'Content-Type: application/json' \\
|
|
@@ -2002,12 +2045,12 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2002
2045
|
}
|
|
2003
2046
|
),
|
|
2004
2047
|
/* @__PURE__ */ n(E, { style: { marginTop: 12 }, children: [
|
|
2005
|
-
/* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(
|
|
2006
|
-
/* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(be, {}), onClick:
|
|
2048
|
+
/* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(Fe, {}), onClick: X, type: "primary", ghost: !0, children: "解析" }),
|
|
2049
|
+
/* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(be, {}), onClick: H, loading: _, children: "直接执行(试跑)" })
|
|
2007
2050
|
] }),
|
|
2008
|
-
x && /* @__PURE__ */ e(
|
|
2051
|
+
x && /* @__PURE__ */ e(W, { type: "error", showIcon: !0, style: { marginTop: 12 }, title: "解析失败", description: x }),
|
|
2009
2052
|
c && /* @__PURE__ */ e(L, { size: "small", style: { marginTop: 16 }, title: "解析结果", children: /* @__PURE__ */ n(z, { column: 1, size: "small", bordered: !0, children: [
|
|
2010
|
-
/* @__PURE__ */ e(z.Item, { label: "Method", children: /* @__PURE__ */ e(w, { color:
|
|
2053
|
+
/* @__PURE__ */ e(z.Item, { label: "Method", children: /* @__PURE__ */ e(w, { color: zn(c.method), children: c.method }) }),
|
|
2011
2054
|
/* @__PURE__ */ e(z.Item, { label: "URL", children: /* @__PURE__ */ e(pe, { code: !0, copyable: !0, children: c.url }) }),
|
|
2012
2055
|
/* @__PURE__ */ e(z.Item, { label: "Path", children: /* @__PURE__ */ e(pe, { code: !0, children: c.path }) }),
|
|
2013
2056
|
c.query && /* @__PURE__ */ e(z.Item, { label: "Query", children: /* @__PURE__ */ e(pe, { code: !0, children: c.query }) }),
|
|
@@ -2040,7 +2083,7 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2040
2083
|
"B"
|
|
2041
2084
|
] }) : /* @__PURE__ */ e(w, { color: "red", children: "FAILED" })
|
|
2042
2085
|
] }), children: [
|
|
2043
|
-
a.error && /* @__PURE__ */ e(
|
|
2086
|
+
a.error && /* @__PURE__ */ e(W, { type: "error", showIcon: !0, title: a.error }),
|
|
2044
2087
|
a.body != null && /* @__PURE__ */ e("pre", { style: {
|
|
2045
2088
|
background: "#f5f5f5",
|
|
2046
2089
|
padding: 8,
|
|
@@ -2067,7 +2110,7 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2067
2110
|
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
2068
2111
|
/* @__PURE__ */ e(O, { span: 12, children: /* @__PURE__ */ e(P.Item, { name: "caseName", label: "用例名称", rules: [{ required: !0 }], children: /* @__PURE__ */ e(B, {}) }) }),
|
|
2069
2112
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "caseGroup", label: "用例分组", children: /* @__PURE__ */ e(B, {}) }) }),
|
|
2070
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", children: S.length > 0 ? /* @__PURE__ */ e(
|
|
2113
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", children: S.length > 0 ? /* @__PURE__ */ e(Z, { options: S.map((R) => ({ value: R, label: R })) }) : /* @__PURE__ */ e(B, {}) }) })
|
|
2071
2114
|
] }),
|
|
2072
2115
|
/* @__PURE__ */ e(
|
|
2073
2116
|
A,
|
|
@@ -2087,14 +2130,14 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2087
2130
|
/* @__PURE__ */ e(fe, {}),
|
|
2088
2131
|
" 导入为 Mock 端点"
|
|
2089
2132
|
] }),
|
|
2090
|
-
children: /* @__PURE__ */ n(P, { form:
|
|
2133
|
+
children: /* @__PURE__ */ n(P, { form: i, layout: "vertical", children: [
|
|
2091
2134
|
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
2092
2135
|
/* @__PURE__ */ e(O, { span: 12, children: /* @__PURE__ */ e(P.Item, { name: "mockName", label: "Mock 名称", rules: [{ required: !0 }], children: /* @__PURE__ */ e(B, {}) }) }),
|
|
2093
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", children: S.length > 0 ? /* @__PURE__ */ e(
|
|
2136
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", children: S.length > 0 ? /* @__PURE__ */ e(Z, { options: S.map((R) => ({ value: R, label: R })) }) : /* @__PURE__ */ e(B, {}) }) }),
|
|
2094
2137
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "projectCode", label: "项目", children: /* @__PURE__ */ e(B, {}) }) })
|
|
2095
2138
|
] }),
|
|
2096
2139
|
/* @__PURE__ */ e(P.Item, { name: "responseTemplate", label: "响应模板 (JSON)", children: /* @__PURE__ */ e(
|
|
2097
|
-
|
|
2140
|
+
rt,
|
|
2098
2141
|
{
|
|
2099
2142
|
autoSize: { minRows: 3, maxRows: 8 },
|
|
2100
2143
|
style: { fontFamily: "Menlo, Monaco, monospace" }
|
|
@@ -2119,16 +2162,16 @@ function lr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2119
2162
|
}
|
|
2120
2163
|
);
|
|
2121
2164
|
}
|
|
2122
|
-
function
|
|
2165
|
+
function zn(t) {
|
|
2123
2166
|
return { GET: "blue", POST: "green", PUT: "orange", DELETE: "red", PATCH: "purple" }[t] || "default";
|
|
2124
2167
|
}
|
|
2125
|
-
const { TextArea:
|
|
2126
|
-
function
|
|
2127
|
-
const [
|
|
2168
|
+
const { TextArea: at } = B;
|
|
2169
|
+
function pr({ open: t, onClose: l, onSuccess: r, envOptions: S = [] }) {
|
|
2170
|
+
const [s, y] = m("paste"), [c, f] = m(""), [x, C] = m(null), [_, h] = m(null), [a, d] = m(!1), [g, v] = m([]), [D, T] = m(!1), [u] = P.useForm(), i = ot(null), I = () => {
|
|
2128
2171
|
f(""), C(null), h(null), v([]), u.resetFields();
|
|
2129
2172
|
}, M = () => {
|
|
2130
|
-
I(),
|
|
2131
|
-
},
|
|
2173
|
+
I(), l();
|
|
2174
|
+
}, X = async () => {
|
|
2132
2175
|
if (!c.trim()) {
|
|
2133
2176
|
b.warning("请先粘贴或上传 API 规约");
|
|
2134
2177
|
return;
|
|
@@ -2136,7 +2179,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2136
2179
|
h(null), d(!0);
|
|
2137
2180
|
try {
|
|
2138
2181
|
const k = await j.openapi.parse(c);
|
|
2139
|
-
k.success ? (C(k), v((k.endpoints || []).map((N,
|
|
2182
|
+
k.success ? (C(k), v((k.endpoints || []).map((N, V) => V)), u.setFieldsValue({
|
|
2140
2183
|
envCode: S[0] || "default",
|
|
2141
2184
|
projectCode: "default",
|
|
2142
2185
|
defaultResponse: `{
|
|
@@ -2153,7 +2196,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2153
2196
|
} finally {
|
|
2154
2197
|
d(!1);
|
|
2155
2198
|
}
|
|
2156
|
-
},
|
|
2199
|
+
}, H = async (k) => {
|
|
2157
2200
|
try {
|
|
2158
2201
|
const N = await j.openapi.sample(k);
|
|
2159
2202
|
N.success && (f(N.content), b.success(`已加载 ${N.format} 示例`));
|
|
@@ -2162,9 +2205,9 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2162
2205
|
}
|
|
2163
2206
|
}, p = (k) => {
|
|
2164
2207
|
const N = new FileReader();
|
|
2165
|
-
return N.onload = (
|
|
2208
|
+
return N.onload = (V) => {
|
|
2166
2209
|
var U;
|
|
2167
|
-
f(String(((U =
|
|
2210
|
+
f(String(((U = V.target) == null ? void 0 : U.result) || "")), b.success(`已读取 ${k.name}(${(k.size / 1024).toFixed(1)}KB)`);
|
|
2168
2211
|
}, N.onerror = () => b.error("文件读取失败"), N.readAsText(k), !1;
|
|
2169
2212
|
}, o = async () => {
|
|
2170
2213
|
if (!x) {
|
|
@@ -2179,10 +2222,10 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2179
2222
|
}
|
|
2180
2223
|
T(!0);
|
|
2181
2224
|
try {
|
|
2182
|
-
const N = (x.endpoints || []).map((U,
|
|
2225
|
+
const N = (x.endpoints || []).map((U, We) => ({
|
|
2183
2226
|
method: U.method,
|
|
2184
2227
|
path: U.path
|
|
2185
|
-
})).filter((U,
|
|
2228
|
+
})).filter((U, We) => g.includes(We)), V = await j.openapi.importBatch({
|
|
2186
2229
|
content: c,
|
|
2187
2230
|
selected: N,
|
|
2188
2231
|
envCode: k.envCode,
|
|
@@ -2192,7 +2235,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2192
2235
|
priority: k.priority,
|
|
2193
2236
|
tagPrefix: k.tagPrefix
|
|
2194
2237
|
});
|
|
2195
|
-
|
|
2238
|
+
V.success ? (b.success(`已导入 ${V.imported} 个 Mock 端点${V.failed > 0 ? `,失败 ${V.failed}` : ""}`), r && r(V), M()) : b.error(V.message || "导入失败");
|
|
2196
2239
|
} catch (N) {
|
|
2197
2240
|
b.error(String((N == null ? void 0 : N.message) || N));
|
|
2198
2241
|
} finally {
|
|
@@ -2203,7 +2246,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2203
2246
|
title: "Method",
|
|
2204
2247
|
dataIndex: "method",
|
|
2205
2248
|
width: 90,
|
|
2206
|
-
render: (k) => /* @__PURE__ */ e(w, { color:
|
|
2249
|
+
render: (k) => /* @__PURE__ */ e(w, { color: Rn(k), children: k })
|
|
2207
2250
|
},
|
|
2208
2251
|
{ title: "Path", dataIndex: "path", width: 240, ellipsis: !0 },
|
|
2209
2252
|
{ title: "Summary", dataIndex: "summary", ellipsis: !0 },
|
|
@@ -2232,7 +2275,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2232
2275
|
me,
|
|
2233
2276
|
{
|
|
2234
2277
|
title: /* @__PURE__ */ n(E, { children: [
|
|
2235
|
-
/* @__PURE__ */ e(
|
|
2278
|
+
/* @__PURE__ */ e(Ze, {}),
|
|
2236
2279
|
" 批量导入 API 规约"
|
|
2237
2280
|
] }),
|
|
2238
2281
|
open: t,
|
|
@@ -2244,18 +2287,18 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2244
2287
|
/* @__PURE__ */ e(
|
|
2245
2288
|
ke,
|
|
2246
2289
|
{
|
|
2247
|
-
activeKey:
|
|
2290
|
+
activeKey: s,
|
|
2248
2291
|
onChange: y,
|
|
2249
2292
|
items: [
|
|
2250
2293
|
{
|
|
2251
2294
|
key: "paste",
|
|
2252
2295
|
label: /* @__PURE__ */ n("span", { children: [
|
|
2253
|
-
/* @__PURE__ */ e(
|
|
2296
|
+
/* @__PURE__ */ e(Fe, {}),
|
|
2254
2297
|
" 粘贴 JSON"
|
|
2255
2298
|
] }),
|
|
2256
2299
|
children: /* @__PURE__ */ n("div", { children: [
|
|
2257
2300
|
/* @__PURE__ */ e(
|
|
2258
|
-
|
|
2301
|
+
at,
|
|
2259
2302
|
{
|
|
2260
2303
|
value: c,
|
|
2261
2304
|
onChange: (k) => f(k.target.value),
|
|
@@ -2265,28 +2308,28 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2265
2308
|
}
|
|
2266
2309
|
),
|
|
2267
2310
|
/* @__PURE__ */ n(E, { style: { marginTop: 8 }, children: [
|
|
2268
|
-
/* @__PURE__ */ e(A, { size: "small", onClick: () =>
|
|
2269
|
-
/* @__PURE__ */ e(A, { size: "small", onClick: () =>
|
|
2270
|
-
/* @__PURE__ */ e(A, { size: "small", onClick: () =>
|
|
2311
|
+
/* @__PURE__ */ e(A, { size: "small", onClick: () => H("openapi3"), children: "加载 OpenAPI 3 示例" }),
|
|
2312
|
+
/* @__PURE__ */ e(A, { size: "small", onClick: () => H("swagger2"), children: "加载 Swagger 2 示例" }),
|
|
2313
|
+
/* @__PURE__ */ e(A, { size: "small", onClick: () => H("postman"), children: "加载 Postman 示例" })
|
|
2271
2314
|
] })
|
|
2272
2315
|
] })
|
|
2273
2316
|
},
|
|
2274
2317
|
{
|
|
2275
2318
|
key: "upload",
|
|
2276
2319
|
label: /* @__PURE__ */ n("span", { children: [
|
|
2277
|
-
/* @__PURE__ */ e(
|
|
2320
|
+
/* @__PURE__ */ e(Dt, {}),
|
|
2278
2321
|
" 上传文件"
|
|
2279
2322
|
] }),
|
|
2280
2323
|
children: /* @__PURE__ */ n(
|
|
2281
|
-
|
|
2324
|
+
Tt.Dragger,
|
|
2282
2325
|
{
|
|
2283
|
-
ref:
|
|
2326
|
+
ref: i,
|
|
2284
2327
|
accept: ".json,.yaml,.yml,application/json,text/yaml",
|
|
2285
2328
|
beforeUpload: p,
|
|
2286
2329
|
showUploadList: !1,
|
|
2287
2330
|
style: { padding: 24 },
|
|
2288
2331
|
children: [
|
|
2289
|
-
/* @__PURE__ */ e("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ e(
|
|
2332
|
+
/* @__PURE__ */ e("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ e(Ze, { style: { fontSize: 48, color: "#1890ff" } }) }),
|
|
2290
2333
|
/* @__PURE__ */ e("p", { className: "ant-upload-text", children: "点击或拖拽 JSON / YAML 文件到此处" }),
|
|
2291
2334
|
/* @__PURE__ */ e("p", { className: "ant-upload-hint", children: "支持 OpenAPI 3.x / Swagger 2.0 / Postman v2.1" })
|
|
2292
2335
|
]
|
|
@@ -2297,7 +2340,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2297
2340
|
}
|
|
2298
2341
|
),
|
|
2299
2342
|
/* @__PURE__ */ n(E, { style: { marginTop: 12 }, children: [
|
|
2300
|
-
/* @__PURE__ */ e(A, { type: "primary", icon: /* @__PURE__ */ e(be, {}), onClick:
|
|
2343
|
+
/* @__PURE__ */ e(A, { type: "primary", icon: /* @__PURE__ */ e(be, {}), onClick: X, loading: a, children: "解析" }),
|
|
2301
2344
|
x && /* @__PURE__ */ e(w, { color: "blue", children: x.format }),
|
|
2302
2345
|
x && /* @__PURE__ */ n(w, { children: [
|
|
2303
2346
|
"共 ",
|
|
@@ -2306,7 +2349,7 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2306
2349
|
g.length
|
|
2307
2350
|
] })
|
|
2308
2351
|
] }),
|
|
2309
|
-
_ && /* @__PURE__ */ e(
|
|
2352
|
+
_ && /* @__PURE__ */ e(W, { type: "error", showIcon: !0, style: { marginTop: 12 }, title: "解析失败", description: _ }),
|
|
2310
2353
|
x && /* 端点预览 —— 走基座 ListTable(lead 008 §2 三件套):
|
|
2311
2354
|
标准分页 + 端侧过滤 + EmptyState。
|
|
2312
2355
|
原来那层 <Card size="small" title="预览(可勾选要导入的)"> 已去掉,
|
|
@@ -2332,14 +2375,14 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2332
2375
|
),
|
|
2333
2376
|
x && /* @__PURE__ */ e(L, { size: "small", style: { marginTop: 16 }, title: "导入配置", children: /* @__PURE__ */ n(P, { form: u, layout: "vertical", children: [
|
|
2334
2377
|
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
2335
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", rules: [{ required: !0 }], children: S.length > 0 ? /* @__PURE__ */ e(
|
|
2378
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "envCode", label: "环境", rules: [{ required: !0 }], children: S.length > 0 ? /* @__PURE__ */ e(Z, { options: S.map((k) => ({ value: k, label: k })) }) : /* @__PURE__ */ e(B, {}) }) }),
|
|
2336
2379
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(P.Item, { name: "projectCode", label: "项目", children: /* @__PURE__ */ e(B, {}) }) }),
|
|
2337
2380
|
/* @__PURE__ */ e(O, { span: 4, children: /* @__PURE__ */ e(P.Item, { name: "defaultStatus", label: "默认状态码", children: /* @__PURE__ */ e(B, { type: "number" }) }) }),
|
|
2338
2381
|
/* @__PURE__ */ e(O, { span: 4, children: /* @__PURE__ */ e(P.Item, { name: "priority", label: "优先级", children: /* @__PURE__ */ e(B, { type: "number" }) }) }),
|
|
2339
2382
|
/* @__PURE__ */ e(O, { span: 4, children: /* @__PURE__ */ e(P.Item, { name: "tagPrefix", label: "Tag 前缀", children: /* @__PURE__ */ e(B, {}) }) })
|
|
2340
2383
|
] }),
|
|
2341
2384
|
/* @__PURE__ */ e(P.Item, { name: "defaultResponse", label: "默认响应(无 example 时使用)", children: /* @__PURE__ */ e(
|
|
2342
|
-
|
|
2385
|
+
at,
|
|
2343
2386
|
{
|
|
2344
2387
|
autoSize: { minRows: 3, maxRows: 6 },
|
|
2345
2388
|
style: { fontFamily: "Menlo, Monaco, monospace" }
|
|
@@ -2366,22 +2409,22 @@ function sr({ open: t, onClose: i, onSuccess: r, envOptions: S = [] }) {
|
|
|
2366
2409
|
}
|
|
2367
2410
|
);
|
|
2368
2411
|
}
|
|
2369
|
-
function
|
|
2412
|
+
function Rn(t) {
|
|
2370
2413
|
return { GET: "blue", POST: "green", PUT: "orange", DELETE: "red", PATCH: "purple" }[t] || "default";
|
|
2371
2414
|
}
|
|
2372
|
-
const
|
|
2415
|
+
const On = {
|
|
2373
2416
|
STANDARD_JSON: { label: "标准 JSON", color: "blue" },
|
|
2374
2417
|
RSS_XML: { label: "RSS 2.0", color: "orange" },
|
|
2375
2418
|
ATOM_XML: { label: "Atom 1.0", color: "gold" },
|
|
2376
2419
|
CUSTOM_SCRIPT: { label: "自定义脚本", color: "purple" },
|
|
2377
2420
|
INTERNAL_BEAN: { label: "内部 Bean", color: "cyan" }
|
|
2378
|
-
},
|
|
2421
|
+
}, Ln = {
|
|
2379
2422
|
PENDING_VERIFY: { color: "default", text: "待验证" },
|
|
2380
2423
|
VERIFIED: { color: "green", text: "已验证" },
|
|
2381
2424
|
INVALID_AUTH: { color: "red", text: "鉴权失败" },
|
|
2382
2425
|
FATAL: { color: "red", text: "永久失败" },
|
|
2383
2426
|
DISABLED: { color: "default", text: "已停用" }
|
|
2384
|
-
},
|
|
2427
|
+
}, lt = {
|
|
2385
2428
|
PENDING: { color: "default" },
|
|
2386
2429
|
RUNNING: { color: "processing" },
|
|
2387
2430
|
SUCCESS: { color: "green" },
|
|
@@ -2389,25 +2432,25 @@ const An = {
|
|
|
2389
2432
|
FAILED: { color: "red" },
|
|
2390
2433
|
FATAL: { color: "red" }
|
|
2391
2434
|
};
|
|
2392
|
-
function
|
|
2393
|
-
const t = xe(), [
|
|
2394
|
-
|
|
2435
|
+
function Mn() {
|
|
2436
|
+
const t = xe(), [l, r] = m([]), [S, s] = m(!1), [y, c] = m(null), [f, x] = m([]), [C, _] = m({}), [h, a] = m(null), [d, g] = m([]), v = async () => {
|
|
2437
|
+
s(!0);
|
|
2395
2438
|
try {
|
|
2396
2439
|
const p = await $.get("/subscribe/subscription/list");
|
|
2397
2440
|
p && p.success !== !1 && r(Array.isArray(p.data) ? p.data : Array.isArray(p) ? p : []);
|
|
2398
2441
|
} catch (p) {
|
|
2399
2442
|
b.error("获取订阅列表失败: " + ((p == null ? void 0 : p.message) || ""));
|
|
2400
2443
|
} finally {
|
|
2401
|
-
|
|
2444
|
+
s(!1);
|
|
2402
2445
|
}
|
|
2403
2446
|
};
|
|
2404
|
-
|
|
2447
|
+
K(() => {
|
|
2405
2448
|
v();
|
|
2406
2449
|
}, []);
|
|
2407
2450
|
const D = (p) => {
|
|
2408
2451
|
me.confirm({
|
|
2409
2452
|
title: "确认删除",
|
|
2410
|
-
icon: /* @__PURE__ */ e(
|
|
2453
|
+
icon: /* @__PURE__ */ e(jt, {}),
|
|
2411
2454
|
content: `确定要删除订阅 "${p.name}" 吗? 运行历史会保留.`,
|
|
2412
2455
|
onOk: async () => {
|
|
2413
2456
|
try {
|
|
@@ -2432,7 +2475,7 @@ function Pn() {
|
|
|
2432
2475
|
} catch (o) {
|
|
2433
2476
|
b.error("停用失败: " + ((o == null ? void 0 : o.message) || ""));
|
|
2434
2477
|
}
|
|
2435
|
-
},
|
|
2478
|
+
}, i = async (p) => {
|
|
2436
2479
|
me.confirm({
|
|
2437
2480
|
title: "手动触发",
|
|
2438
2481
|
content: `将立即执行一次 "${p.name}" 的抽取, 同步返回 runId.`,
|
|
@@ -2463,7 +2506,7 @@ function Pn() {
|
|
|
2463
2506
|
} catch {
|
|
2464
2507
|
b.error("获取运行历史失败");
|
|
2465
2508
|
}
|
|
2466
|
-
},
|
|
2509
|
+
}, X = async (p) => {
|
|
2467
2510
|
if (C[p]) {
|
|
2468
2511
|
a(p);
|
|
2469
2512
|
return;
|
|
@@ -2484,7 +2527,7 @@ function Pn() {
|
|
|
2484
2527
|
}
|
|
2485
2528
|
),
|
|
2486
2529
|
/* @__PURE__ */ e(
|
|
2487
|
-
|
|
2530
|
+
W,
|
|
2488
2531
|
{
|
|
2489
2532
|
type: "info",
|
|
2490
2533
|
showIcon: !0,
|
|
@@ -2495,7 +2538,7 @@ function Pn() {
|
|
|
2495
2538
|
/* @__PURE__ */ e(
|
|
2496
2539
|
se,
|
|
2497
2540
|
{
|
|
2498
|
-
rows:
|
|
2541
|
+
rows: l,
|
|
2499
2542
|
columns: [
|
|
2500
2543
|
{
|
|
2501
2544
|
title: "ID",
|
|
@@ -2521,7 +2564,7 @@ function Pn() {
|
|
|
2521
2564
|
dataIndex: "extractorType",
|
|
2522
2565
|
width: 140,
|
|
2523
2566
|
render: (p) => {
|
|
2524
|
-
const o =
|
|
2567
|
+
const o = On[p] || { label: p, color: "default" };
|
|
2525
2568
|
return /* @__PURE__ */ e(w, { color: o.color, children: o.label });
|
|
2526
2569
|
}
|
|
2527
2570
|
},
|
|
@@ -2536,7 +2579,7 @@ function Pn() {
|
|
|
2536
2579
|
dataIndex: "status",
|
|
2537
2580
|
width: 110,
|
|
2538
2581
|
render: (p) => {
|
|
2539
|
-
const o =
|
|
2582
|
+
const o = Ln[p] || { color: "default", text: p };
|
|
2540
2583
|
return /* @__PURE__ */ e(w, { color: o.color, children: o.text });
|
|
2541
2584
|
}
|
|
2542
2585
|
},
|
|
@@ -2552,7 +2595,7 @@ function Pn() {
|
|
|
2552
2595
|
width: 110,
|
|
2553
2596
|
render: (p, o) => {
|
|
2554
2597
|
var R;
|
|
2555
|
-
return p ? /* @__PURE__ */ e(he, { title: o.lastError || "", children: /* @__PURE__ */ e(w, { color: ((R =
|
|
2598
|
+
return p ? /* @__PURE__ */ e(he, { title: o.lastError || "", children: /* @__PURE__ */ e(w, { color: ((R = lt[p]) == null ? void 0 : R.color) || "default", children: p }) }) : /* @__PURE__ */ e("span", { style: { color: "#ccc" }, children: "-" });
|
|
2556
2599
|
}
|
|
2557
2600
|
},
|
|
2558
2601
|
{
|
|
@@ -2579,7 +2622,7 @@ function Pn() {
|
|
|
2579
2622
|
{
|
|
2580
2623
|
type: "link",
|
|
2581
2624
|
size: "small",
|
|
2582
|
-
icon: /* @__PURE__ */ e(
|
|
2625
|
+
icon: /* @__PURE__ */ e($t, {}),
|
|
2583
2626
|
onClick: () => t(`/subscribe/edit/${o.id}`),
|
|
2584
2627
|
children: "编辑"
|
|
2585
2628
|
}
|
|
@@ -2600,7 +2643,7 @@ function Pn() {
|
|
|
2600
2643
|
type: "link",
|
|
2601
2644
|
size: "small",
|
|
2602
2645
|
icon: /* @__PURE__ */ e(Ee, {}),
|
|
2603
|
-
onClick: () =>
|
|
2646
|
+
onClick: () => i(o),
|
|
2604
2647
|
children: "触发"
|
|
2605
2648
|
}
|
|
2606
2649
|
),
|
|
@@ -2618,7 +2661,7 @@ function Pn() {
|
|
|
2618
2661
|
{
|
|
2619
2662
|
type: "link",
|
|
2620
2663
|
size: "small",
|
|
2621
|
-
icon: /* @__PURE__ */ e(
|
|
2664
|
+
icon: /* @__PURE__ */ e(Nt, {}),
|
|
2622
2665
|
onClick: () => u(o.id),
|
|
2623
2666
|
children: "停用"
|
|
2624
2667
|
}
|
|
@@ -2627,12 +2670,12 @@ function Pn() {
|
|
|
2627
2670
|
{
|
|
2628
2671
|
type: "link",
|
|
2629
2672
|
size: "small",
|
|
2630
|
-
icon: /* @__PURE__ */ e(
|
|
2673
|
+
icon: /* @__PURE__ */ e(Ke, {}),
|
|
2631
2674
|
onClick: () => T(o.id),
|
|
2632
2675
|
children: "启用"
|
|
2633
2676
|
}
|
|
2634
2677
|
),
|
|
2635
|
-
/* @__PURE__ */ e(Ue, { title: "确认删除?", onConfirm: () => D(o), okText: "删除", cancelText: "取消", children: /* @__PURE__ */ e(A, { type: "link", size: "small", danger: !0, icon: /* @__PURE__ */ e(
|
|
2678
|
+
/* @__PURE__ */ e(Ue, { title: "确认删除?", onConfirm: () => D(o), okText: "删除", cancelText: "取消", children: /* @__PURE__ */ e(A, { type: "link", size: "small", danger: !0, icon: /* @__PURE__ */ e(Bt, {}), children: "删除" }) })
|
|
2636
2679
|
] })
|
|
2637
2680
|
}
|
|
2638
2681
|
],
|
|
@@ -2650,7 +2693,7 @@ function Pn() {
|
|
|
2650
2693
|
A,
|
|
2651
2694
|
{
|
|
2652
2695
|
type: "primary",
|
|
2653
|
-
icon: /* @__PURE__ */ e(
|
|
2696
|
+
icon: /* @__PURE__ */ e(gt, {}),
|
|
2654
2697
|
onClick: () => t("/subscribe/new"),
|
|
2655
2698
|
children: "新建订阅"
|
|
2656
2699
|
}
|
|
@@ -2689,7 +2732,7 @@ function Pn() {
|
|
|
2689
2732
|
emptyTitle: "暂无运行记录",
|
|
2690
2733
|
emptyDescription: "该订阅还没有运行过。",
|
|
2691
2734
|
cardProps: { variant: "borderless", styles: { body: { padding: 0 } } },
|
|
2692
|
-
onRow: (p) => ({ onClick: () =>
|
|
2735
|
+
onRow: (p) => ({ onClick: () => X(p.id) }),
|
|
2693
2736
|
columns: [
|
|
2694
2737
|
{ title: "runId", dataIndex: "id", width: 70 },
|
|
2695
2738
|
{
|
|
@@ -2705,7 +2748,7 @@ function Pn() {
|
|
|
2705
2748
|
width: 90,
|
|
2706
2749
|
render: (p) => {
|
|
2707
2750
|
var o;
|
|
2708
|
-
return /* @__PURE__ */ e(w, { color: (o =
|
|
2751
|
+
return /* @__PURE__ */ e(w, { color: (o = lt[p]) == null ? void 0 : o.color, children: p });
|
|
2709
2752
|
}
|
|
2710
2753
|
},
|
|
2711
2754
|
{
|
|
@@ -2805,12 +2848,12 @@ function Pn() {
|
|
|
2805
2848
|
}
|
|
2806
2849
|
]
|
|
2807
2850
|
}
|
|
2808
|
-
) : /* @__PURE__ */ e(
|
|
2851
|
+
) : /* @__PURE__ */ e(Dn, { result: y == null ? void 0 : y.result })
|
|
2809
2852
|
}
|
|
2810
2853
|
)
|
|
2811
2854
|
] });
|
|
2812
2855
|
}
|
|
2813
|
-
function
|
|
2856
|
+
function Dn({ result: t }) {
|
|
2814
2857
|
return t ? t.success ? /* @__PURE__ */ n(E, { orientation: "vertical", style: { width: "100%" }, size: "middle", children: [
|
|
2815
2858
|
/* @__PURE__ */ e(L, { size: "small", title: "调用结果", children: /* @__PURE__ */ n(E, { size: "large", wrap: !0, children: [
|
|
2816
2859
|
/* @__PURE__ */ n("span", { children: [
|
|
@@ -2852,73 +2895,73 @@ function En({ result: t }) {
|
|
|
2852
2895
|
overflow: "auto",
|
|
2853
2896
|
fontSize: 12
|
|
2854
2897
|
}, children: t.responsePreview }) }),
|
|
2855
|
-
t.fieldErrors && t.fieldErrors.length > 0 && /* @__PURE__ */ e(
|
|
2856
|
-
] }) : /* @__PURE__ */ e(
|
|
2898
|
+
t.fieldErrors && t.fieldErrors.length > 0 && /* @__PURE__ */ e(W, { type: "warning", showIcon: !0, message: "字段问题", description: /* @__PURE__ */ e("ul", { children: t.fieldErrors.map((l, r) => /* @__PURE__ */ e("li", { children: l }, r)) }) })
|
|
2899
|
+
] }) : /* @__PURE__ */ e(W, { type: "error", showIcon: !0, title: "试运行失败", description: t.errorMessage || "未知错误" }) : null;
|
|
2857
2900
|
}
|
|
2858
|
-
const
|
|
2901
|
+
const $n = [
|
|
2859
2902
|
{ value: "STANDARD_JSON", label: "标准 JSON (按统一契约返回的 JSON)" },
|
|
2860
2903
|
{ value: "RSS_XML", label: "RSS 2.0 (XML feed)" },
|
|
2861
2904
|
{ value: "ATOM_XML", label: "Atom 1.0 (XML feed)" },
|
|
2862
2905
|
{ value: "CUSTOM_SCRIPT", label: "自定义脚本 (z-script 平台)" },
|
|
2863
2906
|
{ value: "INTERNAL_BEAN", label: "内部 Bean (我们自己的模块, 暂未启用)" }
|
|
2864
|
-
],
|
|
2907
|
+
], Nn = [
|
|
2865
2908
|
{ value: "NONE", label: "无鉴权" },
|
|
2866
2909
|
{ value: "BEARER", label: "Bearer (Authorization: Bearer xxx)" },
|
|
2867
2910
|
{ value: "API_KEY", label: "API Key (Authorization: xxx)" },
|
|
2868
2911
|
{ value: "BASIC", label: "Basic (user:password base64)" }
|
|
2869
|
-
],
|
|
2912
|
+
], Bn = [
|
|
2870
2913
|
{ label: "每 5 分钟", value: "0 */5 * * * ?" },
|
|
2871
2914
|
{ label: "每 15 分钟", value: "0 */15 * * * ?" },
|
|
2872
2915
|
{ label: "每小时", value: "0 0 * * * ?" },
|
|
2873
2916
|
{ label: "每 6 小时", value: "0 0 */6 * * ?" },
|
|
2874
2917
|
{ label: "每天 8 点", value: "0 0 8 * * ?" }
|
|
2875
2918
|
];
|
|
2876
|
-
function
|
|
2877
|
-
const { id: t } =
|
|
2878
|
-
|
|
2919
|
+
function st() {
|
|
2920
|
+
const { id: t } = ct(), l = xe(), r = !!t, [S] = P.useForm(), [s, y] = m(!1), [c, f] = m(!1), [x, C] = m([]), [_, h] = m([]), a = P.useWatch("sourceType", S), d = P.useWatch("extractorType", S), g = P.useWatch("authType", S);
|
|
2921
|
+
K(() => {
|
|
2879
2922
|
v(), D(), r && T();
|
|
2880
2923
|
}, [t]);
|
|
2881
2924
|
const v = async () => {
|
|
2882
2925
|
try {
|
|
2883
|
-
const
|
|
2926
|
+
const i = await $.get("/secret/list"), I = (i == null ? void 0 : i.data) ?? i ?? [];
|
|
2884
2927
|
C(Array.isArray(I) ? I : []);
|
|
2885
2928
|
} catch {
|
|
2886
2929
|
}
|
|
2887
2930
|
}, D = async () => {
|
|
2888
2931
|
try {
|
|
2889
|
-
const
|
|
2932
|
+
const i = await $.get("/script/list"), I = (i == null ? void 0 : i.data) ?? i ?? [];
|
|
2890
2933
|
h(Array.isArray(I) ? I.filter((M) => M.status === 1) : []);
|
|
2891
2934
|
} catch {
|
|
2892
2935
|
}
|
|
2893
2936
|
}, T = async () => {
|
|
2894
2937
|
y(!0);
|
|
2895
2938
|
try {
|
|
2896
|
-
const
|
|
2939
|
+
const i = await $.get(`/subscribe/subscription/${t}`), I = (i == null ? void 0 : i.data) ?? i;
|
|
2897
2940
|
I && S.setFieldsValue({
|
|
2898
2941
|
...I,
|
|
2899
2942
|
enabled: I.enabled === 1 || I.enabled === !0
|
|
2900
2943
|
});
|
|
2901
|
-
} catch (
|
|
2902
|
-
b.error("加载订阅失败: " + ((
|
|
2944
|
+
} catch (i) {
|
|
2945
|
+
b.error("加载订阅失败: " + ((i == null ? void 0 : i.message) || ""));
|
|
2903
2946
|
} finally {
|
|
2904
2947
|
y(!1);
|
|
2905
2948
|
}
|
|
2906
2949
|
}, u = async () => {
|
|
2907
2950
|
try {
|
|
2908
|
-
const
|
|
2951
|
+
const i = await S.validateFields();
|
|
2909
2952
|
f(!0);
|
|
2910
2953
|
const I = {
|
|
2911
|
-
...
|
|
2912
|
-
enabled:
|
|
2954
|
+
...i,
|
|
2955
|
+
enabled: i.enabled ? 1 : 0
|
|
2913
2956
|
};
|
|
2914
2957
|
let M;
|
|
2915
2958
|
if (r ? M = await $.put("/subscribe/subscription", I) : M = await $.post("/subscribe/subscription", I), M && M.success === !1) {
|
|
2916
2959
|
b.error(M.message || "保存失败");
|
|
2917
2960
|
return;
|
|
2918
2961
|
}
|
|
2919
|
-
b.success(r ? "已更新 (注意: 修改 cron / url / 抽取器后会自动重置为 PENDING_VERIFY)" : "已创建, 已自动验证"),
|
|
2920
|
-
} catch (
|
|
2921
|
-
|
|
2962
|
+
b.success(r ? "已更新 (注意: 修改 cron / url / 抽取器后会自动重置为 PENDING_VERIFY)" : "已创建, 已自动验证"), l("/subscribe/list");
|
|
2963
|
+
} catch (i) {
|
|
2964
|
+
i != null && i.errorFields ? b.warning("请检查表单") : b.error("保存失败: " + ((i == null ? void 0 : i.message) || ""));
|
|
2922
2965
|
} finally {
|
|
2923
2966
|
f(!1);
|
|
2924
2967
|
}
|
|
@@ -2931,12 +2974,12 @@ function lt() {
|
|
|
2931
2974
|
subtitle: "配置数据源、抽取器、鉴权与调度策略",
|
|
2932
2975
|
back: !0,
|
|
2933
2976
|
extra: /* @__PURE__ */ n(E, { children: [
|
|
2934
|
-
/* @__PURE__ */ e(A, { onClick: () =>
|
|
2935
|
-
/* @__PURE__ */ e(A, { type: "primary", icon: /* @__PURE__ */ e(
|
|
2977
|
+
/* @__PURE__ */ e(A, { onClick: () => l("/subscribe/list"), children: "取消" }),
|
|
2978
|
+
/* @__PURE__ */ e(A, { type: "primary", icon: /* @__PURE__ */ e(ft, {}), loading: c, onClick: u, children: "保存 (自动验证)" })
|
|
2936
2979
|
] })
|
|
2937
2980
|
}
|
|
2938
2981
|
),
|
|
2939
|
-
/* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(_e, { spinning:
|
|
2982
|
+
/* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(_e, { spinning: s, children: /* @__PURE__ */ n(
|
|
2940
2983
|
P,
|
|
2941
2984
|
{
|
|
2942
2985
|
form: S,
|
|
@@ -2972,7 +3015,7 @@ function lt() {
|
|
|
2972
3015
|
}
|
|
2973
3016
|
),
|
|
2974
3017
|
/* @__PURE__ */ n(E, { size: "large", style: { width: "100%" }, children: [
|
|
2975
|
-
/* @__PURE__ */ e(P.Item, { label: "HTTP 方法", name: "httpMethod", children: /* @__PURE__ */ e(
|
|
3018
|
+
/* @__PURE__ */ e(P.Item, { label: "HTTP 方法", name: "httpMethod", children: /* @__PURE__ */ e(Z, { style: { width: 120 }, options: [
|
|
2976
3019
|
{ value: "GET", label: "GET" },
|
|
2977
3020
|
{ value: "POST", label: "POST" },
|
|
2978
3021
|
{ value: "PUT", label: "PUT" }
|
|
@@ -2984,7 +3027,7 @@ function lt() {
|
|
|
2984
3027
|
] })
|
|
2985
3028
|
] }),
|
|
2986
3029
|
/* @__PURE__ */ n(L, { type: "inner", title: "鉴权 (从 z-mist 拉取 secret)", style: { marginBottom: 16 }, children: [
|
|
2987
|
-
/* @__PURE__ */ e(P.Item, { label: "鉴权方式", name: "authType", children: /* @__PURE__ */ e(
|
|
3030
|
+
/* @__PURE__ */ e(P.Item, { label: "鉴权方式", name: "authType", children: /* @__PURE__ */ e(Z, { options: Nn }) }),
|
|
2988
3031
|
g && g !== "NONE" && /* @__PURE__ */ e(
|
|
2989
3032
|
P.Item,
|
|
2990
3033
|
{
|
|
@@ -2992,14 +3035,14 @@ function lt() {
|
|
|
2992
3035
|
name: "authSecretKey",
|
|
2993
3036
|
extra: "从密钥中心 (z-mist) 选一个 secret; secret 的解密值会作为 secret 注入",
|
|
2994
3037
|
children: /* @__PURE__ */ e(
|
|
2995
|
-
|
|
3038
|
+
Z,
|
|
2996
3039
|
{
|
|
2997
3040
|
showSearch: !0,
|
|
2998
3041
|
allowClear: !0,
|
|
2999
3042
|
placeholder: "选择 secret (key)",
|
|
3000
|
-
options: x.map((
|
|
3001
|
-
value:
|
|
3002
|
-
label: `${
|
|
3043
|
+
options: x.map((i) => ({
|
|
3044
|
+
value: i.secretKey,
|
|
3045
|
+
label: `${i.secretKey}${i.secretName ? " (" + i.secretName + ")" : ""}`
|
|
3003
3046
|
}))
|
|
3004
3047
|
}
|
|
3005
3048
|
)
|
|
@@ -3014,7 +3057,7 @@ function lt() {
|
|
|
3014
3057
|
name: "extractorType",
|
|
3015
3058
|
rules: [{ required: !0 }],
|
|
3016
3059
|
extra: "STANDARD_JSON/RSS_XML/ATOM_XML 直接解析; CUSTOM_SCRIPT 调 z-script 平台",
|
|
3017
|
-
children: /* @__PURE__ */ e(
|
|
3060
|
+
children: /* @__PURE__ */ e(Z, { options: $n })
|
|
3018
3061
|
}
|
|
3019
3062
|
),
|
|
3020
3063
|
d === "CUSTOM_SCRIPT" && /* @__PURE__ */ e(
|
|
@@ -3025,13 +3068,13 @@ function lt() {
|
|
|
3025
3068
|
rules: [{ required: !0, message: "请选择脚本" }],
|
|
3026
3069
|
extra: "在 智能中心 > 脚本中心 维护脚本. 脚本返回 { items: [...], nextCursor: '...' }",
|
|
3027
3070
|
children: /* @__PURE__ */ e(
|
|
3028
|
-
|
|
3071
|
+
Z,
|
|
3029
3072
|
{
|
|
3030
3073
|
showSearch: !0,
|
|
3031
3074
|
placeholder: "选择已启用的脚本",
|
|
3032
|
-
options: _.map((
|
|
3033
|
-
value:
|
|
3034
|
-
label: `${
|
|
3075
|
+
options: _.map((i) => ({
|
|
3076
|
+
value: i.scriptCode,
|
|
3077
|
+
label: `${i.scriptCode} (${i.dslType})${i.scriptName ? " - " + i.scriptName : ""}`
|
|
3035
3078
|
}))
|
|
3036
3079
|
}
|
|
3037
3080
|
)
|
|
@@ -3047,12 +3090,12 @@ function lt() {
|
|
|
3047
3090
|
rules: [{ required: !0, message: "请输入 Cron" }],
|
|
3048
3091
|
extra: "Quartz 兼容, 例如 0 */5 * * * ? = 每 5 分钟",
|
|
3049
3092
|
children: /* @__PURE__ */ e(B, { addonAfter: /* @__PURE__ */ e(
|
|
3050
|
-
|
|
3093
|
+
Z,
|
|
3051
3094
|
{
|
|
3052
3095
|
style: { width: 140 },
|
|
3053
3096
|
placeholder: "常用",
|
|
3054
|
-
options:
|
|
3055
|
-
onChange: (
|
|
3097
|
+
options: Bn,
|
|
3098
|
+
onChange: (i) => S.setFieldValue("cronExpr", i),
|
|
3056
3099
|
value: null
|
|
3057
3100
|
}
|
|
3058
3101
|
) })
|
|
@@ -3076,7 +3119,7 @@ function lt() {
|
|
|
3076
3119
|
] })
|
|
3077
3120
|
] }),
|
|
3078
3121
|
/* @__PURE__ */ e(
|
|
3079
|
-
|
|
3122
|
+
W,
|
|
3080
3123
|
{
|
|
3081
3124
|
type: "success",
|
|
3082
3125
|
showIcon: !0,
|
|
@@ -3088,7 +3131,7 @@ function lt() {
|
|
|
3088
3131
|
) }) })
|
|
3089
3132
|
] });
|
|
3090
3133
|
}
|
|
3091
|
-
const
|
|
3134
|
+
const jn = {
|
|
3092
3135
|
PENDING: "default",
|
|
3093
3136
|
RUNNING: "processing",
|
|
3094
3137
|
SUCCESS: "green",
|
|
@@ -3096,24 +3139,24 @@ const Ln = {
|
|
|
3096
3139
|
FAILED: "red",
|
|
3097
3140
|
FATAL: "red"
|
|
3098
3141
|
};
|
|
3099
|
-
function
|
|
3100
|
-
const [t,
|
|
3101
|
-
|
|
3142
|
+
function Un() {
|
|
3143
|
+
const [t, l] = m([]), [r, S] = m(null), [s, y] = m([]), [c, f] = m([]), [x, C] = m(null), [_, h] = m(!1);
|
|
3144
|
+
K(() => {
|
|
3102
3145
|
a();
|
|
3103
|
-
}, []),
|
|
3146
|
+
}, []), K(() => {
|
|
3104
3147
|
r && d(r);
|
|
3105
3148
|
}, [r]);
|
|
3106
3149
|
const a = async () => {
|
|
3107
3150
|
try {
|
|
3108
|
-
const u = await $.get("/subscribe/subscription/list"),
|
|
3109
|
-
|
|
3151
|
+
const u = await $.get("/subscribe/subscription/list"), i = (u == null ? void 0 : u.data) ?? u ?? [];
|
|
3152
|
+
l(Array.isArray(i) ? i : []), Array.isArray(i) && i.length > 0 && S(i[0].id);
|
|
3110
3153
|
} catch {
|
|
3111
3154
|
b.error("加载订阅列表失败");
|
|
3112
3155
|
}
|
|
3113
3156
|
}, d = async (u) => {
|
|
3114
3157
|
h(!0);
|
|
3115
3158
|
try {
|
|
3116
|
-
const
|
|
3159
|
+
const i = await $.get(`/subscribe/run/list?subscriptionId=${u}&limit=50`), I = (i == null ? void 0 : i.data) ?? i ?? [];
|
|
3117
3160
|
y(Array.isArray(I) ? I : []);
|
|
3118
3161
|
} catch {
|
|
3119
3162
|
b.error("加载运行历史失败");
|
|
@@ -3123,12 +3166,12 @@ function Mn() {
|
|
|
3123
3166
|
}, g = async (u) => {
|
|
3124
3167
|
C(u);
|
|
3125
3168
|
try {
|
|
3126
|
-
const
|
|
3169
|
+
const i = await $.get(`/subscribe/run/${u}/items?limit=200`), I = (i == null ? void 0 : i.data) ?? i ?? [];
|
|
3127
3170
|
f(Array.isArray(I) ? I : []);
|
|
3128
3171
|
} catch {
|
|
3129
3172
|
b.error("加载抽取项失败");
|
|
3130
3173
|
}
|
|
3131
|
-
}, v =
|
|
3174
|
+
}, v = s.reduce((u, i) => u + (i.successCount || 0), 0), D = s.reduce((u, i) => u + (i.deadLetterCount || 0), 0), T = s.reduce((u, i) => u + (i.duplicateCount || 0), 0);
|
|
3132
3175
|
return /* @__PURE__ */ n("div", { children: [
|
|
3133
3176
|
/* @__PURE__ */ e(
|
|
3134
3177
|
ye,
|
|
@@ -3138,10 +3181,10 @@ function Mn() {
|
|
|
3138
3181
|
}
|
|
3139
3182
|
),
|
|
3140
3183
|
/* @__PURE__ */ e(
|
|
3141
|
-
|
|
3184
|
+
Ht,
|
|
3142
3185
|
{
|
|
3143
3186
|
left: /* @__PURE__ */ e(
|
|
3144
|
-
|
|
3187
|
+
Z,
|
|
3145
3188
|
{
|
|
3146
3189
|
style: { width: 280 },
|
|
3147
3190
|
placeholder: "选择订阅",
|
|
@@ -3159,9 +3202,9 @@ function Mn() {
|
|
|
3159
3202
|
}
|
|
3160
3203
|
),
|
|
3161
3204
|
/* @__PURE__ */ n(Y, { gutter: 16, style: { marginBottom: 16 }, children: [
|
|
3162
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
3205
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(F, { title: "run 总数", value: s.length }) }) }),
|
|
3163
3206
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
3164
|
-
|
|
3207
|
+
F,
|
|
3165
3208
|
{
|
|
3166
3209
|
title: "成功条数",
|
|
3167
3210
|
value: v,
|
|
@@ -3169,21 +3212,21 @@ function Mn() {
|
|
|
3169
3212
|
}
|
|
3170
3213
|
) }) }),
|
|
3171
3214
|
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
3172
|
-
|
|
3215
|
+
F,
|
|
3173
3216
|
{
|
|
3174
3217
|
title: "死信条数",
|
|
3175
3218
|
value: D,
|
|
3176
3219
|
styles: { content: { color: "#cf1322" } }
|
|
3177
3220
|
}
|
|
3178
3221
|
) }) }),
|
|
3179
|
-
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
|
|
3222
|
+
/* @__PURE__ */ e(O, { span: 6, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(F, { title: "重复跳过", value: T }) }) })
|
|
3180
3223
|
] }),
|
|
3181
3224
|
/* @__PURE__ */ n(Y, { gutter: 16, children: [
|
|
3182
3225
|
/* @__PURE__ */ e(O, { span: 12, children: /* @__PURE__ */ e(
|
|
3183
3226
|
se,
|
|
3184
3227
|
{
|
|
3185
|
-
cardTitle: `运行列表 (${
|
|
3186
|
-
rows:
|
|
3228
|
+
cardTitle: `运行列表 (${s.length})`,
|
|
3229
|
+
rows: s,
|
|
3187
3230
|
rowKey: "id",
|
|
3188
3231
|
loading: _,
|
|
3189
3232
|
searchKeys: ["id", "status"],
|
|
@@ -3208,12 +3251,12 @@ function Mn() {
|
|
|
3208
3251
|
title: "状态",
|
|
3209
3252
|
dataIndex: "status",
|
|
3210
3253
|
width: 80,
|
|
3211
|
-
render: (u) => /* @__PURE__ */ e(w, { color:
|
|
3254
|
+
render: (u) => /* @__PURE__ */ e(w, { color: jn[u], children: u })
|
|
3212
3255
|
},
|
|
3213
3256
|
{
|
|
3214
3257
|
title: "拉取/成功/死信",
|
|
3215
3258
|
width: 150,
|
|
3216
|
-
render: (u,
|
|
3259
|
+
render: (u, i) => `${i.fetchedCount} / ${i.successCount} / ${i.deadLetterCount}`
|
|
3217
3260
|
}
|
|
3218
3261
|
]
|
|
3219
3262
|
}
|
|
@@ -3248,8 +3291,8 @@ function Mn() {
|
|
|
3248
3291
|
width: 60,
|
|
3249
3292
|
render: (u) => {
|
|
3250
3293
|
try {
|
|
3251
|
-
const
|
|
3252
|
-
return
|
|
3294
|
+
const i = JSON.parse(u);
|
|
3295
|
+
return i.link ? /* @__PURE__ */ e("a", { href: i.link, target: "_blank", children: "↗" }) : "-";
|
|
3253
3296
|
} catch {
|
|
3254
3297
|
return "-";
|
|
3255
3298
|
}
|
|
@@ -3267,39 +3310,39 @@ function Mn() {
|
|
|
3267
3310
|
] })
|
|
3268
3311
|
] });
|
|
3269
3312
|
}
|
|
3270
|
-
function
|
|
3271
|
-
return /* @__PURE__ */ n(
|
|
3272
|
-
/* @__PURE__ */ e(re, { index: !0, element: /* @__PURE__ */ e(
|
|
3273
|
-
/* @__PURE__ */ e(re, { path: "list", element: /* @__PURE__ */ e(
|
|
3274
|
-
/* @__PURE__ */ e(re, { path: "new", element: /* @__PURE__ */ e(
|
|
3275
|
-
/* @__PURE__ */ e(re, { path: "edit/:id", element: /* @__PURE__ */ e(
|
|
3276
|
-
/* @__PURE__ */ e(re, { path: "runs", element: /* @__PURE__ */ e(
|
|
3313
|
+
function qn() {
|
|
3314
|
+
return /* @__PURE__ */ n(dt, { children: [
|
|
3315
|
+
/* @__PURE__ */ e(re, { index: !0, element: /* @__PURE__ */ e(ut, { to: "list", replace: !0 }) }),
|
|
3316
|
+
/* @__PURE__ */ e(re, { path: "list", element: /* @__PURE__ */ e(Mn, {}) }),
|
|
3317
|
+
/* @__PURE__ */ e(re, { path: "new", element: /* @__PURE__ */ e(st, {}) }),
|
|
3318
|
+
/* @__PURE__ */ e(re, { path: "edit/:id", element: /* @__PURE__ */ e(st, {}) }),
|
|
3319
|
+
/* @__PURE__ */ e(re, { path: "runs", element: /* @__PURE__ */ e(Un, {}) })
|
|
3277
3320
|
] });
|
|
3278
3321
|
}
|
|
3279
|
-
const
|
|
3322
|
+
const hr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3280
3323
|
__proto__: null,
|
|
3281
|
-
default:
|
|
3282
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3324
|
+
default: qn
|
|
3325
|
+
}, Symbol.toStringTag, { value: "Module" })), Fn = {
|
|
3283
3326
|
OPEN: { color: "blue", text: "待开始" },
|
|
3284
3327
|
IN_PROGRESS: { color: "green", text: "进行中" },
|
|
3285
3328
|
COMPLETED: { color: "default", text: "已完成" },
|
|
3286
3329
|
ARCHIVED: { color: "default", text: "已归档" }
|
|
3287
3330
|
};
|
|
3288
|
-
function
|
|
3289
|
-
const t = xe(), [
|
|
3331
|
+
function Kn() {
|
|
3332
|
+
const t = xe(), [l, r] = m("mine"), [S, s] = m([]), [y, c] = m(!1), [f, x] = m(null), C = async () => {
|
|
3290
3333
|
c(!0), x(null);
|
|
3291
3334
|
try {
|
|
3292
|
-
const a =
|
|
3293
|
-
|
|
3335
|
+
const a = l === "mine" ? "/project/list/mine?limit=100" : `/project/list/by-status?status=${l}&limit=100`, d = await $.get(a), g = (d == null ? void 0 : d.data) ?? d ?? [];
|
|
3336
|
+
s(Array.isArray(g) ? g : []);
|
|
3294
3337
|
} catch (a) {
|
|
3295
3338
|
x((a == null ? void 0 : a.message) || (a == null ? void 0 : a.msg) || "加载失败");
|
|
3296
3339
|
} finally {
|
|
3297
3340
|
c(!1);
|
|
3298
3341
|
}
|
|
3299
3342
|
};
|
|
3300
|
-
|
|
3343
|
+
K(() => {
|
|
3301
3344
|
C();
|
|
3302
|
-
}, [
|
|
3345
|
+
}, [l]);
|
|
3303
3346
|
const _ = async (a) => {
|
|
3304
3347
|
try {
|
|
3305
3348
|
const d = await $.post(`/project/${a}/status?status=COMPLETED`);
|
|
@@ -3327,7 +3370,7 @@ function Nn() {
|
|
|
3327
3370
|
/* @__PURE__ */ e(
|
|
3328
3371
|
ke,
|
|
3329
3372
|
{
|
|
3330
|
-
activeKey:
|
|
3373
|
+
activeKey: l,
|
|
3331
3374
|
onChange: r,
|
|
3332
3375
|
tabBarExtraContent: /* @__PURE__ */ n(E, { children: [
|
|
3333
3376
|
/* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(ee, {}), onClick: C, loading: y, children: "刷新" }),
|
|
@@ -3335,7 +3378,7 @@ function Nn() {
|
|
|
3335
3378
|
A,
|
|
3336
3379
|
{
|
|
3337
3380
|
type: "primary",
|
|
3338
|
-
icon: /* @__PURE__ */ e(
|
|
3381
|
+
icon: /* @__PURE__ */ e(gt, {}),
|
|
3339
3382
|
onClick: () => t("/project/new"),
|
|
3340
3383
|
children: "新建项目"
|
|
3341
3384
|
}
|
|
@@ -3375,7 +3418,7 @@ function Nn() {
|
|
|
3375
3418
|
dataIndex: "status",
|
|
3376
3419
|
width: 100,
|
|
3377
3420
|
render: (a) => {
|
|
3378
|
-
const d =
|
|
3421
|
+
const d = Fn[a] || { color: "default", text: a };
|
|
3379
3422
|
return /* @__PURE__ */ e(w, { color: d.color, children: d.text });
|
|
3380
3423
|
}
|
|
3381
3424
|
},
|
|
@@ -3405,7 +3448,7 @@ function Nn() {
|
|
|
3405
3448
|
title: "标记为已完成?",
|
|
3406
3449
|
onConfirm: () => _(d.id),
|
|
3407
3450
|
okButtonProps: { danger: !0 },
|
|
3408
|
-
children: /* @__PURE__ */ e(A, { type: "link", size: "small", icon: /* @__PURE__ */ e(
|
|
3451
|
+
children: /* @__PURE__ */ e(A, { type: "link", size: "small", icon: /* @__PURE__ */ e(Ke, {}), children: "完成" })
|
|
3409
3452
|
}
|
|
3410
3453
|
)
|
|
3411
3454
|
] })
|
|
@@ -3426,36 +3469,36 @@ function Nn() {
|
|
|
3426
3469
|
] })
|
|
3427
3470
|
] });
|
|
3428
3471
|
}
|
|
3429
|
-
const
|
|
3472
|
+
const Hn = [
|
|
3430
3473
|
{ value: "general", label: "通用助手" },
|
|
3431
3474
|
{ value: "analyst", label: "分析师" },
|
|
3432
3475
|
{ value: "writer", label: "写手" },
|
|
3433
3476
|
{ value: "pm", label: "产品经理" },
|
|
3434
3477
|
{ value: "ops", label: "运营" }
|
|
3435
3478
|
];
|
|
3436
|
-
function
|
|
3437
|
-
const t = xe(), [
|
|
3438
|
-
|
|
3439
|
-
const I =
|
|
3479
|
+
function Gn() {
|
|
3480
|
+
const t = xe(), [l] = St(), [r] = P.useForm(), [S, s] = m(!1), [y, c] = m("from-subscribe"), [f, x] = m([]), [C, _] = m([]), [h, a] = m(!1), [d, g] = m([]), [v, D] = m(null);
|
|
3481
|
+
K(() => {
|
|
3482
|
+
const I = l.get("subscriptionId"), M = l.get("itemIds");
|
|
3440
3483
|
I && (D(Number(I)), r.setFieldValue("sourceSubscriptionId", Number(I)), u(I)), M && g(M.split(",").map(Number).filter(Boolean));
|
|
3441
|
-
}, [
|
|
3484
|
+
}, [l]), K(() => {
|
|
3442
3485
|
T();
|
|
3443
3486
|
}, []);
|
|
3444
3487
|
const T = async () => {
|
|
3445
3488
|
try {
|
|
3446
3489
|
const I = await $.get("/subscribe/subscription/list"), M = (I == null ? void 0 : I.data) ?? I ?? [];
|
|
3447
|
-
x(Array.isArray(M) ? M.filter((
|
|
3490
|
+
x(Array.isArray(M) ? M.filter((X) => X.status === "VERIFIED") : []);
|
|
3448
3491
|
} catch {
|
|
3449
3492
|
}
|
|
3450
3493
|
}, u = async (I) => {
|
|
3451
3494
|
a(!0);
|
|
3452
3495
|
try {
|
|
3453
|
-
const M = await $.get(`/subscribe/run/list?subscriptionId=${I}&limit=1`),
|
|
3454
|
-
if (
|
|
3496
|
+
const M = await $.get(`/subscribe/run/list?subscriptionId=${I}&limit=1`), X = (M == null ? void 0 : M.data) ?? M ?? [];
|
|
3497
|
+
if (X.length === 0) {
|
|
3455
3498
|
_([]);
|
|
3456
3499
|
return;
|
|
3457
3500
|
}
|
|
3458
|
-
const
|
|
3501
|
+
const H = X[0], p = await $.get(`/subscribe/run/${H.id}/items?limit=100`), o = (p == null ? void 0 : p.data) ?? p ?? [];
|
|
3459
3502
|
_(Array.isArray(o) ? o : []);
|
|
3460
3503
|
} catch {
|
|
3461
3504
|
b.error("加载抽取项失败");
|
|
@@ -3467,7 +3510,7 @@ function jn() {
|
|
|
3467
3510
|
L,
|
|
3468
3511
|
{
|
|
3469
3512
|
title: /* @__PURE__ */ n(E, { children: [
|
|
3470
|
-
/* @__PURE__ */ e(A, { type: "text", icon: /* @__PURE__ */ e(
|
|
3513
|
+
/* @__PURE__ */ e(A, { type: "text", icon: /* @__PURE__ */ e(bt, {}), onClick: () => t("/project/list") }),
|
|
3471
3514
|
/* @__PURE__ */ e(qe, {}),
|
|
3472
3515
|
"新建项目 (立项)"
|
|
3473
3516
|
] }),
|
|
@@ -3477,7 +3520,7 @@ function jn() {
|
|
|
3477
3520
|
A,
|
|
3478
3521
|
{
|
|
3479
3522
|
type: "primary",
|
|
3480
|
-
icon: /* @__PURE__ */ e(
|
|
3523
|
+
icon: /* @__PURE__ */ e(ft, {}),
|
|
3481
3524
|
loading: S,
|
|
3482
3525
|
onClick: async () => {
|
|
3483
3526
|
try {
|
|
@@ -3486,20 +3529,20 @@ function jn() {
|
|
|
3486
3529
|
b.warning("请至少选 1 个 item");
|
|
3487
3530
|
return;
|
|
3488
3531
|
}
|
|
3489
|
-
|
|
3532
|
+
s(!0);
|
|
3490
3533
|
const M = {
|
|
3491
3534
|
...I,
|
|
3492
3535
|
sourceItemIds: y === "from-subscribe" ? d.map(String) : null
|
|
3493
|
-
},
|
|
3494
|
-
if (
|
|
3495
|
-
const p =
|
|
3536
|
+
}, X = y === "from-subscribe" ? "/project/create-from-items" : "/project/create-manual", H = await $.post(X, M);
|
|
3537
|
+
if (H && H.success !== !1) {
|
|
3538
|
+
const p = H.data ?? H;
|
|
3496
3539
|
b.success("立项成功"), t(`/project/${p.id}`);
|
|
3497
3540
|
} else
|
|
3498
|
-
b.error((
|
|
3541
|
+
b.error((H == null ? void 0 : H.message) || "立项失败");
|
|
3499
3542
|
} catch (I) {
|
|
3500
3543
|
I != null && I.errorFields || b.error("立项失败: " + ((I == null ? void 0 : I.message) || ""));
|
|
3501
3544
|
} finally {
|
|
3502
|
-
|
|
3545
|
+
s(!1);
|
|
3503
3546
|
}
|
|
3504
3547
|
},
|
|
3505
3548
|
children: "立项"
|
|
@@ -3521,7 +3564,7 @@ function jn() {
|
|
|
3521
3564
|
name: "sourceSubscriptionId",
|
|
3522
3565
|
rules: [{ required: !0, message: "请选订阅" }],
|
|
3523
3566
|
children: /* @__PURE__ */ e(
|
|
3524
|
-
|
|
3567
|
+
Z,
|
|
3525
3568
|
{
|
|
3526
3569
|
placeholder: "选择订阅 (拉取最近一次 run 的 items)",
|
|
3527
3570
|
options: f.map((I) => ({ value: I.id, label: `#${I.id} ${I.name}` })),
|
|
@@ -3597,7 +3640,7 @@ function jn() {
|
|
|
3597
3640
|
] })
|
|
3598
3641
|
] }),
|
|
3599
3642
|
/* @__PURE__ */ n(L, { type: "inner", title: "Agent 配置", style: { marginBottom: 16 }, children: [
|
|
3600
|
-
/* @__PURE__ */ e(P.Item, { label: "Agent 角色", name: "agentRole", extra: "决定 system prompt 的语气 / 视角", children: /* @__PURE__ */ e(
|
|
3643
|
+
/* @__PURE__ */ e(P.Item, { label: "Agent 角色", name: "agentRole", extra: "决定 system prompt 的语气 / 视角", children: /* @__PURE__ */ e(Z, { options: Hn }) }),
|
|
3601
3644
|
/* @__PURE__ */ e(
|
|
3602
3645
|
P.Item,
|
|
3603
3646
|
{
|
|
@@ -3609,7 +3652,7 @@ function jn() {
|
|
|
3609
3652
|
)
|
|
3610
3653
|
] }),
|
|
3611
3654
|
/* @__PURE__ */ e(
|
|
3612
|
-
|
|
3655
|
+
W,
|
|
3613
3656
|
{
|
|
3614
3657
|
type: "info",
|
|
3615
3658
|
showIcon: !0,
|
|
@@ -3620,23 +3663,23 @@ function jn() {
|
|
|
3620
3663
|
}
|
|
3621
3664
|
) });
|
|
3622
3665
|
}
|
|
3623
|
-
const
|
|
3624
|
-
USER: { color: "blue", icon: /* @__PURE__ */ e(
|
|
3666
|
+
const it = {
|
|
3667
|
+
USER: { color: "blue", icon: /* @__PURE__ */ e(pt, {}), label: "CEO" },
|
|
3625
3668
|
ASSISTANT: { color: "purple", icon: /* @__PURE__ */ e($e, {}), label: "Agent" },
|
|
3626
3669
|
SYSTEM: { color: "default", icon: null, label: "系统" }
|
|
3627
|
-
},
|
|
3670
|
+
}, Wn = {
|
|
3628
3671
|
OPEN: { color: "blue", text: "待开始" },
|
|
3629
3672
|
IN_PROGRESS: { color: "green", text: "进行中" },
|
|
3630
3673
|
COMPLETED: { color: "default", text: "已完成" },
|
|
3631
3674
|
ARCHIVED: { color: "default", text: "已归档" }
|
|
3632
3675
|
};
|
|
3633
|
-
function
|
|
3634
|
-
const { id: t } =
|
|
3635
|
-
|
|
3676
|
+
function Xn() {
|
|
3677
|
+
const { id: t } = ct(), l = xe(), [r, S] = m(null), [s, y] = m([]), [c, f] = m(""), [x, C] = m(!1), _ = ot(null);
|
|
3678
|
+
K(() => {
|
|
3636
3679
|
t && h();
|
|
3637
|
-
}, [t]),
|
|
3680
|
+
}, [t]), K(() => {
|
|
3638
3681
|
_.current && (_.current.scrollTop = _.current.scrollHeight);
|
|
3639
|
-
}, [
|
|
3682
|
+
}, [s]);
|
|
3640
3683
|
const h = async () => {
|
|
3641
3684
|
try {
|
|
3642
3685
|
const [v, D] = await Promise.all([
|
|
@@ -3656,8 +3699,8 @@ function qn() {
|
|
|
3656
3699
|
try {
|
|
3657
3700
|
const T = await $.post(`/project/${t}/chat`, { message: v });
|
|
3658
3701
|
if (T && T.success !== !1) {
|
|
3659
|
-
const
|
|
3660
|
-
y((I) => [...I.filter((
|
|
3702
|
+
const i = (T.data ?? T).message;
|
|
3703
|
+
y((I) => [...I.filter((X) => X.seq !== -1), ...i ? [i] : []]), setTimeout(h, 100);
|
|
3661
3704
|
} else
|
|
3662
3705
|
b.error((T == null ? void 0 : T.message) || "发送失败");
|
|
3663
3706
|
} catch (T) {
|
|
@@ -3674,13 +3717,13 @@ function qn() {
|
|
|
3674
3717
|
}
|
|
3675
3718
|
};
|
|
3676
3719
|
if (!r) return /* @__PURE__ */ e("div", { style: { padding: 24 }, children: /* @__PURE__ */ e(_e, {}) });
|
|
3677
|
-
const g =
|
|
3720
|
+
const g = Wn[r.status] || { color: "default", text: r.status };
|
|
3678
3721
|
return /* @__PURE__ */ n("div", { style: { padding: 24, height: "calc(100vh - 64px)", display: "flex", flexDirection: "column", gap: 16 }, children: [
|
|
3679
3722
|
/* @__PURE__ */ n(
|
|
3680
3723
|
L,
|
|
3681
3724
|
{
|
|
3682
3725
|
title: /* @__PURE__ */ n(E, { children: [
|
|
3683
|
-
/* @__PURE__ */ e(A, { type: "text", icon: /* @__PURE__ */ e(
|
|
3726
|
+
/* @__PURE__ */ e(A, { type: "text", icon: /* @__PURE__ */ e(bt, {}), onClick: () => l("/project/list") }),
|
|
3684
3727
|
/* @__PURE__ */ e(qe, {}),
|
|
3685
3728
|
/* @__PURE__ */ e("span", { style: { fontWeight: 500 }, children: r.name }),
|
|
3686
3729
|
/* @__PURE__ */ e(w, { color: g.color, children: g.text })
|
|
@@ -3693,15 +3736,15 @@ function qn() {
|
|
|
3693
3736
|
] }),
|
|
3694
3737
|
/* @__PURE__ */ e(w, { children: r.agentRole }),
|
|
3695
3738
|
r.modelCode && /* @__PURE__ */ e(w, { color: "purple", children: r.modelCode }),
|
|
3696
|
-
r.status !== "COMPLETED" && r.status !== "ARCHIVED" && /* @__PURE__ */ e(Ue, { title: "标记完成?", onConfirm: d, children: /* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(
|
|
3739
|
+
r.status !== "COMPLETED" && r.status !== "ARCHIVED" && /* @__PURE__ */ e(Ue, { title: "标记完成?", onConfirm: d, children: /* @__PURE__ */ e(A, { icon: /* @__PURE__ */ e(Ke, {}), children: "标记完成" }) })
|
|
3697
3740
|
] }),
|
|
3698
3741
|
children: [
|
|
3699
3742
|
r.description && /* @__PURE__ */ e("div", { style: { color: "#666", marginBottom: 8 }, children: r.description }),
|
|
3700
3743
|
/* @__PURE__ */ n(E, { size: "large", children: [
|
|
3701
|
-
/* @__PURE__ */ e(
|
|
3702
|
-
r.sourceSubscriptionId && /* @__PURE__ */ e(
|
|
3744
|
+
/* @__PURE__ */ e(F, { title: "消息数", value: r.messageCount || 0 }),
|
|
3745
|
+
r.sourceSubscriptionId && /* @__PURE__ */ e(F, { title: "来源订阅", value: `#${r.sourceSubscriptionId}` }),
|
|
3703
3746
|
/* @__PURE__ */ e(
|
|
3704
|
-
|
|
3747
|
+
F,
|
|
3705
3748
|
{
|
|
3706
3749
|
title: "立项",
|
|
3707
3750
|
value: r.createdAt ? new Date(r.createdAt).toLocaleString() : "-"
|
|
@@ -3717,9 +3760,9 @@ function qn() {
|
|
|
3717
3760
|
style: { flex: 1, display: "flex", flexDirection: "column" },
|
|
3718
3761
|
styles: { body: { flex: 1, display: "flex", flexDirection: "column", padding: 0 } },
|
|
3719
3762
|
children: [
|
|
3720
|
-
/* @__PURE__ */ e("div", { ref: _, style: { flex: 1, overflow: "auto", padding: 16, background: "#fafafa" }, children:
|
|
3721
|
-
|
|
3722
|
-
const D =
|
|
3763
|
+
/* @__PURE__ */ e("div", { ref: _, style: { flex: 1, overflow: "auto", padding: 16, background: "#fafafa" }, children: s.length === 0 ? /* @__PURE__ */ e(Ct, { description: "还没有消息, 跟 Agent 说点什么?" }) : /* @__PURE__ */ n(E, { orientation: "vertical", style: { width: "100%" }, size: "middle", children: [
|
|
3764
|
+
s.map((v) => {
|
|
3765
|
+
const D = it[v.role] || it.SYSTEM, T = v.role === "USER";
|
|
3723
3766
|
return /* @__PURE__ */ e("div", { style: {
|
|
3724
3767
|
display: "flex",
|
|
3725
3768
|
justifyContent: T ? "flex-end" : "flex-start"
|
|
@@ -3763,7 +3806,7 @@ function qn() {
|
|
|
3763
3806
|
] }) })
|
|
3764
3807
|
] }) }),
|
|
3765
3808
|
r.status === "COMPLETED" || r.status === "ARCHIVED" ? /* @__PURE__ */ e(
|
|
3766
|
-
|
|
3809
|
+
W,
|
|
3767
3810
|
{
|
|
3768
3811
|
style: { margin: 12, marginBottom: 0 },
|
|
3769
3812
|
type: "info",
|
|
@@ -3788,7 +3831,7 @@ function qn() {
|
|
|
3788
3831
|
A,
|
|
3789
3832
|
{
|
|
3790
3833
|
type: "primary",
|
|
3791
|
-
icon: /* @__PURE__ */ e(
|
|
3834
|
+
icon: /* @__PURE__ */ e(Ut, {}),
|
|
3792
3835
|
loading: x,
|
|
3793
3836
|
onClick: a,
|
|
3794
3837
|
disabled: !c.trim(),
|
|
@@ -3801,43 +3844,45 @@ function qn() {
|
|
|
3801
3844
|
)
|
|
3802
3845
|
] });
|
|
3803
3846
|
}
|
|
3804
|
-
function
|
|
3805
|
-
return /* @__PURE__ */ n(
|
|
3806
|
-
/* @__PURE__ */ e(re, { index: !0, element: /* @__PURE__ */ e(
|
|
3807
|
-
/* @__PURE__ */ e(re, { path: "list", element: /* @__PURE__ */ e(
|
|
3808
|
-
/* @__PURE__ */ e(re, { path: "new", element: /* @__PURE__ */ e(
|
|
3809
|
-
/* @__PURE__ */ e(re, { path: ":id", element: /* @__PURE__ */ e(
|
|
3847
|
+
function Zn() {
|
|
3848
|
+
return /* @__PURE__ */ n(dt, { children: [
|
|
3849
|
+
/* @__PURE__ */ e(re, { index: !0, element: /* @__PURE__ */ e(ut, { to: "list", replace: !0 }) }),
|
|
3850
|
+
/* @__PURE__ */ e(re, { path: "list", element: /* @__PURE__ */ e(Kn, {}) }),
|
|
3851
|
+
/* @__PURE__ */ e(re, { path: "new", element: /* @__PURE__ */ e(Gn, {}) }),
|
|
3852
|
+
/* @__PURE__ */ e(re, { path: ":id", element: /* @__PURE__ */ e(Xn, {}) })
|
|
3810
3853
|
] });
|
|
3811
3854
|
}
|
|
3812
|
-
const
|
|
3855
|
+
const mr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3813
3856
|
__proto__: null,
|
|
3814
|
-
default:
|
|
3815
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
3816
|
-
function
|
|
3817
|
-
return /* @__PURE__ */ e(
|
|
3857
|
+
default: Zn
|
|
3858
|
+
}, Symbol.toStringTag, { value: "Module" })), Jn = "# 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-team 团队工作台', 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";
|
|
3859
|
+
function yr() {
|
|
3860
|
+
return /* @__PURE__ */ e(Wt, { markdown: Jn, title: "组件文档 — z-team" });
|
|
3818
3861
|
}
|
|
3819
3862
|
export {
|
|
3820
|
-
|
|
3863
|
+
yr as C,
|
|
3821
3864
|
Be as E,
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3865
|
+
Xt as M,
|
|
3866
|
+
pr as O,
|
|
3867
|
+
Zn as P,
|
|
3868
|
+
vn as R,
|
|
3869
|
+
qn as S,
|
|
3870
|
+
Cn as T,
|
|
3871
|
+
lr as Z,
|
|
3872
|
+
sr as a,
|
|
3873
|
+
ur as b,
|
|
3831
3874
|
je as c,
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3875
|
+
Pn as d,
|
|
3876
|
+
dr as e,
|
|
3877
|
+
ir as f,
|
|
3878
|
+
_n as g,
|
|
3879
|
+
Sn as h,
|
|
3880
|
+
pn as i,
|
|
3881
|
+
Ge as j,
|
|
3882
|
+
Vt as k,
|
|
3840
3883
|
or as l,
|
|
3884
|
+
hr as m,
|
|
3885
|
+
mr as n,
|
|
3841
3886
|
$ as r,
|
|
3842
|
-
|
|
3887
|
+
gn as s
|
|
3843
3888
|
};
|