@blueking/bkflow-canvas-editor 1.1.0-beta.8 → 1.2.0-beta.0

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,512 @@
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 B, 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 } from "./index-FsDBMpW4.js";
3
+ const ge = { class: "debug-result-node-list" }, _e = ["data-node-id", "aria-selected", "onClick", "onKeydown"], ke = ["title"], ye = {
4
+ key: 0,
5
+ class: "debug-result-node-list__mock",
6
+ "data-test": "node-mock-flag"
7
+ }, we = {
8
+ key: 1,
9
+ class: "debug-result-node-list__empty"
10
+ }, xe = /* @__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", ge, [
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, ke),
154
+ t.isMock ? (f(), y("span", ye, "MOCK")) : F("", !0)
155
+ ], 42, _e))), 128))
156
+ ], 512)) : (f(), y("div", we, [
157
+ p(ue, {
158
+ "is-search": !1,
159
+ title: $.value,
160
+ onClear: D
161
+ }, null, 8, ["title"])
162
+ ]))
163
+ ]);
164
+ };
165
+ }
166
+ }), he = /* @__PURE__ */ j(xe, [["__scopeId", "data-v-db0cb31c"]]);
167
+ function Ce(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 Re = { class: "debug-result-tabs" }, Ve = {
185
+ class: "debug-result-tabs__failed-actions",
186
+ "data-test": "output-error-actions"
187
+ }, Te = {
188
+ class: "debug-result-tabs__execution",
189
+ "data-test": "tab-execution"
190
+ }, Me = { class: "debug-result-tabs__row" }, Ee = { class: "value" }, Se = { class: "debug-result-tabs__row" }, Le = { class: "value" }, $e = {
191
+ key: 0,
192
+ class: "debug-result-tabs__row is-error"
193
+ }, De = { class: "value" }, Ne = {
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
+ }, Ae = /* @__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(() => Ce(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), A = 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", Re, [
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", Te, [
252
+ o("div", Me, [
253
+ s[8] || (s[8] = o("span", { class: "label" }, "执行状态", -1)),
254
+ o("span", Ee, E(x.value), 1)
255
+ ]),
256
+ o("div", Se, [
257
+ s[9] || (s[9] = o("span", { class: "label" }, "调试用时", -1)),
258
+ o("span", Le, E(v.value), 1)
259
+ ]),
260
+ h.value ? (f(), y("div", $e, [
261
+ s[10] || (s[10] = o("span", { class: "label" }, "错误信息", -1)),
262
+ o("span", De, 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: A.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", Ne, [
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
+ B(" 重新编辑 ", -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", Ve, [
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
+ B("重新调试", -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
+ B("Mock 输出", -1)
366
+ ])]),
367
+ _: 1
368
+ })
369
+ ])
370
+ ]),
371
+ key: "0"
372
+ } : void 0
373
+ ]), 1032, ["active"])
374
+ ]);
375
+ };
376
+ }
377
+ }), Ie = /* @__PURE__ */ j(Ae, [["__scopeId", "data-v-2a925689"]]), Pe = { class: "debug-result-drawer__header" }, ze = { class: "debug-result-drawer__header-left" }, He = { class: "debug-result-drawer__body" }, Ue = { class: "debug-result-drawer__content" }, Oe = { class: "debug-result-drawer__result" }, Fe = {
378
+ key: 1,
379
+ class: "debug-result-drawer__unselected",
380
+ "data-test": "node-unselected"
381
+ }, M = 44, O = 420, Ge = /* @__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)), A = i(() => e.pipelineTree?.activities?.[e.modelValue]?.component), I = i(() => {
429
+ const d = t.value.find((u) => u.id === e.modelValue);
430
+ return d?.type === "ServiceActivity" && d.isConfigured;
431
+ }), P = () => {
432
+ !e.hasGlobalRun || e.viewParamsPending || l("viewParams");
433
+ }, z = () => {
434
+ e.modelValue && l("reEditMock", e.modelValue);
435
+ }, _ = () => {
436
+ e.modelValue && l("runReal", e.modelValue);
437
+ }, s = () => {
438
+ e.modelValue && l("runMock", e.modelValue);
439
+ };
440
+ return (d, u) => {
441
+ const H = N("bk-button"), T = se("bk-tooltips");
442
+ return f(), y("div", {
443
+ class: L(["debug-result-drawer-wrapper", { "is-resizing": m.value }]),
444
+ style: oe(C.value)
445
+ }, [
446
+ o("div", {
447
+ class: "debug-result-drawer__resize",
448
+ onMousedown: a
449
+ }, null, 32),
450
+ o("section", {
451
+ class: L(["debug-result-drawer", { "is-collapsed": !e.open }])
452
+ }, [
453
+ o("header", Pe, [
454
+ o("div", ze, [
455
+ u[3] || (u[3] = o("span", { class: "debug-result-drawer__title" }, "调试结果", -1)),
456
+ u[4] || (u[4] = o("span", { class: "debug-result-drawer__divider" }, null, -1)),
457
+ le((f(), q(H, {
458
+ text: "",
459
+ theme: "primary",
460
+ disabled: !e.hasGlobalRun,
461
+ loading: e.viewParamsPending,
462
+ onClick: P
463
+ }, {
464
+ default: k(() => [...u[2] || (u[2] = [
465
+ o("i", { class: "bkflow-canvas-icon bkflow-canvas-audit view-params-icon" }, null, -1),
466
+ B(" 查看参数 ", -1)
467
+ ])]),
468
+ _: 1
469
+ }, 8, ["disabled", "loading"])), [
470
+ [T, { content: "请先进行调试", disabled: e.hasGlobalRun }]
471
+ ])
472
+ ]),
473
+ o("span", {
474
+ class: "debug-result-drawer__collapse",
475
+ onClick: $
476
+ }, [
477
+ o("span", null, E(e.open ? "收起" : "展开"), 1),
478
+ o("i", {
479
+ class: L(["bkflow-canvas-icon bkflow-canvas-arrows-down debug-result-drawer__collapse-icon", { "is-expanded": e.open }])
480
+ }, null, 2)
481
+ ])
482
+ ]),
483
+ o("div", He, [
484
+ o("div", Ue, [
485
+ p(he, {
486
+ modelValue: b.value,
487
+ "onUpdate:modelValue": u[0] || (u[0] = (U) => b.value = U),
488
+ nodes: t.value
489
+ }, null, 8, ["modelValue", "nodes"]),
490
+ o("div", Oe, [
491
+ e.modelValue ? (f(), q(Ie, {
492
+ key: 0,
493
+ result: e.result,
494
+ component: A.value,
495
+ "is-mock": g.value,
496
+ "can-run-node-debug": I.value,
497
+ onReEditMock: z,
498
+ onRunReal: _,
499
+ onRunMock: s,
500
+ onLogsTabActive: u[1] || (u[1] = (U) => l("logsTabActive", U))
501
+ }, null, 8, ["result", "component", "is-mock", "can-run-node-debug"])) : (f(), y("div", Fe, " 请先选择节点查看调试详情 "))
502
+ ])
503
+ ])
504
+ ])
505
+ ], 2)
506
+ ], 6);
507
+ };
508
+ }
509
+ }), Ye = /* @__PURE__ */ j(Ge, [["__scopeId", "data-v-84a5277a"]]);
510
+ export {
511
+ Ye as default
512
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),d=require("./index-BUBxGOMp.cjs"),L={class:"debug-result-node-list"},D=["data-node-id","aria-selected","onClick","onKeydown"],z=["title"],A={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},P={key:1,class:"debug-result-node-list__empty"},I=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(c,{emit:g}){const t=c,s=g,r=e.ref(""),m=e.ref("all"),_=e.ref(null),p={not_run:"未执行",finished:"成功",failed:"失败",running:"正在调试",suspended:"挂起",skipped:"跳过",revoked:"终止"},k=[{value:"all",label:"全部"},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#5fb8ac",tooltip:p.finished},{value:"failed",icon:"bkflow-canvas-dark-circle-close",iconColor:"#fa4e41",tooltip:p.failed},{value:"revoked",icon:"bkflow-canvas-stop-fill",iconColor:"#fa4e41",tooltip:p.revoked},{value:"running",iconComponent:d.LoadingStatusIcon,iconColor:"#3a84ff",tooltip:p.running},{value:"not_run",icon:"bkflow-canvas-weizhixing2",iconColor:"#b8bbc4",tooltip:p.not_run},{value:"suspended",icon:"bkflow-canvas-zanting",iconColor:"#f59500",tooltip:p.suspended},{value:"skipped",icon:"bkflow-canvas-tiaoguo2",iconColor:"#6e89af",tooltip:p.skipped}],w=e.computed(()=>k.map(a=>({...a,count:a.value==="all"?t.nodes.length:t.nodes.filter(n=>n.status===a.value).length}))),V=e.computed(()=>{const a=r.value.trim().toLowerCase();return t.nodes.filter(n=>m.value!=="all"&&n.status!==m.value?!1:a?n.name.toLowerCase().includes(a)||n.type.toLowerCase().includes(a)||(n.typeName??"").toLowerCase().includes(a):!0)}),C=e.computed(()=>r.value.trim()?"搜索结果为空":m.value!=="all"?`暂无${p[m.value]}状态节点`:"暂无节点"),x=()=>{r.value="",m.value="all"},y=a=>{const n=_.value,v=n?.querySelector(`[data-node-id="${CSS.escape(a)}"]`);if(!n||!v)return;const o=n.getBoundingClientRect(),b=v.getBoundingClientRect();b.top<o.top?n.scrollTop-=o.top-b.top:b.bottom>o.bottom&&(n.scrollTop+=b.bottom-o.bottom)};return e.watch(()=>t.modelValue,async a=>{if(!a)return;!V.value.some(v=>v.id===a)&&t.nodes.some(v=>v.id===a)&&(r.value="",m.value="all"),await e.nextTick(),y(a)},{flush:"post"}),(a,n)=>{const v=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",L,[e.createVNode(v,{modelValue:r.value,"onUpdate:modelValue":n[0]||(n[0]=o=>r.value=o),class:"debug-result-node-list__search",placeholder:"搜索节点名称 / 类型",type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue"]),e.createVNode(d.SegmentTabs,{modelValue:m.value,"onUpdate:modelValue":n[1]||(n[1]=o=>m.value=o),class:"debug-result-node-list__filters","data-test":"status-filters",items:w.value},null,8,["modelValue","items"]),V.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:_,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.id,class:e.normalizeClass(["debug-result-node-list__item",`is-${o.status}`,{"is-active":o.id===t.modelValue,"is-unconfigured":!o.isConfigured}]),role:"option","data-test":"node-item","data-node-id":o.id,"aria-selected":o.id===t.modelValue,tabindex:"0",onClick:b=>s("update:modelValue",o.id),onKeydown:e.withKeys(e.withModifiers(b=>s("update:modelValue",o.id),["prevent"]),["enter","space"])},[e.createElementVNode("span",{class:e.normalizeClass(["debug-result-node-list__status",`is-${o.status}`,{"is-placeholder":!o.isConfigured}])},[o.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(o.icon),"data-test":"node-icon"},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",{class:"debug-result-node-list__name",title:o.isConfigured?`${o.name} ${o.typeName||o.type}`:o.name},e.toDisplayString(o.name),9,z),o.isMock?(e.openBlock(),e.createElementBlock("span",A,"MOCK")):e.createCommentVNode("",!0)],42,D))),128))],512)):(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(d.EmptyException,{"is-search":!1,title:C.value,onClear:x},null,8,["title"])]))])}}}),H=d._export_sfc(I,[["__scopeId","data-v-db0cb31c"]]);function U(c){if(c==null)return"";if(typeof c=="string")return c;if(typeof c=="object"){const g=c,t=g.message;if(typeof t=="string"&&t){const s=g.type;return typeof s=="string"&&s?`${s}: ${t}`:t}try{return JSON.stringify(c)}catch{return String(c)}}return String(c)}const O={class:"debug-result-tabs"},F={class:"debug-result-tabs__failed-actions","data-test":"output-error-actions"},G={class:"debug-result-tabs__execution","data-test":"tab-execution"},K={class:"debug-result-tabs__row"},j={class:"value"},q={class:"debug-result-tabs__row"},Y={class:"value"},J={key:0,class:"debug-result-tabs__row is-error"},Q={class:"value"},W={class:"debug-result-tabs__mock-hint","data-test":"mock-banner"},X={class:"debug-result-tabs__logs","data-test":"tab-logs"},Z=e.defineComponent({__name:"result-tabs",props:{result:{},component:{},isMock:{type:Boolean,default:!1},canRunNodeDebug:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock","logsTabActive"],setup(c,{emit:g}){const t=c,s=g,r=e.ref("execution");e.watch(r,f=>s("logsTabActive",f==="logs"),{immediate:!0});const m={not_run:"未调试",running:"正在调试",finished:"成功",failed:"失败",suspended:"挂起",skipped:"跳过",revoked:"已终止"},_=e.computed(()=>m[t.result.execution.status]??t.result.execution.status),p=e.computed(()=>d.formatSummaryDuration(t.result.execution.durationMs)),k=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),w=e.computed(()=>t.result.execution.status==="revoked"),V=e.computed(()=>d.isDebugAbnormalStatus(t.result.execution.status)),C=e.computed(()=>w.value?"该节点调试已终止,可":"该节点执行失败,可"),{loading:x,error:y,visibleInputs:a,visibleOutputs:n,outputNameMap:v}=d.usePluginParamMeta({component:()=>t.component}),o=e.computed(()=>t.result.loading||x.value),b=e.computed(()=>t.result.detailError||y.value),h=e.computed(()=>a.value.filter(({key:f})=>Object.prototype.hasOwnProperty.call(t.result.inputs,f)).map(({key:f,name:l})=>({key:f,name:l,value:t.result.inputs[f]}))),B=e.computed(()=>d.orderDebugRowsByDeclaredKeys(d.toDebugOutputValueRows(t.result.outputs,v.value),n.value.map(f=>f.key))),R=e.computed(()=>d.shouldShowMockReEditHint(t.isMock,n.value)),T=e.computed(()=>t.result.logs==null?"":d.normalizeLogText(t.result.logs));return(f,l)=>{const i=e.resolveComponent("bk-button"),u=e.resolveComponent("bk-tab-panel"),S=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",O,[e.createVNode(S,{active:r.value,"onUpdate:active":l[3]||(l[3]=E=>r.value=E),type:"card-grid"},e.createSlots({default:e.withCtx(()=>[e.createVNode(u,{name:"execution",label:"执行信息"},{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createElementVNode("div",K,[l[8]||(l[8]=e.createElementVNode("span",{class:"label"},"执行状态",-1)),e.createElementVNode("span",j,e.toDisplayString(_.value),1)]),e.createElementVNode("div",q,[l[9]||(l[9]=e.createElementVNode("span",{class:"label"},"调试用时",-1)),e.createElementVNode("span",Y,e.toDisplayString(p.value),1)]),k.value?(e.openBlock(),e.createElementBlock("div",J,[l[10]||(l[10]=e.createElementVNode("span",{class:"label"},"错误信息",-1)),e.createElementVNode("span",Q,e.toDisplayString(k.value),1)])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(u,{name:"inputs",label:"输入参数"},{default:e.withCtx(()=>[e.createVNode(d.DebugValueTable,{rows:h.value,loading:o.value,error:b.value,"empty-text":"暂无输入参数"},null,8,["rows","loading","error"])]),_:1}),e.createVNode(u,{name:"outputs",label:"输出结果"},{default:e.withCtx(()=>[e.createVNode(d.DebugValueTable,{rows:B.value,loading:o.value,error:b.value,"empty-text":"暂无输出结果"},e.createSlots({_:2},[R.value?{name:"toolbar",fn:e.withCtx(()=>[e.createElementVNode("div",W,[l[12]||(l[12]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-info debug-result-tabs__mock-info","aria-hidden":"true"},null,-1)),l[13]||(l[13]=e.createElementVNode("span",null,"当前为 Mock 数据",-1)),e.createVNode(i,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:l[2]||(l[2]=E=>s("reEditMock"))},{default:e.withCtx(()=>[...l[11]||(l[11]=[e.createTextVNode(" 重新编辑 ",-1)])]),_:1})])]),key:"0"}:void 0]),1032,["rows","loading","error"])]),_:1}),e.createVNode(u,{name:"logs",label:"调用日志"},{default:e.withCtx(()=>[e.createElementVNode("div",X,[e.createVNode(d.CallLogsViewer,{"log-text":T.value,loading:t.result.logLoading,error:t.result.logError},null,8,["log-text","loading","error"])])]),_:1})]),_:2},[V.value&&t.canRunNodeDebug?{name:"setting",fn:e.withCtx(()=>[e.createElementVNode("div",F,[l[6]||(l[6]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-alert"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(C.value),1),e.createVNode(i,{text:"",theme:"primary","data-test":"rerun-real",onClick:l[0]||(l[0]=E=>s("runReal"))},{default:e.withCtx(()=>[...l[4]||(l[4]=[e.createTextVNode("重新调试",-1)])]),_:1}),l[7]||(l[7]=e.createElementVNode("span",null,"或直接",-1)),e.createVNode(i,{text:"",theme:"primary","data-test":"run-mock",onClick:l[1]||(l[1]=E=>s("runMock"))},{default:e.withCtx(()=>[...l[5]||(l[5]=[e.createTextVNode("Mock 输出",-1)])]),_:1})])]),key:"0"}:void 0]),1032,["active"])])}}}),ee=d._export_sfc(Z,[["__scopeId","data-v-2a925689"]]),te={class:"debug-result-drawer__header"},oe={class:"debug-result-drawer__header-left"},le={class:"debug-result-drawer__body"},se={class:"debug-result-drawer__content"},ne={class:"debug-result-drawer__result"},ae={key:1,class:"debug-result-drawer__unselected","data-test":"node-unselected"},N=44,$=420,ue=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},viewParamsPending:{type:Boolean,default:!1},offsetLeft:{default:0}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock","viewParams","logsTabActive"],setup(c,{emit:g}){const t=c,s=g,r=e.ref($),m=e.ref(!1);let _=0,p=0,k="",w="";const V=e.computed(()=>({left:`${t.offsetLeft}px`,height:`${t.open?r.value:N}px`})),C=()=>{t.open||(r.value=$),s("update:open",!t.open)},x=i=>{const u=i>N;u!==t.open&&s("update:open",u)},y=i=>{const u=p-(i.clientY-_);r.value=Math.max(N,Math.min(window.innerHeight*.8,u)),x(r.value)},a=()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",a),document.body.style.cursor=k,document.body.style.userSelect=w,m.value=!1,r.value<=N&&(r.value=$,s("update:open",!1))},n=i=>{i.preventDefault(),m.value=!0,_=i.clientY,t.open?p=r.value:(s("update:open",!0),r.value=N,p=N),k=document.body.style.cursor,w=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",y),document.addEventListener("mouseup",a)};e.onBeforeUnmount(a);const v=e.computed({get:()=>t.modelValue,set:i=>s("update:modelValue",i)});e.watch(()=>t.modelValue,i=>{i||s("logsTabActive",!1)},{immediate:!0});const o=e.computed(()=>d.buildDebugResultNodeItems(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),b=e.computed(()=>t.mockNodeIds.has(t.modelValue)),h=e.computed(()=>t.pipelineTree?.activities?.[t.modelValue]?.component),B=e.computed(()=>{const i=o.value.find(u=>u.id===t.modelValue);return i?.type==="ServiceActivity"&&i.isConfigured}),R=()=>{!t.hasGlobalRun||t.viewParamsPending||s("viewParams")},T=()=>{t.modelValue&&s("reEditMock",t.modelValue)},f=()=>{t.modelValue&&s("runReal",t.modelValue)},l=()=>{t.modelValue&&s("runMock",t.modelValue)};return(i,u)=>{const S=e.resolveComponent("bk-button"),E=e.resolveDirective("bk-tooltips");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["debug-result-drawer-wrapper",{"is-resizing":m.value}]),style:e.normalizeStyle(V.value)},[e.createElementVNode("div",{class:"debug-result-drawer__resize",onMousedown:n},null,32),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",te,[e.createElementVNode("div",oe,[u[3]||(u[3]=e.createElementVNode("span",{class:"debug-result-drawer__title"},"调试结果",-1)),u[4]||(u[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:R},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-audit view-params-icon"},null,-1),e.createTextVNode(" 查看参数 ",-1)])]),_:1},8,["disabled","loading"])),[[E,{content:"请先进行调试",disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:C},[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",le,[e.createElementVNode("div",se,[e.createVNode(H,{modelValue:v.value,"onUpdate:modelValue":u[0]||(u[0]=M=>v.value=M),nodes:o.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",ne,[t.modelValue?(e.openBlock(),e.createBlock(ee,{key:0,result:t.result,component:h.value,"is-mock":b.value,"can-run-node-debug":B.value,onReEditMock:T,onRunReal:f,onRunMock:l,onLogsTabActive:u[1]||(u[1]=M=>s("logsTabActive",M))},null,8,["result","component","is-mock","can-run-node-debug"])):(e.openBlock(),e.createElementBlock("div",ae," 请先选择节点查看调试详情 "))])])])],2)],6)}}}),re=d._export_sfc(ue,[["__scopeId","data-v-84a5277a"]]);exports.default=re;