@blueking/bkflow-canvas-editor 1.2.0-beta.3 → 1.2.0-beta.6

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