@blueking/bkflow-canvas-editor 1.1.0-beta.7 → 1.1.0-beta.8
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/dist/{index-Dd4h02gU.js → index-BL3fS0Jt.js} +1 -1
- package/dist/{index-CZfjC730.cjs → index-CC5gBhZo.cjs} +16 -16
- package/dist/{index-BcF6kkh7.cjs → index-Cr1IApLI.cjs} +1 -1
- package/dist/{index-wn9l8l1B.cjs → index-D2oS_A8g.cjs} +1 -1
- package/dist/{index-CIEiIRmL.js → index-DhEdmFv2.js} +4216 -4187
- package/dist/{index-CHSu2qbu.js → index-Z3twZd2j.js} +1 -1
- package/dist/{index-zxp10674.js → index-aTwexVNR.js} +1 -1
- package/dist/{index-CgwIEuPT.cjs → index-j1ZMdQyf.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("lodash"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),p=require("lodash"),i=require("./index-CC5gBhZo.cjs");require("bkui-vue/lib/message");require("bkui-vue/lib/icon");require("monaco-editor");const q={string:"input",text:"input",textarea:"textarea",int:"input",integer:"input",number:"input",float:"input",json:"json",object:"json",array:"array",list:"array",select:"select",time:"timepicker",datetime:"timepicker"},_=t=>t.replace(/^\$\{(.+)\}$/,"$1"),k=t=>`\${${_(t)}}`;function D(t,u){const n=k(t.key),o=u?p.cloneDeep(u):{},c=t.custom_type??o.custom_type??q[t.type]??"input";return{...o,key:n,name:t.name??o.name??_(t.key),custom_type:c,desc:o.desc??"",index:o.index??0,show_type:"show",source_info:o.source_info??{},source_tag:o.source_tag??"",source_type:o.source_type??"custom",validation:o.validation??"",value:t.default??o.value,meta:{...o.meta??{},required:t.required??o.meta?.required??!1}}}function N(t,u={}){if(!t)return{};const n=t.constants;return n&&Object.keys(n).length>0?{...n}:Array.isArray(t.fields)&&t.fields.length>0?t.fields.reduce((o,c)=>{const s=k(c.key);return o[s]=D(c,u[s]),o},{}):{}}const j={class:"global-debug-input"},R={class:"form-params-wrapper"},E={class:"sideslider-footer-buttons"},T=e.defineComponent({__name:"index",props:{show:{type:Boolean},schema:{},pipelineConstants:{default:()=>({})},initialValues:{default:()=>({})},pending:{type:Boolean,default:!1}},emits:["confirm","close","update:show"],setup(t,{emit:u}){const n=t,o=u,c=i.useFlowApiConfig(),s=e.ref({}),h=e.shallowRef([]),d=e.shallowRef([]),m=e.shallowRef(!1),f=e.ref(),v=e.ref(),b=e.computed(()=>h.value.filter(a=>i.isBuiltinUsageVariable(a))),g=e.computed(()=>b.value.length>0||d.value.length>0);e.watch(()=>n.show,a=>{a&&(s.value=p.cloneDeep(n.initialValues??{}),w())});const w=async()=>{const a=N(n.schema,n.pipelineConstants),r=Object.values(a).filter(l=>typeof l=="object"&&l!==null&&l.show_type==="show");if(h.value=r,Object.keys(a).length<1){d.value=[];return}m.value=!0;try{d.value=await i.getInputFormsFromConstants(c,a)}catch(l){console.error("Failed to build debug input forms from schema:",l),d.value=[]}finally{m.value=!1}},V=a=>{s.value={...s.value,...p.cloneDeep(a)}},C=async()=>{const[a,r]=await Promise.all([Promise.resolve(typeof v.value?.validate=="function"?v.value.validate():!0),Promise.resolve(typeof f.value?.validate=="function"?f.value.validate():!0)]);!a||!r||o("confirm",p.cloneDeep(s.value))},y=()=>{o("close"),o("update:show",!1)};return(a,r)=>{const l=e.resolveComponent("bk-button"),x=e.resolveComponent("bk-sideslider"),B=e.resolveDirective("bkloading");return e.openBlock(),e.createBlock(x,{title:"调试参数","is-show":n.show,width:700,"quick-close":!0,"esc-close":!1,onClosed:y},{footer:e.withCtx(()=>[e.createElementVNode("div",E,[e.createVNode(l,{theme:"primary","data-test":"save-and-run",loading:n.pending,onClick:C},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode(" 保存并执行 ",-1)])]),_:1},8,["loading"]),e.createVNode(l,{disabled:n.pending,onClick:y},{default:e.withCtx(()=>[...r[2]||(r[2]=[e.createTextVNode("取消",-1)])]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",R,[b.value.length>0?(e.openBlock(),e.createBlock(e.unref(i.BuiltinVariableUsageForm),{key:0,ref_key:"builtinVariableFormRef",ref:v,modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=F=>s.value=F),variables:b.value,editable:!0},null,8,["modelValue","variables"])):e.createCommentVNode("",!0),d.value.length>0?(e.openBlock(),e.createBlock(i.RenderForm,{key:1,ref_key:"renderFormRef",ref:f,scheme:d.value,editable:!0,"form-option":{showRequired:!0,showGroup:!0,showLabel:!1,showHook:!1,showDesc:!0,formEdit:!0},"form-data":s.value,onChange:V},null,8,["scheme","form-data"])):e.createCommentVNode("",!0),g.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(i.EmptyException,{key:2,title:"暂无参数"}))])])),[[B,{loading:m.value}]])]),_:1},8,["is-show"])}}}),I=i._export_sfc(T,[["__scopeId","data-v-e0e948eb"]]);exports.default=I;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("./index-CZfjC730.cjs"),E=require("./composable-YlUVct40.cjs"),$={class:"debug-result-node-list"},L=["data-node-id","aria-selected","onClick","onKeydown"],G=["title"],P={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},A={key:1,class:"debug-result-node-list__empty"},D=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(n,{emit:r}){const t=n,s=r,u=e.ref(""),a=e.ref("all"),c=e.ref(null),m=[{value:"all",label:"全部"},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#2dcb56"},{value:"failed",icon:"bkflow-canvas-circle-alert-filled",iconColor:"#ea3636"},{value:"running",iconComponent:_.LoadingStatusIcon,iconColor:"#3a84ff"},{value:"suspended",icon:"bkflow-canvas-guaqi",iconColor:"#ff9c01"},{value:"skipped",icon:"bkflow-canvas-tiaoguo",iconColor:"#6e89af"}],v=e.computed(()=>m.map(d=>({...d,count:d.value==="all"?t.nodes.length:t.nodes.filter(i=>i.status===d.value).length}))),b=e.computed(()=>{const d=u.value.trim().toLowerCase();return t.nodes.filter(i=>a.value!=="all"&&i.status!==a.value?!1:d?i.name.toLowerCase().includes(d)||i.type.toLowerCase().includes(d)||(i.typeName??"").toLowerCase().includes(d):!0)}),f={finished:"成功",failed:"失败",running:"正在调试",suspended:"挂起",skipped:"跳过"},y=e.computed(()=>u.value.trim()?"搜索结果为空":a.value!=="all"?`暂无${f[a.value]}状态节点`:"暂无节点"),V=()=>{u.value="",a.value="all"};return e.watch(()=>t.modelValue,async d=>{if(!d)return;!b.value.some(o=>o.id===d)&&t.nodes.some(o=>o.id===d)&&(u.value="",a.value="all",await e.nextTick()),c.value?.querySelector(`[data-node-id="${CSS.escape(d)}"]`)?.scrollIntoView({block:"nearest"})}),(d,i)=>{const l=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",$,[e.createVNode(l,{modelValue:u.value,"onUpdate:modelValue":i[0]||(i[0]=o=>u.value=o),class:"debug-result-node-list__search",placeholder:"搜索节点名称 / 类型",type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue"]),e.createVNode(_.SegmentTabs,{modelValue:a.value,"onUpdate:modelValue":i[1]||(i[1]=o=>a.value=o),class:"debug-result-node-list__filters","data-test":"status-filters",items:v.value},null,8,["modelValue","items"]),b.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:c,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.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:g=>s("update:modelValue",o.id),onKeydown:e.withKeys(e.withModifiers(g=>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.isConfigured&&o.status==="running"?(e.openBlock(),e.createBlock(_.LoadingStatusIcon,{key:0,size:12})):o.icon?(e.openBlock(),e.createElementBlock("i",{key:1,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,G),o.isMock?(e.openBlock(),e.createElementBlock("span",P,"MOCK")):e.createCommentVNode("",!0)],42,L))),128))],512)):(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(_.EmptyException,{"is-search":!1,title:y.value,onClear:V},null,8,["title"])]))])}}}),z=_._export_sfc(D,[["__scopeId","data-v-7088d550"]]);function U(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){const r=n,t=r.message;if(typeof t=="string"&&t){const s=r.type;return typeof s=="string"&&s?`${s}: ${t}`:t}try{return JSON.stringify(n)}catch{return String(n)}}return String(n)}const I={class:"debug-result-tabs"},O={class:"debug-result-tabs__execution","data-test":"tab-execution"},F={class:"debug-result-tabs__row"},j={class:"value"},q={class:"debug-result-tabs__row"},H={class:"value"},Y={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={key:1,class:"debug-result-tabs__error-banner","data-test":"output-error"},Q={key:0,class:"debug-result-tabs__error-text"},X={class:"debug-result-tabs__error-guide"},Z={class:"debug-result-tabs__logs","data-test":"tab-logs"},ee=e.defineComponent({__name:"result-tabs",props:{result:{},isMock:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock"],setup(n,{emit:r}){const t=n,s=r,u=e.ref("execution"),a={not_run:"未调试",running:"正在调试",finished:"成功",failed:"失败",suspended:"挂起",skipped:"跳过"},c=e.computed(()=>a[t.result.execution.status]??t.result.execution.status),m=e.computed(()=>{const i=t.result.execution.durationMs;return i==null?"--":`${(i/1e3).toFixed(1)}s`}),v=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),b=e.computed(()=>t.result.execution.status==="failed"),f=i=>Object.entries(i??{}).map(([l,o])=>({key:l,name:l,value:o})),y=e.computed(()=>f(t.result.inputs)),V=e.computed(()=>f(t.result.outputs)),d=e.computed(()=>t.result.logs==null?"":_.normalizeLogText(t.result.logs));return(i,l)=>{const o=e.resolveComponent("bk-tab-panel"),g=e.resolveComponent("bk-button"),N=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",I,[e.createVNode(N,{active:u.value,"onUpdate:active":l[3]||(l[3]=w=>u.value=w),type:"card-grid"},{default:e.withCtx(()=>[e.createVNode(o,{name:"execution",label:"执行信息"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("div",F,[l[4]||(l[4]=e.createElementVNode("span",{class:"label"},"执行状态",-1)),e.createElementVNode("span",j,e.toDisplayString(c.value),1)]),e.createElementVNode("div",q,[l[5]||(l[5]=e.createElementVNode("span",{class:"label"},"调试用时",-1)),e.createElementVNode("span",H,e.toDisplayString(m.value),1)]),v.value?(e.openBlock(),e.createElementBlock("div",Y,[l[6]||(l[6]=e.createElementVNode("span",{class:"label"},"错误信息",-1)),e.createElementVNode("span",K,e.toDisplayString(v.value),1)])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(o,{name:"inputs",label:"输入参数"},{default:e.withCtx(()=>[e.createVNode(_.DebugValueTable,{rows:y.value,loading:t.result.loading,error:t.result.detailError,"empty-text":"暂无输入参数"},null,8,["rows","loading","error"])]),_:1}),e.createVNode(o,{name:"outputs",label:"输出结果"},{default:e.withCtx(()=>[t.isMock?(e.openBlock(),e.createElementBlock("div",J,[l[8]||(l[8]=e.createElementVNode("span",null,"当前为 Mock 数据",-1)),e.createVNode(g,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:l[0]||(l[0]=w=>s("reEditMock"))},{default:e.withCtx(()=>[...l[7]||(l[7]=[e.createTextVNode(" 重新编辑 ",-1)])]),_:1})])):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createElementBlock("div",W,[v.value?(e.openBlock(),e.createElementBlock("p",Q,e.toDisplayString(v.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",X,[l[11]||(l[11]=e.createElementVNode("span",null,"该节点调试失败,可",-1)),e.createVNode(g,{text:"",theme:"primary","data-test":"rerun-real",onClick:l[1]||(l[1]=w=>s("runReal"))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("重新调试",-1)])]),_:1}),l[12]||(l[12]=e.createElementVNode("span",null,"或直接",-1)),e.createVNode(g,{text:"",theme:"primary","data-test":"run-mock",onClick:l[2]||(l[2]=w=>s("runMock"))},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("Mock 输出",-1)])]),_:1})])])):(e.openBlock(),e.createBlock(_.DebugValueTable,{key:2,rows:V.value,loading:t.result.loading,error:t.result.detailError,"empty-text":"暂无输出结果"},null,8,["rows","loading","error"]))]),_:1}),e.createVNode(o,{name:"logs",label:"调用日志"},{default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(_.CallLogsViewer,{"log-text":d.value,loading:t.result.loading,error:t.result.logError},null,8,["log-text","loading","error"])])]),_:1})]),_:1},8,["active"])])}}}),te=_._export_sfc(ee,[["__scopeId","data-v-99ed168c"]]),oe={ExclusiveGateway:"bkflow-canvas-fenzhiwangguan",ParallelGateway:"bkflow-canvas-bingxingwangguan",ConditionalParallelGateway:"bkflow-canvas-tiaojianbingxingwangguan",ConvergeGateway:"bkflow-canvas-huijuwangguan"},C={ServiceActivity:"任务节点",EmptyStartEvent:"开始节点",EmptyEndEvent:"结束节点",ExclusiveGateway:"分支网关",ParallelGateway:"并行网关",ConditionalParallelGateway:"条件并行网关",ConvergeGateway:"汇聚网关"};function le(n){if(!n.component?.code)return"";if(n.component.code==="uniform_api"){const r=n.component.api_meta?.category?.name??"";return E.PLUGGIN_GROUP_FONT_CLASS_MAP[r]??E.PLUGGIN_GROUP_FONT_CLASS_MAP.bkflow}return E.PLUGGIN_GROUP_FONT_CLASS_MAP.bkflow}function ne(n,r){const t=n?.location?.find(c=>c.id===r),s=t?.icon??"",u=n?.activities?.[r];if(u)return{name:!!u.component?.code?u.name||t?.name||r:"节点未配置",type:u.type||"ServiceActivity",typeName:C[u.type]??"任务节点",icon:le(u)};const a=n?.gateways?.[r];return a?{name:a.name||t?.name||C[a.type]||r,type:a.type,typeName:C[a.type]??"网关",icon:s||oe[a.type]||""}:n?.start_event?.id===r?{name:n.start_event.name||"开始",type:"EmptyStartEvent",typeName:"开始节点",icon:s||"bkflow-canvas-kaishi"}:n?.end_event?.id===r?{name:n.end_event.name||"结束",type:"EmptyEndEvent",typeName:"结束节点",icon:s||"bkflow-canvas-stop"}:t?{name:t.name||r,type:t.type||"",typeName:"",icon:s}:{name:r,type:"",typeName:"",icon:""}}function ae(n,r,t=new Set){const s=n?.activities;if(!s)return[];const u=new Map((r??[]).map(a=>[a.node_id,a.status]));return Object.values(s).map(a=>{const c=!!a.component?.code,m=ne(n,a.id);return{id:a.id,name:m.name,type:m.type||a.type,typeName:m.typeName,icon:m.icon,status:u.get(a.id)??"not_run",isMock:t.has(a.id),isConfigured:c}})}const se={class:"debug-result-drawer__header"},re={class:"debug-result-drawer__header-left"},ue={class:"debug-result-drawer__body"},ie={key:0,class:"debug-result-drawer__params","data-test":"params-panel"},de={class:"debug-result-drawer__params-body"},ce={class:"debug-result-drawer__content"},me={class:"debug-result-drawer__result"},pe=44,_e=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},globalInputs:{default:()=>({})}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock"],setup(n,{emit:r}){const t=n,s=r,u=e.ref(!1),a=u,c=e.ref(420),m=e.ref(!1);let v=0,b=0,f="",y="";const V=e.computed(()=>({height:`${t.open?c.value:pe}px`})),d=()=>{s("update:open",!t.open)},i=k=>{const p=b-(k.clientY-v);c.value=Math.max(200,Math.min(window.innerHeight*.8,p))},l=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),document.body.style.cursor=f,document.body.style.userSelect=y,m.value=!1},o=k=>{k.preventDefault(),m.value=!0,v=k.clientY,b=c.value,f=document.body.style.cursor,y=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",i),document.addEventListener("mouseup",l)};e.onBeforeUnmount(l);const g=e.computed({get:()=>t.modelValue,set:k=>s("update:modelValue",k)}),N=e.computed(()=>ae(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),w=e.computed(()=>t.mockNodeIds.has(t.modelValue)),x=()=>{t.hasGlobalRun&&(u.value=!u.value)},h=()=>{t.modelValue&&s("reEditMock",t.modelValue)},B=()=>{t.modelValue&&s("runReal",t.modelValue)},S=()=>{t.modelValue&&s("runMock",t.modelValue)};return(k,p)=>{const M=e.resolveComponent("bk-button"),T=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)},[t.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"debug-result-drawer__resize",onMousedown:o},null,32)):e.createCommentVNode("",!0),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",se,[e.createElementVNode("div",re,[p[2]||(p[2]=e.createElementVNode("span",{class:"debug-result-drawer__title"},"调试结果",-1)),p[3]||(p[3]=e.createElementVNode("span",{class:"debug-result-drawer__divider"},null,-1)),e.withDirectives((e.openBlock(),e.createBlock(M,{text:"",theme:"primary","data-test":"view-params",disabled:!t.hasGlobalRun,onClick:x},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode(" 查看参数 ",-1)])]),_:1},8,["disabled"])),[[T,{content:"请先进行调试",disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:d},[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",ue,[e.unref(a)?(e.openBlock(),e.createElementBlock("div",ie,[p[4]||(p[4]=e.createElementVNode("div",{class:"debug-result-drawer__params-title"},"本次调试输入参数",-1)),e.createElementVNode("div",de,[e.createVNode(_.DebugJsonViewer,{value:t.globalInputs??{},"default-expanded":!0},null,8,["value"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",ce,[e.createVNode(z,{modelValue:g.value,"onUpdate:modelValue":p[0]||(p[0]=R=>g.value=R),nodes:N.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",me,[e.createVNode(te,{result:t.result,"is-mock":w.value,onReEditMock:h,onRunReal:B,onRunMock:S},null,8,["result","is-mock"])])])])],2)],6)}}}),ve=_._export_sfc(_e,[["__scopeId","data-v-a977e91c"]]);exports.default=ve;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("./index-CC5gBhZo.cjs"),E=require("./composable-YlUVct40.cjs"),$={class:"debug-result-node-list"},L=["data-node-id","aria-selected","onClick","onKeydown"],G=["title"],P={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},A={key:1,class:"debug-result-node-list__empty"},D=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(n,{emit:r}){const t=n,s=r,u=e.ref(""),a=e.ref("all"),c=e.ref(null),m=[{value:"all",label:"全部"},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#2dcb56"},{value:"failed",icon:"bkflow-canvas-circle-alert-filled",iconColor:"#ea3636"},{value:"running",iconComponent:_.LoadingStatusIcon,iconColor:"#3a84ff"},{value:"suspended",icon:"bkflow-canvas-guaqi",iconColor:"#ff9c01"},{value:"skipped",icon:"bkflow-canvas-tiaoguo",iconColor:"#6e89af"}],v=e.computed(()=>m.map(d=>({...d,count:d.value==="all"?t.nodes.length:t.nodes.filter(i=>i.status===d.value).length}))),b=e.computed(()=>{const d=u.value.trim().toLowerCase();return t.nodes.filter(i=>a.value!=="all"&&i.status!==a.value?!1:d?i.name.toLowerCase().includes(d)||i.type.toLowerCase().includes(d)||(i.typeName??"").toLowerCase().includes(d):!0)}),f={finished:"成功",failed:"失败",running:"正在调试",suspended:"挂起",skipped:"跳过"},y=e.computed(()=>u.value.trim()?"搜索结果为空":a.value!=="all"?`暂无${f[a.value]}状态节点`:"暂无节点"),V=()=>{u.value="",a.value="all"};return e.watch(()=>t.modelValue,async d=>{if(!d)return;!b.value.some(o=>o.id===d)&&t.nodes.some(o=>o.id===d)&&(u.value="",a.value="all",await e.nextTick()),c.value?.querySelector(`[data-node-id="${CSS.escape(d)}"]`)?.scrollIntoView({block:"nearest"})}),(d,i)=>{const l=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",$,[e.createVNode(l,{modelValue:u.value,"onUpdate:modelValue":i[0]||(i[0]=o=>u.value=o),class:"debug-result-node-list__search",placeholder:"搜索节点名称 / 类型",type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue"]),e.createVNode(_.SegmentTabs,{modelValue:a.value,"onUpdate:modelValue":i[1]||(i[1]=o=>a.value=o),class:"debug-result-node-list__filters","data-test":"status-filters",items:v.value},null,8,["modelValue","items"]),b.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:c,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.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:g=>s("update:modelValue",o.id),onKeydown:e.withKeys(e.withModifiers(g=>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.isConfigured&&o.status==="running"?(e.openBlock(),e.createBlock(_.LoadingStatusIcon,{key:0,size:12})):o.icon?(e.openBlock(),e.createElementBlock("i",{key:1,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,G),o.isMock?(e.openBlock(),e.createElementBlock("span",P,"MOCK")):e.createCommentVNode("",!0)],42,L))),128))],512)):(e.openBlock(),e.createElementBlock("div",A,[e.createVNode(_.EmptyException,{"is-search":!1,title:y.value,onClear:V},null,8,["title"])]))])}}}),z=_._export_sfc(D,[["__scopeId","data-v-7088d550"]]);function U(n){if(n==null)return"";if(typeof n=="string")return n;if(typeof n=="object"){const r=n,t=r.message;if(typeof t=="string"&&t){const s=r.type;return typeof s=="string"&&s?`${s}: ${t}`:t}try{return JSON.stringify(n)}catch{return String(n)}}return String(n)}const I={class:"debug-result-tabs"},O={class:"debug-result-tabs__execution","data-test":"tab-execution"},F={class:"debug-result-tabs__row"},j={class:"value"},q={class:"debug-result-tabs__row"},H={class:"value"},Y={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={key:1,class:"debug-result-tabs__error-banner","data-test":"output-error"},Q={key:0,class:"debug-result-tabs__error-text"},X={class:"debug-result-tabs__error-guide"},Z={class:"debug-result-tabs__logs","data-test":"tab-logs"},ee=e.defineComponent({__name:"result-tabs",props:{result:{},isMock:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock"],setup(n,{emit:r}){const t=n,s=r,u=e.ref("execution"),a={not_run:"未调试",running:"正在调试",finished:"成功",failed:"失败",suspended:"挂起",skipped:"跳过"},c=e.computed(()=>a[t.result.execution.status]??t.result.execution.status),m=e.computed(()=>{const i=t.result.execution.durationMs;return i==null?"--":`${(i/1e3).toFixed(1)}s`}),v=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),b=e.computed(()=>t.result.execution.status==="failed"),f=i=>Object.entries(i??{}).map(([l,o])=>({key:l,name:l,value:o})),y=e.computed(()=>f(t.result.inputs)),V=e.computed(()=>f(t.result.outputs)),d=e.computed(()=>t.result.logs==null?"":_.normalizeLogText(t.result.logs));return(i,l)=>{const o=e.resolveComponent("bk-tab-panel"),g=e.resolveComponent("bk-button"),N=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",I,[e.createVNode(N,{active:u.value,"onUpdate:active":l[3]||(l[3]=w=>u.value=w),type:"card-grid"},{default:e.withCtx(()=>[e.createVNode(o,{name:"execution",label:"执行信息"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createElementVNode("div",F,[l[4]||(l[4]=e.createElementVNode("span",{class:"label"},"执行状态",-1)),e.createElementVNode("span",j,e.toDisplayString(c.value),1)]),e.createElementVNode("div",q,[l[5]||(l[5]=e.createElementVNode("span",{class:"label"},"调试用时",-1)),e.createElementVNode("span",H,e.toDisplayString(m.value),1)]),v.value?(e.openBlock(),e.createElementBlock("div",Y,[l[6]||(l[6]=e.createElementVNode("span",{class:"label"},"错误信息",-1)),e.createElementVNode("span",K,e.toDisplayString(v.value),1)])):e.createCommentVNode("",!0)])]),_:1}),e.createVNode(o,{name:"inputs",label:"输入参数"},{default:e.withCtx(()=>[e.createVNode(_.DebugValueTable,{rows:y.value,loading:t.result.loading,error:t.result.detailError,"empty-text":"暂无输入参数"},null,8,["rows","loading","error"])]),_:1}),e.createVNode(o,{name:"outputs",label:"输出结果"},{default:e.withCtx(()=>[t.isMock?(e.openBlock(),e.createElementBlock("div",J,[l[8]||(l[8]=e.createElementVNode("span",null,"当前为 Mock 数据",-1)),e.createVNode(g,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:l[0]||(l[0]=w=>s("reEditMock"))},{default:e.withCtx(()=>[...l[7]||(l[7]=[e.createTextVNode(" 重新编辑 ",-1)])]),_:1})])):e.createCommentVNode("",!0),b.value?(e.openBlock(),e.createElementBlock("div",W,[v.value?(e.openBlock(),e.createElementBlock("p",Q,e.toDisplayString(v.value),1)):e.createCommentVNode("",!0),e.createElementVNode("p",X,[l[11]||(l[11]=e.createElementVNode("span",null,"该节点调试失败,可",-1)),e.createVNode(g,{text:"",theme:"primary","data-test":"rerun-real",onClick:l[1]||(l[1]=w=>s("runReal"))},{default:e.withCtx(()=>[...l[9]||(l[9]=[e.createTextVNode("重新调试",-1)])]),_:1}),l[12]||(l[12]=e.createElementVNode("span",null,"或直接",-1)),e.createVNode(g,{text:"",theme:"primary","data-test":"run-mock",onClick:l[2]||(l[2]=w=>s("runMock"))},{default:e.withCtx(()=>[...l[10]||(l[10]=[e.createTextVNode("Mock 输出",-1)])]),_:1})])])):(e.openBlock(),e.createBlock(_.DebugValueTable,{key:2,rows:V.value,loading:t.result.loading,error:t.result.detailError,"empty-text":"暂无输出结果"},null,8,["rows","loading","error"]))]),_:1}),e.createVNode(o,{name:"logs",label:"调用日志"},{default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(_.CallLogsViewer,{"log-text":d.value,loading:t.result.loading,error:t.result.logError},null,8,["log-text","loading","error"])])]),_:1})]),_:1},8,["active"])])}}}),te=_._export_sfc(ee,[["__scopeId","data-v-99ed168c"]]),oe={ExclusiveGateway:"bkflow-canvas-fenzhiwangguan",ParallelGateway:"bkflow-canvas-bingxingwangguan",ConditionalParallelGateway:"bkflow-canvas-tiaojianbingxingwangguan",ConvergeGateway:"bkflow-canvas-huijuwangguan"},C={ServiceActivity:"任务节点",EmptyStartEvent:"开始节点",EmptyEndEvent:"结束节点",ExclusiveGateway:"分支网关",ParallelGateway:"并行网关",ConditionalParallelGateway:"条件并行网关",ConvergeGateway:"汇聚网关"};function le(n){if(!n.component?.code)return"";if(n.component.code==="uniform_api"){const r=n.component.api_meta?.category?.name??"";return E.PLUGGIN_GROUP_FONT_CLASS_MAP[r]??E.PLUGGIN_GROUP_FONT_CLASS_MAP.bkflow}return E.PLUGGIN_GROUP_FONT_CLASS_MAP.bkflow}function ne(n,r){const t=n?.location?.find(c=>c.id===r),s=t?.icon??"",u=n?.activities?.[r];if(u)return{name:!!u.component?.code?u.name||t?.name||r:"节点未配置",type:u.type||"ServiceActivity",typeName:C[u.type]??"任务节点",icon:le(u)};const a=n?.gateways?.[r];return a?{name:a.name||t?.name||C[a.type]||r,type:a.type,typeName:C[a.type]??"网关",icon:s||oe[a.type]||""}:n?.start_event?.id===r?{name:n.start_event.name||"开始",type:"EmptyStartEvent",typeName:"开始节点",icon:s||"bkflow-canvas-kaishi"}:n?.end_event?.id===r?{name:n.end_event.name||"结束",type:"EmptyEndEvent",typeName:"结束节点",icon:s||"bkflow-canvas-stop"}:t?{name:t.name||r,type:t.type||"",typeName:"",icon:s}:{name:r,type:"",typeName:"",icon:""}}function ae(n,r,t=new Set){const s=n?.activities;if(!s)return[];const u=new Map((r??[]).map(a=>[a.node_id,a.status]));return Object.values(s).map(a=>{const c=!!a.component?.code,m=ne(n,a.id);return{id:a.id,name:m.name,type:m.type||a.type,typeName:m.typeName,icon:m.icon,status:u.get(a.id)??"not_run",isMock:t.has(a.id),isConfigured:c}})}const se={class:"debug-result-drawer__header"},re={class:"debug-result-drawer__header-left"},ue={class:"debug-result-drawer__body"},ie={key:0,class:"debug-result-drawer__params","data-test":"params-panel"},de={class:"debug-result-drawer__params-body"},ce={class:"debug-result-drawer__content"},me={class:"debug-result-drawer__result"},pe=44,_e=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},globalInputs:{default:()=>({})}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock"],setup(n,{emit:r}){const t=n,s=r,u=e.ref(!1),a=u,c=e.ref(420),m=e.ref(!1);let v=0,b=0,f="",y="";const V=e.computed(()=>({height:`${t.open?c.value:pe}px`})),d=()=>{s("update:open",!t.open)},i=k=>{const p=b-(k.clientY-v);c.value=Math.max(200,Math.min(window.innerHeight*.8,p))},l=()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",l),document.body.style.cursor=f,document.body.style.userSelect=y,m.value=!1},o=k=>{k.preventDefault(),m.value=!0,v=k.clientY,b=c.value,f=document.body.style.cursor,y=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",i),document.addEventListener("mouseup",l)};e.onBeforeUnmount(l);const g=e.computed({get:()=>t.modelValue,set:k=>s("update:modelValue",k)}),N=e.computed(()=>ae(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),w=e.computed(()=>t.mockNodeIds.has(t.modelValue)),x=()=>{t.hasGlobalRun&&(u.value=!u.value)},h=()=>{t.modelValue&&s("reEditMock",t.modelValue)},B=()=>{t.modelValue&&s("runReal",t.modelValue)},S=()=>{t.modelValue&&s("runMock",t.modelValue)};return(k,p)=>{const M=e.resolveComponent("bk-button"),T=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)},[t.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"debug-result-drawer__resize",onMousedown:o},null,32)):e.createCommentVNode("",!0),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",se,[e.createElementVNode("div",re,[p[2]||(p[2]=e.createElementVNode("span",{class:"debug-result-drawer__title"},"调试结果",-1)),p[3]||(p[3]=e.createElementVNode("span",{class:"debug-result-drawer__divider"},null,-1)),e.withDirectives((e.openBlock(),e.createBlock(M,{text:"",theme:"primary","data-test":"view-params",disabled:!t.hasGlobalRun,onClick:x},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode(" 查看参数 ",-1)])]),_:1},8,["disabled"])),[[T,{content:"请先进行调试",disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:d},[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",ue,[e.unref(a)?(e.openBlock(),e.createElementBlock("div",ie,[p[4]||(p[4]=e.createElementVNode("div",{class:"debug-result-drawer__params-title"},"本次调试输入参数",-1)),e.createElementVNode("div",de,[e.createVNode(_.DebugJsonViewer,{value:t.globalInputs??{},"default-expanded":!0},null,8,["value"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",ce,[e.createVNode(z,{modelValue:g.value,"onUpdate:modelValue":p[0]||(p[0]=R=>g.value=R),nodes:N.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",me,[e.createVNode(te,{result:t.result,"is-mock":w.value,onReEditMock:h,onRunReal:B,onRunMock:S},null,8,["result","is-mock"])])])])],2)],6)}}}),ve=_._export_sfc(_e,[["__scopeId","data-v-a977e91c"]]);exports.default=ve;
|