@blueking/bkflow-canvas-editor 1.1.0-beta.1 → 1.1.0-beta.11

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