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

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