@blueking/bkflow-canvas-editor 1.1.0-beta.4 → 1.1.0-beta.41
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/README.md +247 -42
- package/dist/advanced.cjs.js +1 -1
- package/dist/advanced.d.ts +473 -42
- package/dist/advanced.esm.js +8 -3
- package/dist/context-C3QIuIf6.cjs +5 -0
- package/dist/context-De9a4Qek.js +1507 -0
- package/dist/index-9BCO-loN.js +533 -0
- package/dist/index-A1xVRjtJ.cjs +1 -0
- package/dist/index-B1ybORjU.js +55768 -0
- package/dist/index-BwF4LXst.cjs +1 -0
- package/dist/index-CjCy-0c0.js +236 -0
- package/dist/index-RacKW0MR.js +168 -0
- package/dist/index-bzXGuf5c.cjs +1 -0
- package/dist/index-iB9uV7YQ.cjs +85 -0
- package/dist/index.cjs.js +1 -70
- package/dist/index.d.ts +969 -112
- package/dist/index.esm.js +48 -45880
- package/dist/style.css +1 -1
- package/dist/style.d.ts +2 -0
- package/package.json +13 -7
- package/dist/composable-CmXOtkXh.js +0 -441
- package/dist/composable-CtSJfiSD.cjs +0 -1
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
import { defineComponent as j, ref as T, computed as i, watch as Y, nextTick as X, resolveComponent as B, openBlock as g, createElementBlock as h, createVNode as _, unref as u, Fragment as Z, renderList as ee, withKeys as te, withModifiers as se, normalizeClass as L, createElementVNode as o, createCommentVNode as K, toDisplayString as m, createSlots as J, withCtx as w, createTextVNode as I, onBeforeUnmount as oe, resolveDirective as le, normalizeStyle as ae, withDirectives as ne, createBlock as Q } from "vue";
|
|
2
|
+
import "./context-De9a4Qek.js";
|
|
3
|
+
import { L as ue, S as ie, E as re, _ as q, e as de, j as ce, k as pe, o as me, t as ve, s as be, n as _e, l as W, C as fe, q as ge } from "./index-B1ybORjU.js";
|
|
4
|
+
import { t } from "@blueking/flow-canvas";
|
|
5
|
+
const ke = { class: "debug-result-node-list" }, ye = ["data-node-id", "aria-selected", "onClick", "onKeydown"], we = ["title"], he = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "debug-result-node-list__mock",
|
|
8
|
+
"data-test": "node-mock-flag"
|
|
9
|
+
}, xe = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "debug-result-node-list__empty"
|
|
12
|
+
}, Ce = /* @__PURE__ */ j({
|
|
13
|
+
__name: "node-list",
|
|
14
|
+
props: {
|
|
15
|
+
nodes: {},
|
|
16
|
+
modelValue: { default: "" }
|
|
17
|
+
},
|
|
18
|
+
emits: ["update:modelValue"],
|
|
19
|
+
setup(b, { emit: x }) {
|
|
20
|
+
const e = b, a = x, d = T(""), f = T("all"), R = T(null);
|
|
21
|
+
function C() {
|
|
22
|
+
return {
|
|
23
|
+
not_run: t("未执行"),
|
|
24
|
+
finished: t("成功"),
|
|
25
|
+
failed: t("失败"),
|
|
26
|
+
running: t("正在调试"),
|
|
27
|
+
suspended: t("挂起"),
|
|
28
|
+
skipped: t("跳过"),
|
|
29
|
+
revoked: t("终止")
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const M = i(() => {
|
|
33
|
+
const l = C();
|
|
34
|
+
return [
|
|
35
|
+
{ value: "all", label: t("全部") },
|
|
36
|
+
{
|
|
37
|
+
value: "finished",
|
|
38
|
+
icon: "bkflow-canvas-dark-circle-checkbox",
|
|
39
|
+
iconColor: "#5fb8ac",
|
|
40
|
+
tooltip: l.finished
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "failed",
|
|
44
|
+
icon: "bkflow-canvas-dark-circle-close",
|
|
45
|
+
iconColor: "#fa4e41",
|
|
46
|
+
tooltip: l.failed
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "revoked",
|
|
50
|
+
icon: "bkflow-canvas-stop-fill",
|
|
51
|
+
iconColor: "#fa4e41",
|
|
52
|
+
tooltip: l.revoked
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: "running",
|
|
56
|
+
iconComponent: ue,
|
|
57
|
+
iconColor: "#3a84ff",
|
|
58
|
+
tooltip: l.running
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
value: "not_run",
|
|
62
|
+
icon: "bkflow-canvas-weizhixing2",
|
|
63
|
+
iconColor: "#b8bbc4",
|
|
64
|
+
tooltip: l.not_run
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "suspended",
|
|
68
|
+
icon: "bkflow-canvas-zanting",
|
|
69
|
+
iconColor: "#f59500",
|
|
70
|
+
tooltip: l.suspended
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: "skipped",
|
|
74
|
+
icon: "bkflow-canvas-tiaoguo2",
|
|
75
|
+
iconColor: "#6e89af",
|
|
76
|
+
tooltip: l.skipped
|
|
77
|
+
}
|
|
78
|
+
].map((p) => ({
|
|
79
|
+
...p,
|
|
80
|
+
count: p.value === "all" ? e.nodes.length : e.nodes.filter((s) => s.status === p.value).length
|
|
81
|
+
}));
|
|
82
|
+
}), V = i(() => {
|
|
83
|
+
const l = d.value.trim().toLowerCase();
|
|
84
|
+
return e.nodes.filter((n) => f.value !== "all" && n.status !== f.value ? !1 : l ? n.name.toLowerCase().includes(l) || n.type.toLowerCase().includes(l) || (n.typeName ?? "").toLowerCase().includes(l) : !0);
|
|
85
|
+
}), S = i(() => {
|
|
86
|
+
if (d.value.trim()) return t("搜索结果为空");
|
|
87
|
+
if (f.value !== "all") {
|
|
88
|
+
const l = C()[f.value];
|
|
89
|
+
if (l) return t("暂无{status}状态节点", { status: l });
|
|
90
|
+
}
|
|
91
|
+
return t("暂无节点");
|
|
92
|
+
}), N = () => {
|
|
93
|
+
d.value = "", f.value = "all";
|
|
94
|
+
}, D = (l) => {
|
|
95
|
+
const n = R.value, p = n?.querySelector(`[data-node-id="${CSS.escape(l)}"]`);
|
|
96
|
+
if (!n || !p) return;
|
|
97
|
+
const s = n.getBoundingClientRect(), k = p.getBoundingClientRect();
|
|
98
|
+
k.top < s.top ? n.scrollTop -= s.top - k.top : k.bottom > s.bottom && (n.scrollTop += k.bottom - s.bottom);
|
|
99
|
+
};
|
|
100
|
+
return Y(
|
|
101
|
+
() => e.modelValue,
|
|
102
|
+
async (l) => {
|
|
103
|
+
if (!l) return;
|
|
104
|
+
!V.value.some((p) => p.id === l) && e.nodes.some((p) => p.id === l) && (d.value = "", f.value = "all"), await X(), D(l);
|
|
105
|
+
},
|
|
106
|
+
{ flush: "post" }
|
|
107
|
+
), (l, n) => {
|
|
108
|
+
const p = B("bk-input");
|
|
109
|
+
return g(), h("aside", ke, [
|
|
110
|
+
_(p, {
|
|
111
|
+
modelValue: d.value,
|
|
112
|
+
"onUpdate:modelValue": n[0] || (n[0] = (s) => d.value = s),
|
|
113
|
+
class: "debug-result-node-list__search",
|
|
114
|
+
placeholder: u(t)("搜索节点名称 / 类型"),
|
|
115
|
+
type: "search",
|
|
116
|
+
clearable: "",
|
|
117
|
+
"data-test": "node-search"
|
|
118
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
119
|
+
_(ie, {
|
|
120
|
+
modelValue: f.value,
|
|
121
|
+
"onUpdate:modelValue": n[1] || (n[1] = (s) => f.value = s),
|
|
122
|
+
class: "debug-result-node-list__filters",
|
|
123
|
+
"data-test": "status-filters",
|
|
124
|
+
items: M.value
|
|
125
|
+
}, null, 8, ["modelValue", "items"]),
|
|
126
|
+
V.value.length > 0 ? (g(), h("div", {
|
|
127
|
+
key: 0,
|
|
128
|
+
ref_key: "itemsRef",
|
|
129
|
+
ref: R,
|
|
130
|
+
class: "debug-result-node-list__items",
|
|
131
|
+
role: "listbox"
|
|
132
|
+
}, [
|
|
133
|
+
(g(!0), h(Z, null, ee(V.value, (s) => (g(), h("div", {
|
|
134
|
+
key: s.id,
|
|
135
|
+
class: L([
|
|
136
|
+
"debug-result-node-list__item",
|
|
137
|
+
`is-${s.status}`,
|
|
138
|
+
{
|
|
139
|
+
"is-active": s.id === e.modelValue,
|
|
140
|
+
"is-unconfigured": !s.isConfigured
|
|
141
|
+
}
|
|
142
|
+
]),
|
|
143
|
+
role: "option",
|
|
144
|
+
"data-test": "node-item",
|
|
145
|
+
"data-node-id": s.id,
|
|
146
|
+
"aria-selected": s.id === e.modelValue,
|
|
147
|
+
tabindex: "0",
|
|
148
|
+
onClick: (k) => a("update:modelValue", s.id),
|
|
149
|
+
onKeydown: te(se((k) => a("update:modelValue", s.id), ["prevent"]), ["enter", "space"])
|
|
150
|
+
}, [
|
|
151
|
+
o("span", {
|
|
152
|
+
class: L([
|
|
153
|
+
"debug-result-node-list__status",
|
|
154
|
+
`is-${s.status}`,
|
|
155
|
+
{ "is-placeholder": !s.isConfigured }
|
|
156
|
+
])
|
|
157
|
+
}, [
|
|
158
|
+
s.icon ? (g(), h("i", {
|
|
159
|
+
key: 0,
|
|
160
|
+
class: L(s.icon),
|
|
161
|
+
"data-test": "node-icon"
|
|
162
|
+
}, null, 2)) : K("", !0)
|
|
163
|
+
], 2),
|
|
164
|
+
o("span", {
|
|
165
|
+
class: "debug-result-node-list__name",
|
|
166
|
+
title: s.isConfigured ? `${s.name} ${s.typeName || s.type}` : s.name
|
|
167
|
+
}, m(s.name), 9, we),
|
|
168
|
+
s.isMock ? (g(), h("span", he, "MOCK")) : K("", !0)
|
|
169
|
+
], 42, ye))), 128))
|
|
170
|
+
], 512)) : (g(), h("div", xe, [
|
|
171
|
+
_(re, {
|
|
172
|
+
"is-search": !1,
|
|
173
|
+
title: S.value,
|
|
174
|
+
onClear: N
|
|
175
|
+
}, null, 8, ["title"])
|
|
176
|
+
]))
|
|
177
|
+
]);
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}), Ve = /* @__PURE__ */ q(Ce, [["__scopeId", "data-v-0e33e88b"]]);
|
|
181
|
+
function Re(b) {
|
|
182
|
+
if (b == null) return "";
|
|
183
|
+
if (typeof b == "string") return b;
|
|
184
|
+
if (typeof b == "object") {
|
|
185
|
+
const x = b, e = x.message;
|
|
186
|
+
if (typeof e == "string" && e) {
|
|
187
|
+
const a = x.type;
|
|
188
|
+
return typeof a == "string" && a ? `${a}: ${e}` : e;
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
return JSON.stringify(b);
|
|
192
|
+
} catch {
|
|
193
|
+
return String(b);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return String(b);
|
|
197
|
+
}
|
|
198
|
+
const Me = { class: "debug-result-tabs" }, Ee = {
|
|
199
|
+
class: "debug-result-tabs__failed-actions",
|
|
200
|
+
"data-test": "output-error-actions"
|
|
201
|
+
}, $e = {
|
|
202
|
+
class: "debug-result-tabs__execution",
|
|
203
|
+
"data-test": "tab-execution"
|
|
204
|
+
}, Te = { class: "debug-result-tabs__row" }, Le = { class: "label" }, Se = { class: "value" }, Ne = { class: "debug-result-tabs__row" }, De = { class: "label" }, Be = { class: "value" }, ze = {
|
|
205
|
+
key: 0,
|
|
206
|
+
class: "debug-result-tabs__row is-error"
|
|
207
|
+
}, Ie = { class: "label" }, Pe = { class: "value" }, He = {
|
|
208
|
+
class: "debug-result-tabs__mock-hint",
|
|
209
|
+
"data-test": "mock-banner"
|
|
210
|
+
}, Ae = {
|
|
211
|
+
class: "debug-result-tabs__logs",
|
|
212
|
+
"data-test": "tab-logs"
|
|
213
|
+
}, Oe = /* @__PURE__ */ j({
|
|
214
|
+
__name: "result-tabs",
|
|
215
|
+
props: {
|
|
216
|
+
result: {},
|
|
217
|
+
component: {},
|
|
218
|
+
isMock: { type: Boolean, default: !1 },
|
|
219
|
+
canRunNodeDebug: { type: Boolean, default: !1 }
|
|
220
|
+
},
|
|
221
|
+
emits: ["reEditMock", "runReal", "runMock", "logsTabActive"],
|
|
222
|
+
setup(b, { emit: x }) {
|
|
223
|
+
const e = b, a = x, d = T("execution");
|
|
224
|
+
Y(
|
|
225
|
+
d,
|
|
226
|
+
(y) => a("logsTabActive", y === "logs"),
|
|
227
|
+
{ immediate: !0 }
|
|
228
|
+
);
|
|
229
|
+
function f() {
|
|
230
|
+
return {
|
|
231
|
+
not_run: t("未调试"),
|
|
232
|
+
running: t("正在调试"),
|
|
233
|
+
finished: t("成功"),
|
|
234
|
+
failed: t("失败"),
|
|
235
|
+
suspended: t("挂起"),
|
|
236
|
+
skipped: t("跳过"),
|
|
237
|
+
revoked: t("已终止")
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const R = i(
|
|
241
|
+
() => f()[e.result.execution.status] ?? e.result.execution.status
|
|
242
|
+
), C = i(() => de(e.result.execution.durationMs)), M = i(() => Re(e.result.error || e.result.execution.errorDetail)), V = i(() => e.result.execution.status === "revoked"), S = i(() => ce(e.result.execution.status)), N = i(
|
|
243
|
+
() => V.value ? t("该节点调试已终止,可") : t("该节点执行失败,可")
|
|
244
|
+
), {
|
|
245
|
+
loading: D,
|
|
246
|
+
error: l,
|
|
247
|
+
visibleInputs: n,
|
|
248
|
+
visibleOutputs: p,
|
|
249
|
+
outputNameMap: s
|
|
250
|
+
} = pe({ component: () => e.component }), k = i(() => e.result.loading || D.value), z = i(() => e.result.detailError || l.value), P = i(
|
|
251
|
+
() => n.value.filter(({ key: y }) => Object.prototype.hasOwnProperty.call(e.result.inputs, y)).map(({ key: y, name: v }) => ({ key: y, name: v, value: e.result.inputs[y] }))
|
|
252
|
+
), H = i(
|
|
253
|
+
() => me(
|
|
254
|
+
ve(e.result.outputs, s.value),
|
|
255
|
+
p.value.map((y) => y.key)
|
|
256
|
+
)
|
|
257
|
+
), A = i(() => be(e.isMock, p.value)), O = i(() => e.result.logs == null ? "" : _e(e.result.logs));
|
|
258
|
+
return (y, v) => {
|
|
259
|
+
const c = B("bk-button"), r = B("bk-tab-panel"), U = B("bk-tab");
|
|
260
|
+
return g(), h("div", Me, [
|
|
261
|
+
_(U, {
|
|
262
|
+
active: d.value,
|
|
263
|
+
"onUpdate:active": v[3] || (v[3] = (E) => d.value = E),
|
|
264
|
+
type: "card-grid"
|
|
265
|
+
}, J({
|
|
266
|
+
default: w(() => [
|
|
267
|
+
_(r, {
|
|
268
|
+
name: "execution",
|
|
269
|
+
label: u(t)("执行信息")
|
|
270
|
+
}, {
|
|
271
|
+
default: w(() => [
|
|
272
|
+
o("div", $e, [
|
|
273
|
+
o("div", Te, [
|
|
274
|
+
o("span", Le, m(u(t)("执行状态")), 1),
|
|
275
|
+
o("span", Se, m(R.value), 1)
|
|
276
|
+
]),
|
|
277
|
+
o("div", Ne, [
|
|
278
|
+
o("span", De, m(u(t)("调试用时")), 1),
|
|
279
|
+
o("span", Be, m(C.value), 1)
|
|
280
|
+
]),
|
|
281
|
+
M.value ? (g(), h("div", ze, [
|
|
282
|
+
o("span", Ie, m(u(t)("错误信息")), 1),
|
|
283
|
+
o("span", Pe, m(M.value), 1)
|
|
284
|
+
])) : K("", !0)
|
|
285
|
+
])
|
|
286
|
+
]),
|
|
287
|
+
_: 1
|
|
288
|
+
}, 8, ["label"]),
|
|
289
|
+
_(r, {
|
|
290
|
+
name: "inputs",
|
|
291
|
+
label: u(t)("输入参数")
|
|
292
|
+
}, {
|
|
293
|
+
default: w(() => [
|
|
294
|
+
_(W, {
|
|
295
|
+
rows: P.value,
|
|
296
|
+
loading: k.value,
|
|
297
|
+
error: z.value,
|
|
298
|
+
"empty-text": u(t)("暂无输入参数")
|
|
299
|
+
}, null, 8, ["rows", "loading", "error", "empty-text"])
|
|
300
|
+
]),
|
|
301
|
+
_: 1
|
|
302
|
+
}, 8, ["label"]),
|
|
303
|
+
_(r, {
|
|
304
|
+
name: "outputs",
|
|
305
|
+
label: u(t)("输出结果")
|
|
306
|
+
}, {
|
|
307
|
+
default: w(() => [
|
|
308
|
+
_(W, {
|
|
309
|
+
rows: H.value,
|
|
310
|
+
loading: k.value,
|
|
311
|
+
error: z.value,
|
|
312
|
+
"empty-text": u(t)("暂无输出结果")
|
|
313
|
+
}, J({ _: 2 }, [
|
|
314
|
+
A.value ? {
|
|
315
|
+
name: "toolbar",
|
|
316
|
+
fn: w(() => [
|
|
317
|
+
o("div", He, [
|
|
318
|
+
v[5] || (v[5] = o("i", {
|
|
319
|
+
class: "bkflow-canvas-icon bkflow-canvas-info debug-result-tabs__mock-info",
|
|
320
|
+
"aria-hidden": "true"
|
|
321
|
+
}, null, -1)),
|
|
322
|
+
o("span", null, m(u(t)("当前为 Mock 数据")), 1),
|
|
323
|
+
_(c, {
|
|
324
|
+
text: "",
|
|
325
|
+
theme: "primary",
|
|
326
|
+
size: "small",
|
|
327
|
+
"data-test": "re-edit-mock",
|
|
328
|
+
onClick: v[2] || (v[2] = (E) => a("reEditMock"))
|
|
329
|
+
}, {
|
|
330
|
+
default: w(() => [
|
|
331
|
+
I(m(u(t)("重新编辑")), 1)
|
|
332
|
+
]),
|
|
333
|
+
_: 1
|
|
334
|
+
})
|
|
335
|
+
])
|
|
336
|
+
]),
|
|
337
|
+
key: "0"
|
|
338
|
+
} : void 0
|
|
339
|
+
]), 1032, ["rows", "loading", "error", "empty-text"])
|
|
340
|
+
]),
|
|
341
|
+
_: 1
|
|
342
|
+
}, 8, ["label"]),
|
|
343
|
+
_(r, {
|
|
344
|
+
name: "logs",
|
|
345
|
+
label: u(t)("调用日志")
|
|
346
|
+
}, {
|
|
347
|
+
default: w(() => [
|
|
348
|
+
o("div", Ae, [
|
|
349
|
+
_(fe, {
|
|
350
|
+
"log-text": O.value,
|
|
351
|
+
loading: e.result.logLoading,
|
|
352
|
+
error: e.result.logError
|
|
353
|
+
}, null, 8, ["log-text", "loading", "error"])
|
|
354
|
+
])
|
|
355
|
+
]),
|
|
356
|
+
_: 1
|
|
357
|
+
}, 8, ["label"])
|
|
358
|
+
]),
|
|
359
|
+
_: 2
|
|
360
|
+
}, [
|
|
361
|
+
S.value && e.canRunNodeDebug ? {
|
|
362
|
+
name: "setting",
|
|
363
|
+
fn: w(() => [
|
|
364
|
+
o("div", Ee, [
|
|
365
|
+
v[4] || (v[4] = o("i", { class: "bkflow-canvas-icon bkflow-canvas-alert" }, null, -1)),
|
|
366
|
+
o("span", null, m(N.value), 1),
|
|
367
|
+
_(c, {
|
|
368
|
+
text: "",
|
|
369
|
+
theme: "primary",
|
|
370
|
+
"data-test": "rerun-real",
|
|
371
|
+
onClick: v[0] || (v[0] = (E) => a("runReal"))
|
|
372
|
+
}, {
|
|
373
|
+
default: w(() => [
|
|
374
|
+
I(m(u(t)("重新调试")), 1)
|
|
375
|
+
]),
|
|
376
|
+
_: 1
|
|
377
|
+
}),
|
|
378
|
+
o("span", null, m(u(t)("或直接")), 1),
|
|
379
|
+
_(c, {
|
|
380
|
+
text: "",
|
|
381
|
+
theme: "primary",
|
|
382
|
+
"data-test": "run-mock",
|
|
383
|
+
onClick: v[1] || (v[1] = (E) => a("runMock"))
|
|
384
|
+
}, {
|
|
385
|
+
default: w(() => [
|
|
386
|
+
I(m(u(t)("Mock 输出")), 1)
|
|
387
|
+
]),
|
|
388
|
+
_: 1
|
|
389
|
+
})
|
|
390
|
+
])
|
|
391
|
+
]),
|
|
392
|
+
key: "0"
|
|
393
|
+
} : void 0
|
|
394
|
+
]), 1032, ["active"])
|
|
395
|
+
]);
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
}), Ue = /* @__PURE__ */ q(Oe, [["__scopeId", "data-v-92a716a1"]]), Ge = { class: "debug-result-drawer__header" }, Fe = { class: "debug-result-drawer__header-left" }, Ke = { class: "debug-result-drawer__title" }, je = { class: "debug-result-drawer__body" }, Ye = { class: "debug-result-drawer__content" }, qe = { class: "debug-result-drawer__result" }, Je = {
|
|
399
|
+
key: 1,
|
|
400
|
+
class: "debug-result-drawer__unselected",
|
|
401
|
+
"data-test": "node-unselected"
|
|
402
|
+
}, $ = 44, F = 420, Qe = /* @__PURE__ */ j({
|
|
403
|
+
__name: "index",
|
|
404
|
+
props: {
|
|
405
|
+
open: { type: Boolean },
|
|
406
|
+
context: {},
|
|
407
|
+
pipelineTree: {},
|
|
408
|
+
mockNodeIds: {},
|
|
409
|
+
modelValue: { default: "" },
|
|
410
|
+
result: {},
|
|
411
|
+
hasGlobalRun: { type: Boolean, default: !1 },
|
|
412
|
+
viewParamsPending: { type: Boolean, default: !1 },
|
|
413
|
+
offsetLeft: { default: 0 }
|
|
414
|
+
},
|
|
415
|
+
emits: ["update:open", "update:modelValue", "reEditMock", "runReal", "runMock", "viewParams", "logsTabActive"],
|
|
416
|
+
setup(b, { emit: x }) {
|
|
417
|
+
const e = b, a = x, d = T(F), f = T(!1);
|
|
418
|
+
let R = 0, C = 0, M = "", V = "";
|
|
419
|
+
const S = i(() => ({
|
|
420
|
+
left: `${e.offsetLeft}px`,
|
|
421
|
+
height: `${e.open ? d.value : $}px`
|
|
422
|
+
})), N = () => {
|
|
423
|
+
e.open || (d.value = F), a("update:open", !e.open);
|
|
424
|
+
}, D = (c) => {
|
|
425
|
+
const r = c > $;
|
|
426
|
+
r !== e.open && a("update:open", r);
|
|
427
|
+
}, l = (c) => {
|
|
428
|
+
const r = C - (c.clientY - R);
|
|
429
|
+
d.value = Math.max($, Math.min(window.innerHeight * 0.8, r)), D(d.value);
|
|
430
|
+
}, n = () => {
|
|
431
|
+
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", n), document.body.style.cursor = M, document.body.style.userSelect = V, f.value = !1, d.value <= $ && (d.value = F, a("update:open", !1));
|
|
432
|
+
}, p = (c) => {
|
|
433
|
+
c.preventDefault(), f.value = !0, R = c.clientY, e.open ? C = d.value : (a("update:open", !0), d.value = $, C = $), M = document.body.style.cursor, V = document.body.style.userSelect, document.body.style.cursor = "ns-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", l), document.addEventListener("mouseup", n);
|
|
434
|
+
};
|
|
435
|
+
oe(n);
|
|
436
|
+
const s = i({
|
|
437
|
+
get: () => e.modelValue,
|
|
438
|
+
set: (c) => a("update:modelValue", c)
|
|
439
|
+
});
|
|
440
|
+
Y(
|
|
441
|
+
() => e.modelValue,
|
|
442
|
+
(c) => {
|
|
443
|
+
c || a("logsTabActive", !1);
|
|
444
|
+
},
|
|
445
|
+
{ immediate: !0 }
|
|
446
|
+
);
|
|
447
|
+
const k = i(
|
|
448
|
+
() => ge(e.pipelineTree, e.context?.nodes, e.mockNodeIds)
|
|
449
|
+
), z = i(() => e.mockNodeIds.has(e.modelValue)), P = i(() => e.pipelineTree?.activities?.[e.modelValue]?.component), H = i(() => {
|
|
450
|
+
const c = k.value.find((r) => r.id === e.modelValue);
|
|
451
|
+
return c?.type === "ServiceActivity" && c.isConfigured;
|
|
452
|
+
}), A = () => {
|
|
453
|
+
!e.hasGlobalRun || e.viewParamsPending || a("viewParams");
|
|
454
|
+
}, O = () => {
|
|
455
|
+
e.modelValue && a("reEditMock", e.modelValue);
|
|
456
|
+
}, y = () => {
|
|
457
|
+
e.modelValue && a("runReal", e.modelValue);
|
|
458
|
+
}, v = () => {
|
|
459
|
+
e.modelValue && a("runMock", e.modelValue);
|
|
460
|
+
};
|
|
461
|
+
return (c, r) => {
|
|
462
|
+
const U = B("bk-button"), E = le("bk-tooltips");
|
|
463
|
+
return g(), h("div", {
|
|
464
|
+
class: L(["debug-result-drawer-wrapper", { "is-resizing": f.value }]),
|
|
465
|
+
style: ae(S.value)
|
|
466
|
+
}, [
|
|
467
|
+
o("div", {
|
|
468
|
+
class: "debug-result-drawer__resize",
|
|
469
|
+
onMousedown: p
|
|
470
|
+
}, null, 32),
|
|
471
|
+
o("section", {
|
|
472
|
+
class: L(["debug-result-drawer", { "is-collapsed": !e.open }])
|
|
473
|
+
}, [
|
|
474
|
+
o("header", Ge, [
|
|
475
|
+
o("div", Fe, [
|
|
476
|
+
o("span", Ke, m(u(t)("调试结果")), 1),
|
|
477
|
+
r[3] || (r[3] = o("span", { class: "debug-result-drawer__divider" }, null, -1)),
|
|
478
|
+
ne((g(), Q(U, {
|
|
479
|
+
text: "",
|
|
480
|
+
theme: "primary",
|
|
481
|
+
disabled: !e.hasGlobalRun,
|
|
482
|
+
loading: e.viewParamsPending,
|
|
483
|
+
onClick: A
|
|
484
|
+
}, {
|
|
485
|
+
default: w(() => [
|
|
486
|
+
r[2] || (r[2] = o("i", { class: "bkflow-canvas-icon bkflow-canvas-audit view-params-icon" }, null, -1)),
|
|
487
|
+
I(" " + m(u(t)("查看参数")), 1)
|
|
488
|
+
]),
|
|
489
|
+
_: 1
|
|
490
|
+
}, 8, ["disabled", "loading"])), [
|
|
491
|
+
[E, { content: u(t)("请先进行调试"), disabled: e.hasGlobalRun }]
|
|
492
|
+
])
|
|
493
|
+
]),
|
|
494
|
+
o("span", {
|
|
495
|
+
class: "debug-result-drawer__collapse",
|
|
496
|
+
onClick: N
|
|
497
|
+
}, [
|
|
498
|
+
o("span", null, m(e.open ? u(t)("收起") : u(t)("展开")), 1),
|
|
499
|
+
o("i", {
|
|
500
|
+
class: L(["bkflow-canvas-icon bkflow-canvas-arrows-down debug-result-drawer__collapse-icon", { "is-expanded": e.open }])
|
|
501
|
+
}, null, 2)
|
|
502
|
+
])
|
|
503
|
+
]),
|
|
504
|
+
o("div", je, [
|
|
505
|
+
o("div", Ye, [
|
|
506
|
+
_(Ve, {
|
|
507
|
+
modelValue: s.value,
|
|
508
|
+
"onUpdate:modelValue": r[0] || (r[0] = (G) => s.value = G),
|
|
509
|
+
nodes: k.value
|
|
510
|
+
}, null, 8, ["modelValue", "nodes"]),
|
|
511
|
+
o("div", qe, [
|
|
512
|
+
e.modelValue ? (g(), Q(Ue, {
|
|
513
|
+
key: 0,
|
|
514
|
+
result: e.result,
|
|
515
|
+
component: P.value,
|
|
516
|
+
"is-mock": z.value,
|
|
517
|
+
"can-run-node-debug": H.value,
|
|
518
|
+
onReEditMock: O,
|
|
519
|
+
onRunReal: y,
|
|
520
|
+
onRunMock: v,
|
|
521
|
+
onLogsTabActive: r[1] || (r[1] = (G) => a("logsTabActive", G))
|
|
522
|
+
}, null, 8, ["result", "component", "is-mock", "can-run-node-debug"])) : (g(), h("div", Je, m(u(t)("请先选择节点查看调试详情")), 1))
|
|
523
|
+
])
|
|
524
|
+
])
|
|
525
|
+
])
|
|
526
|
+
], 2)
|
|
527
|
+
], 6);
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
}), tt = /* @__PURE__ */ q(Qe, [["__scopeId", "data-v-7394b019"]]);
|
|
531
|
+
export {
|
|
532
|
+
tt as default
|
|
533
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("./context-C3QIuIf6.cjs");const l=require("./index-iB9uV7YQ.cjs");require("bkui-vue/lib/message");require("bkui-vue/lib/icon");require("monaco-editor");const u=require("@blueking/flow-canvas"),N={string:"input",text:"input",textarea:"textarea",int:"input",integer:"input",number:"input",float:"input",json:"json",object:"json",array:"array",list:"array",select:"select",time:"timepicker",datetime:"timepicker"},g=o=>o.replace(/^\$\{(.+)\}$/,"$1"),V=o=>`\${${g(o)}}`;function F(o,d){const a=V(o.key),n=d?l.cloneDeep(d):{},p=o.custom_type??n.custom_type??N[o.type]??"input";return{...n,key:a,name:o.name??n.name??g(o.key),custom_type:p,desc:n.desc??"",index:n.index??0,show_type:"show",source_info:n.source_info??{},source_tag:n.source_tag??"",source_type:n.source_type??"custom",validation:n.validation??"",value:o.default??n.value,meta:{...n.meta??{},required:o.required??n.meta?.required??!1}}}function q(o,d={}){if(!o)return{};const a=o.constants;return a&&Object.keys(a).length>0?{...a}:Array.isArray(o.fields)&&o.fields.length>0?o.fields.reduce((n,p)=>{const s=V(p.key);return n[s]=F(p,d[s]),n},{}):{}}const j={class:"global-debug-input"},R={key:0,class:"global-debug-input__params","data-test":"input-params"},S={class:"col-name"},L={class:"col-value"},O={key:0},T={class:"global-debug-input__empty",colspan:"2"},I=["title"],P={class:"col-value"},$={key:1,class:"global-debug-input__value"},A={key:1,class:"form-params-wrapper"},U={class:"sideslider-footer-buttons"},K=e.defineComponent({__name:"index",props:{show:{type:Boolean},schema:{},pipelineConstants:{default:()=>({})},initialValues:{default:()=>({})},pending:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1}},emits:["confirm","close","update:show"],setup(o,{emit:d}){const a=o,n=d,p=l.useFlowApiConfig(),s=e.ref({}),f=e.shallowRef([]),m=e.shallowRef([]),y=e.shallowRef(!1),v=e.ref(),_=e.ref(),k=e.computed(()=>f.value.filter(t=>l.isBuiltinUsageVariable(t))),w=e.computed(()=>k.value.length>0||m.value.length>0),h=e.computed(()=>[...f.value].sort((t,r)=>(t.index??0)-(r.index??0)).map(t=>{const r=Object.prototype.hasOwnProperty.call(s.value,t.key)?s.value[t.key]:t.value;return{key:t.key,name:t.name||t.key,value:r,display:l.formatDebugValue(r),isComplex:l.isComplexDebugValue(r)}}));e.watch(()=>a.show,t=>{t&&(s.value=l.cloneDeep(a.initialValues??{}),B())});const B=async()=>{const t=q(a.schema,a.pipelineConstants),r=Object.values(t).filter(i=>typeof i=="object"&&i!==null&&i.show_type==="show");if(f.value=r,a.readonly||Object.keys(t).length<1){m.value=[];return}y.value=!0;try{m.value=await l.getInputFormsFromConstants(p,t)}catch(i){console.error("Failed to build debug input forms from schema:",i),m.value=[]}finally{y.value=!1}},C=t=>{s.value={...s.value,...l.cloneDeep(t)}},x=async()=>{const[t,r]=await Promise.all([Promise.resolve(typeof _.value?.validate=="function"?_.value.validate():!0),Promise.resolve(typeof v.value?.validate=="function"?v.value.validate():!0)]);!t||!r||n("confirm",l.cloneDeep(s.value))},b=()=>{n("close"),n("update:show",!1)};return(t,r)=>{const i=e.resolveComponent("bk-button"),E=e.resolveComponent("bk-sideslider"),D=e.resolveDirective("bkloading");return e.openBlock(),e.createBlock(E,{title:e.unref(u.t)("调试参数"),"is-show":a.show,width:960,"quick-close":!0,"esc-close":!1,onClosed:b},e.createSlots({default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",j,[a.readonly?(e.openBlock(),e.createElementBlock("table",R,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",S,e.toDisplayString(e.unref(u.t)("参数名")),1),e.createElementVNode("th",L,e.toDisplayString(e.unref(u.t)("参数值")),1)])]),e.createElementVNode("tbody",null,[h.value.length===0?(e.openBlock(),e.createElementBlock("tr",O,[e.createElementVNode("td",T,e.toDisplayString(e.unref(u.t)("暂无参数")),1)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,c=>(e.openBlock(),e.createElementBlock("tr",{key:c.key,"data-test":"input-row"},[e.createElementVNode("td",{class:"col-name",title:c.key},e.toDisplayString(c.name),9,I),e.createElementVNode("td",P,[c.isComplex?(e.openBlock(),e.createBlock(l.DebugJsonViewer,{key:0,value:c.value,"data-test":"json-viewer"},null,8,["value"])):(e.openBlock(),e.createElementBlock("pre",$,e.toDisplayString(c.display),1))])]))),128))])])):(e.openBlock(),e.createElementBlock("div",A,[k.value.length>0?(e.openBlock(),e.createBlock(e.unref(l.BuiltinVariableUsageForm),{key:0,ref_key:"builtinVariableFormRef",ref:_,modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=c=>s.value=c),variables:k.value},null,8,["modelValue","variables"])):e.createCommentVNode("",!0),m.value.length>0?(e.openBlock(),e.createBlock(l.RenderForm,{key:1,ref_key:"renderFormRef",ref:v,scheme:m.value,editable:"","form-option":{showRequired:!0,showGroup:!0,showLabel:!1,showHook:!1,showDesc:!0,formEdit:!0},"form-data":s.value,onChange:C},null,8,["scheme","form-data"])):e.createCommentVNode("",!0),w.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(l.EmptyException,{key:2,title:e.unref(u.t)("暂无参数")},null,8,["title"]))]))])),[[D,{loading:y.value}]])]),_:2},[a.readonly?void 0:{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",U,[e.createVNode(i,{theme:"primary","data-test":"save-and-run",loading:a.pending,onClick:x},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.t)("保存并执行")),1)]),_:1},8,["loading"]),e.createVNode(i,{disabled:a.pending,onClick:b},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u.t)("取消")),1)]),_:1},8,["disabled"])])]),key:"0"}]),1032,["title","is-show"])}}}),G=l._export_sfc(K,[["__scopeId","data-v-8eaa2ef7"]]);exports.default=G;
|