@blueking/bkflow-canvas-editor 1.2.0-beta.5 → 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-DV2Z3oiJ.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
- };