@blueking/bkflow-canvas-editor 1.1.0-beta.12 → 1.1.0-beta.13

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