@blueking/bkflow-canvas-editor 1.1.0-beta.4 → 1.1.0-beta.41
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/README.md +247 -42
- package/dist/advanced.cjs.js +1 -1
- package/dist/advanced.d.ts +473 -42
- package/dist/advanced.esm.js +8 -3
- package/dist/context-C3QIuIf6.cjs +5 -0
- package/dist/context-De9a4Qek.js +1507 -0
- package/dist/index-9BCO-loN.js +533 -0
- package/dist/index-A1xVRjtJ.cjs +1 -0
- package/dist/index-B1ybORjU.js +55768 -0
- package/dist/index-BwF4LXst.cjs +1 -0
- package/dist/index-CjCy-0c0.js +236 -0
- package/dist/index-RacKW0MR.js +168 -0
- package/dist/index-bzXGuf5c.cjs +1 -0
- package/dist/index-iB9uV7YQ.cjs +85 -0
- package/dist/index.cjs.js +1 -70
- package/dist/index.d.ts +969 -112
- package/dist/index.esm.js +48 -45880
- package/dist/style.css +1 -1
- package/dist/style.d.ts +2 -0
- package/package.json +13 -7
- package/dist/composable-CmXOtkXh.js +0 -441
- package/dist/composable-CtSJfiSD.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("./context-C3QIuIf6.cjs");const c=require("./index-iB9uV7YQ.cjs"),o=require("@blueking/flow-canvas"),L={class:"debug-result-node-list"},z=["data-node-id","aria-selected","onClick","onKeydown"],P=["title"],I={key:0,class:"debug-result-node-list__mock","data-test":"node-mock-flag"},H={key:1,class:"debug-result-node-list__empty"},A=e.defineComponent({__name:"node-list",props:{nodes:{},modelValue:{default:""}},emits:["update:modelValue"],setup(m,{emit:_}){const t=m,n=_,u=e.ref(""),v=e.ref("all"),y=e.ref(null);function g(){return{not_run:o.t("未执行"),finished:o.t("成功"),failed:o.t("失败"),running:o.t("正在调试"),suspended:o.t("挂起"),skipped:o.t("跳过"),revoked:o.t("终止")}}const V=e.computed(()=>{const s=g();return[{value:"all",label:o.t("全部")},{value:"finished",icon:"bkflow-canvas-dark-circle-checkbox",iconColor:"#5fb8ac",tooltip:s.finished},{value:"failed",icon:"bkflow-canvas-dark-circle-close",iconColor:"#fa4e41",tooltip:s.failed},{value:"revoked",icon:"bkflow-canvas-stop-fill",iconColor:"#fa4e41",tooltip:s.revoked},{value:"running",iconComponent:c.LoadingStatusIcon,iconColor:"#3a84ff",tooltip:s.running},{value:"not_run",icon:"bkflow-canvas-weizhixing2",iconColor:"#b8bbc4",tooltip:s.not_run},{value:"suspended",icon:"bkflow-canvas-zanting",iconColor:"#f59500",tooltip:s.suspended},{value:"skipped",icon:"bkflow-canvas-tiaoguo2",iconColor:"#6e89af",tooltip:s.skipped}].map(d=>({...d,count:d.value==="all"?t.nodes.length:t.nodes.filter(l=>l.status===d.value).length}))}),k=e.computed(()=>{const s=u.value.trim().toLowerCase();return t.nodes.filter(a=>v.value!=="all"&&a.status!==v.value?!1:s?a.name.toLowerCase().includes(s)||a.type.toLowerCase().includes(s)||(a.typeName??"").toLowerCase().includes(s):!0)}),N=e.computed(()=>{if(u.value.trim())return o.t("搜索结果为空");if(v.value!=="all"){const s=g()[v.value];if(s)return o.t("暂无{status}状态节点",{status:s})}return o.t("暂无节点")}),E=()=>{u.value="",v.value="all"},x=s=>{const a=y.value,d=a?.querySelector(`[data-node-id="${CSS.escape(s)}"]`);if(!a||!d)return;const l=a.getBoundingClientRect(),f=d.getBoundingClientRect();f.top<l.top?a.scrollTop-=l.top-f.top:f.bottom>l.bottom&&(a.scrollTop+=f.bottom-l.bottom)};return e.watch(()=>t.modelValue,async s=>{if(!s)return;!k.value.some(d=>d.id===s)&&t.nodes.some(d=>d.id===s)&&(u.value="",v.value="all"),await e.nextTick(),x(s)},{flush:"post"}),(s,a)=>{const d=e.resolveComponent("bk-input");return e.openBlock(),e.createElementBlock("aside",L,[e.createVNode(d,{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=l=>u.value=l),class:"debug-result-node-list__search",placeholder:e.unref(o.t)("搜索节点名称 / 类型"),type:"search",clearable:"","data-test":"node-search"},null,8,["modelValue","placeholder"]),e.createVNode(c.SegmentTabs,{modelValue:v.value,"onUpdate:modelValue":a[1]||(a[1]=l=>v.value=l),class:"debug-result-node-list__filters","data-test":"status-filters",items:V.value},null,8,["modelValue","items"]),k.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"itemsRef",ref:y,class:"debug-result-node-list__items",role:"listbox"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,l=>(e.openBlock(),e.createElementBlock("div",{key:l.id,class:e.normalizeClass(["debug-result-node-list__item",`is-${l.status}`,{"is-active":l.id===t.modelValue,"is-unconfigured":!l.isConfigured}]),role:"option","data-test":"node-item","data-node-id":l.id,"aria-selected":l.id===t.modelValue,tabindex:"0",onClick:f=>n("update:modelValue",l.id),onKeydown:e.withKeys(e.withModifiers(f=>n("update:modelValue",l.id),["prevent"]),["enter","space"])},[e.createElementVNode("span",{class:e.normalizeClass(["debug-result-node-list__status",`is-${l.status}`,{"is-placeholder":!l.isConfigured}])},[l.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(l.icon),"data-test":"node-icon"},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",{class:"debug-result-node-list__name",title:l.isConfigured?`${l.name} ${l.typeName||l.type}`:l.name},e.toDisplayString(l.name),9,P),l.isMock?(e.openBlock(),e.createElementBlock("span",I,"MOCK")):e.createCommentVNode("",!0)],42,z))),128))],512)):(e.openBlock(),e.createElementBlock("div",H,[e.createVNode(c.EmptyException,{"is-search":!1,title:N.value,onClear:E},null,8,["title"])]))])}}}),O=c._export_sfc(A,[["__scopeId","data-v-0e33e88b"]]);function U(m){if(m==null)return"";if(typeof m=="string")return m;if(typeof m=="object"){const _=m,t=_.message;if(typeof t=="string"&&t){const n=_.type;return typeof n=="string"&&n?`${n}: ${t}`:t}try{return JSON.stringify(m)}catch{return String(m)}}return String(m)}const G={class:"debug-result-tabs"},q={class:"debug-result-tabs__failed-actions","data-test":"output-error-actions"},F={class:"debug-result-tabs__execution","data-test":"tab-execution"},K={class:"debug-result-tabs__row"},j={class:"label"},Y={class:"value"},J={class:"debug-result-tabs__row"},Q={class:"label"},W={class:"value"},X={key:0,class:"debug-result-tabs__row is-error"},Z={class:"label"},ee={class:"value"},te={class:"debug-result-tabs__mock-hint","data-test":"mock-banner"},oe={class:"debug-result-tabs__logs","data-test":"tab-logs"},le=e.defineComponent({__name:"result-tabs",props:{result:{},component:{},isMock:{type:Boolean,default:!1},canRunNodeDebug:{type:Boolean,default:!1}},emits:["reEditMock","runReal","runMock","logsTabActive"],setup(m,{emit:_}){const t=m,n=_,u=e.ref("execution");e.watch(u,b=>n("logsTabActive",b==="logs"),{immediate:!0});function v(){return{not_run:o.t("未调试"),running:o.t("正在调试"),finished:o.t("成功"),failed:o.t("失败"),suspended:o.t("挂起"),skipped:o.t("跳过"),revoked:o.t("已终止")}}const y=e.computed(()=>v()[t.result.execution.status]??t.result.execution.status),g=e.computed(()=>c.formatSummaryDuration(t.result.execution.durationMs)),V=e.computed(()=>U(t.result.error||t.result.execution.errorDetail)),k=e.computed(()=>t.result.execution.status==="revoked"),N=e.computed(()=>c.isDebugAbnormalStatus(t.result.execution.status)),E=e.computed(()=>k.value?o.t("该节点调试已终止,可"):o.t("该节点执行失败,可")),{loading:x,error:s,visibleInputs:a,visibleOutputs:d,outputNameMap:l}=c.usePluginParamMeta({component:()=>t.component}),f=e.computed(()=>t.result.loading||x.value),C=e.computed(()=>t.result.detailError||s.value),S=e.computed(()=>a.value.filter(({key:b})=>Object.prototype.hasOwnProperty.call(t.result.inputs,b)).map(({key:b,name:p})=>({key:b,name:p,value:t.result.inputs[b]}))),B=e.computed(()=>c.orderDebugRowsByDeclaredKeys(c.toDebugOutputValueRows(t.result.outputs,l.value),d.value.map(b=>b.key))),R=e.computed(()=>c.shouldShowMockReEditHint(t.isMock,d.value)),D=e.computed(()=>t.result.logs==null?"":c.normalizeLogText(t.result.logs));return(b,p)=>{const i=e.resolveComponent("bk-button"),r=e.resolveComponent("bk-tab-panel"),M=e.resolveComponent("bk-tab");return e.openBlock(),e.createElementBlock("div",G,[e.createVNode(M,{active:u.value,"onUpdate:active":p[3]||(p[3]=w=>u.value=w),type:"card-grid"},e.createSlots({default:e.withCtx(()=>[e.createVNode(r,{name:"execution",label:e.unref(o.t)("执行信息")},{default:e.withCtx(()=>[e.createElementVNode("div",F,[e.createElementVNode("div",K,[e.createElementVNode("span",j,e.toDisplayString(e.unref(o.t)("执行状态")),1),e.createElementVNode("span",Y,e.toDisplayString(y.value),1)]),e.createElementVNode("div",J,[e.createElementVNode("span",Q,e.toDisplayString(e.unref(o.t)("调试用时")),1),e.createElementVNode("span",W,e.toDisplayString(g.value),1)]),V.value?(e.openBlock(),e.createElementBlock("div",X,[e.createElementVNode("span",Z,e.toDisplayString(e.unref(o.t)("错误信息")),1),e.createElementVNode("span",ee,e.toDisplayString(V.value),1)])):e.createCommentVNode("",!0)])]),_:1},8,["label"]),e.createVNode(r,{name:"inputs",label:e.unref(o.t)("输入参数")},{default:e.withCtx(()=>[e.createVNode(c.DebugValueTable,{rows:S.value,loading:f.value,error:C.value,"empty-text":e.unref(o.t)("暂无输入参数")},null,8,["rows","loading","error","empty-text"])]),_:1},8,["label"]),e.createVNode(r,{name:"outputs",label:e.unref(o.t)("输出结果")},{default:e.withCtx(()=>[e.createVNode(c.DebugValueTable,{rows:B.value,loading:f.value,error:C.value,"empty-text":e.unref(o.t)("暂无输出结果")},e.createSlots({_:2},[R.value?{name:"toolbar",fn:e.withCtx(()=>[e.createElementVNode("div",te,[p[5]||(p[5]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-info debug-result-tabs__mock-info","aria-hidden":"true"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(e.unref(o.t)("当前为 Mock 数据")),1),e.createVNode(i,{text:"",theme:"primary",size:"small","data-test":"re-edit-mock",onClick:p[2]||(p[2]=w=>n("reEditMock"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o.t)("重新编辑")),1)]),_:1})])]),key:"0"}:void 0]),1032,["rows","loading","error","empty-text"])]),_:1},8,["label"]),e.createVNode(r,{name:"logs",label:e.unref(o.t)("调用日志")},{default:e.withCtx(()=>[e.createElementVNode("div",oe,[e.createVNode(c.CallLogsViewer,{"log-text":D.value,loading:t.result.logLoading,error:t.result.logError},null,8,["log-text","loading","error"])])]),_:1},8,["label"])]),_:2},[N.value&&t.canRunNodeDebug?{name:"setting",fn:e.withCtx(()=>[e.createElementVNode("div",q,[p[4]||(p[4]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-alert"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(E.value),1),e.createVNode(i,{text:"",theme:"primary","data-test":"rerun-real",onClick:p[0]||(p[0]=w=>n("runReal"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o.t)("重新调试")),1)]),_:1}),e.createElementVNode("span",null,e.toDisplayString(e.unref(o.t)("或直接")),1),e.createVNode(i,{text:"",theme:"primary","data-test":"run-mock",onClick:p[1]||(p[1]=w=>n("runMock"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o.t)("Mock 输出")),1)]),_:1})])]),key:"0"}:void 0]),1032,["active"])])}}}),se=c._export_sfc(le,[["__scopeId","data-v-92a716a1"]]),ne={class:"debug-result-drawer__header"},ae={class:"debug-result-drawer__header-left"},re={class:"debug-result-drawer__title"},ue={class:"debug-result-drawer__body"},ie={class:"debug-result-drawer__content"},de={class:"debug-result-drawer__result"},ce={key:1,class:"debug-result-drawer__unselected","data-test":"node-unselected"},h=44,$=420,pe=e.defineComponent({__name:"index",props:{open:{type:Boolean},context:{},pipelineTree:{},mockNodeIds:{},modelValue:{default:""},result:{},hasGlobalRun:{type:Boolean,default:!1},viewParamsPending:{type:Boolean,default:!1},offsetLeft:{default:0}},emits:["update:open","update:modelValue","reEditMock","runReal","runMock","viewParams","logsTabActive"],setup(m,{emit:_}){const t=m,n=_,u=e.ref($),v=e.ref(!1);let y=0,g=0,V="",k="";const N=e.computed(()=>({left:`${t.offsetLeft}px`,height:`${t.open?u.value:h}px`})),E=()=>{t.open||(u.value=$),n("update:open",!t.open)},x=i=>{const r=i>h;r!==t.open&&n("update:open",r)},s=i=>{const r=g-(i.clientY-y);u.value=Math.max(h,Math.min(window.innerHeight*.8,r)),x(u.value)},a=()=>{document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),document.body.style.cursor=V,document.body.style.userSelect=k,v.value=!1,u.value<=h&&(u.value=$,n("update:open",!1))},d=i=>{i.preventDefault(),v.value=!0,y=i.clientY,t.open?g=u.value:(n("update:open",!0),u.value=h,g=h),V=document.body.style.cursor,k=document.body.style.userSelect,document.body.style.cursor="ns-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)};e.onBeforeUnmount(a);const l=e.computed({get:()=>t.modelValue,set:i=>n("update:modelValue",i)});e.watch(()=>t.modelValue,i=>{i||n("logsTabActive",!1)},{immediate:!0});const f=e.computed(()=>c.buildDebugResultNodeItems(t.pipelineTree,t.context?.nodes,t.mockNodeIds)),C=e.computed(()=>t.mockNodeIds.has(t.modelValue)),S=e.computed(()=>t.pipelineTree?.activities?.[t.modelValue]?.component),B=e.computed(()=>{const i=f.value.find(r=>r.id===t.modelValue);return i?.type==="ServiceActivity"&&i.isConfigured}),R=()=>{!t.hasGlobalRun||t.viewParamsPending||n("viewParams")},D=()=>{t.modelValue&&n("reEditMock",t.modelValue)},b=()=>{t.modelValue&&n("runReal",t.modelValue)},p=()=>{t.modelValue&&n("runMock",t.modelValue)};return(i,r)=>{const M=e.resolveComponent("bk-button"),w=e.resolveDirective("bk-tooltips");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["debug-result-drawer-wrapper",{"is-resizing":v.value}]),style:e.normalizeStyle(N.value)},[e.createElementVNode("div",{class:"debug-result-drawer__resize",onMousedown:d},null,32),e.createElementVNode("section",{class:e.normalizeClass(["debug-result-drawer",{"is-collapsed":!t.open}])},[e.createElementVNode("header",ne,[e.createElementVNode("div",ae,[e.createElementVNode("span",re,e.toDisplayString(e.unref(o.t)("调试结果")),1),r[3]||(r[3]=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:R},{default:e.withCtx(()=>[r[2]||(r[2]=e.createElementVNode("i",{class:"bkflow-canvas-icon bkflow-canvas-audit view-params-icon"},null,-1)),e.createTextVNode(" "+e.toDisplayString(e.unref(o.t)("查看参数")),1)]),_:1},8,["disabled","loading"])),[[w,{content:e.unref(o.t)("请先进行调试"),disabled:t.hasGlobalRun}]])]),e.createElementVNode("span",{class:"debug-result-drawer__collapse",onClick:E},[e.createElementVNode("span",null,e.toDisplayString(t.open?e.unref(o.t)("收起"):e.unref(o.t)("展开")),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.createElementVNode("div",ie,[e.createVNode(O,{modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=T=>l.value=T),nodes:f.value},null,8,["modelValue","nodes"]),e.createElementVNode("div",de,[t.modelValue?(e.openBlock(),e.createBlock(se,{key:0,result:t.result,component:S.value,"is-mock":C.value,"can-run-node-debug":B.value,onReEditMock:D,onRunReal:b,onRunMock:p,onLogsTabActive:r[1]||(r[1]=T=>n("logsTabActive",T))},null,8,["result","component","is-mock","can-run-node-debug"])):(e.openBlock(),e.createElementBlock("div",ce,e.toDisplayString(e.unref(o.t)("请先选择节点查看调试详情")),1))])])])],2)],6)}}}),me=c._export_sfc(pe,[["__scopeId","data-v-7394b019"]]);exports.default=me;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { defineComponent as K, ref as F, shallowRef as D, computed as j, watch as S, resolveComponent as E, resolveDirective as G, openBlock as l, createBlock as v, unref as c, createSlots as H, withCtx as h, withDirectives as J, createElementBlock as d, createElementVNode as i, toDisplayString as p, createCommentVNode as b, Fragment as Y, renderList as z, createVNode as L, createTextVNode as I } from "vue";
|
|
2
|
+
import "./context-De9a4Qek.js";
|
|
3
|
+
import { c as g, u as M, i as Q, b as W, d as X, g as Z, D as ee, B as te, R as ae, E as oe, _ as se } from "./index-B1ybORjU.js";
|
|
4
|
+
import "bkui-vue/lib/message";
|
|
5
|
+
import "bkui-vue/lib/icon";
|
|
6
|
+
import "monaco-editor";
|
|
7
|
+
import { t as m } from "@blueking/flow-canvas";
|
|
8
|
+
const ne = {
|
|
9
|
+
string: "input",
|
|
10
|
+
text: "input",
|
|
11
|
+
textarea: "textarea",
|
|
12
|
+
int: "input",
|
|
13
|
+
integer: "input",
|
|
14
|
+
number: "input",
|
|
15
|
+
float: "input",
|
|
16
|
+
json: "json",
|
|
17
|
+
object: "json",
|
|
18
|
+
array: "array",
|
|
19
|
+
list: "array",
|
|
20
|
+
select: "select",
|
|
21
|
+
time: "timepicker",
|
|
22
|
+
datetime: "timepicker"
|
|
23
|
+
}, O = (t) => t.replace(/^\$\{(.+)\}$/, "$1"), q = (t) => `\${${O(t)}}`;
|
|
24
|
+
function le(t, f) {
|
|
25
|
+
const o = q(t.key), a = f ? g(f) : {}, y = t.custom_type ?? a.custom_type ?? ne[t.type] ?? "input";
|
|
26
|
+
return {
|
|
27
|
+
...a,
|
|
28
|
+
key: o,
|
|
29
|
+
name: t.name ?? a.name ?? O(t.key),
|
|
30
|
+
custom_type: y,
|
|
31
|
+
desc: a.desc ?? "",
|
|
32
|
+
index: a.index ?? 0,
|
|
33
|
+
show_type: "show",
|
|
34
|
+
source_info: a.source_info ?? {},
|
|
35
|
+
source_tag: a.source_tag ?? "",
|
|
36
|
+
source_type: a.source_type ?? "custom",
|
|
37
|
+
validation: a.validation ?? "",
|
|
38
|
+
value: t.default ?? a.value,
|
|
39
|
+
meta: {
|
|
40
|
+
...a.meta ?? {},
|
|
41
|
+
required: t.required ?? a.meta?.required ?? !1
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function ie(t, f = {}) {
|
|
46
|
+
if (!t) return {};
|
|
47
|
+
const o = t.constants;
|
|
48
|
+
return o && Object.keys(o).length > 0 ? { ...o } : Array.isArray(t.fields) && t.fields.length > 0 ? t.fields.reduce((a, y) => {
|
|
49
|
+
const s = q(y.key);
|
|
50
|
+
return a[s] = le(y, f[s]), a;
|
|
51
|
+
}, {}) : {};
|
|
52
|
+
}
|
|
53
|
+
const re = { class: "global-debug-input" }, ue = {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "global-debug-input__params",
|
|
56
|
+
"data-test": "input-params"
|
|
57
|
+
}, ce = { class: "col-name" }, de = { class: "col-value" }, pe = { key: 0 }, me = {
|
|
58
|
+
class: "global-debug-input__empty",
|
|
59
|
+
colspan: "2"
|
|
60
|
+
}, fe = ["title"], ye = { class: "col-value" }, _e = {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "global-debug-input__value"
|
|
63
|
+
}, ve = {
|
|
64
|
+
key: 1,
|
|
65
|
+
class: "form-params-wrapper"
|
|
66
|
+
}, he = { class: "sideslider-footer-buttons" }, be = /* @__PURE__ */ K({
|
|
67
|
+
__name: "index",
|
|
68
|
+
props: {
|
|
69
|
+
show: { type: Boolean },
|
|
70
|
+
schema: {},
|
|
71
|
+
pipelineConstants: { default: () => ({}) },
|
|
72
|
+
initialValues: { default: () => ({}) },
|
|
73
|
+
pending: { type: Boolean, default: !1 },
|
|
74
|
+
readonly: { type: Boolean, default: !1 }
|
|
75
|
+
},
|
|
76
|
+
emits: ["confirm", "close", "update:show"],
|
|
77
|
+
setup(t, { emit: f }) {
|
|
78
|
+
const o = t, a = f, y = M(), s = F({}), k = D([]), _ = D([]), w = D(!1), V = F(), x = F(), C = j(() => k.value.filter((e) => Q(e))), N = j(() => C.value.length > 0 || _.value.length > 0), B = j(
|
|
79
|
+
() => [...k.value].sort((e, n) => (e.index ?? 0) - (n.index ?? 0)).map((e) => {
|
|
80
|
+
const n = Object.prototype.hasOwnProperty.call(s.value, e.key) ? s.value[e.key] : e.value;
|
|
81
|
+
return {
|
|
82
|
+
key: e.key,
|
|
83
|
+
name: e.name || e.key,
|
|
84
|
+
value: n,
|
|
85
|
+
display: X(n),
|
|
86
|
+
isComplex: W(n)
|
|
87
|
+
};
|
|
88
|
+
})
|
|
89
|
+
);
|
|
90
|
+
S(
|
|
91
|
+
() => o.show,
|
|
92
|
+
(e) => {
|
|
93
|
+
e && (s.value = g(o.initialValues ?? {}), P());
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
const P = async () => {
|
|
97
|
+
const e = ie(o.schema, o.pipelineConstants), n = Object.values(e).filter(
|
|
98
|
+
(r) => typeof r == "object" && r !== null && r.show_type === "show"
|
|
99
|
+
);
|
|
100
|
+
if (k.value = n, o.readonly || Object.keys(e).length < 1) {
|
|
101
|
+
_.value = [];
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
w.value = !0;
|
|
105
|
+
try {
|
|
106
|
+
_.value = await Z(y, e);
|
|
107
|
+
} catch (r) {
|
|
108
|
+
console.error("Failed to build debug input forms from schema:", r), _.value = [];
|
|
109
|
+
} finally {
|
|
110
|
+
w.value = !1;
|
|
111
|
+
}
|
|
112
|
+
}, T = (e) => {
|
|
113
|
+
s.value = { ...s.value, ...g(e) };
|
|
114
|
+
}, $ = async () => {
|
|
115
|
+
const [e, n] = await Promise.all([
|
|
116
|
+
Promise.resolve(
|
|
117
|
+
typeof x.value?.validate == "function" ? x.value.validate() : !0
|
|
118
|
+
),
|
|
119
|
+
Promise.resolve(typeof V.value?.validate == "function" ? V.value.validate() : !0)
|
|
120
|
+
]);
|
|
121
|
+
!e || !n || a("confirm", g(s.value));
|
|
122
|
+
}, R = () => {
|
|
123
|
+
a("close"), a("update:show", !1);
|
|
124
|
+
};
|
|
125
|
+
return (e, n) => {
|
|
126
|
+
const r = E("bk-button"), A = E("bk-sideslider"), U = G("bkloading");
|
|
127
|
+
return l(), v(A, {
|
|
128
|
+
title: c(m)("调试参数"),
|
|
129
|
+
"is-show": o.show,
|
|
130
|
+
width: 960,
|
|
131
|
+
"quick-close": !0,
|
|
132
|
+
"esc-close": !1,
|
|
133
|
+
onClosed: R
|
|
134
|
+
}, H({
|
|
135
|
+
default: h(() => [
|
|
136
|
+
J((l(), d("div", re, [
|
|
137
|
+
o.readonly ? (l(), d("table", ue, [
|
|
138
|
+
i("thead", null, [
|
|
139
|
+
i("tr", null, [
|
|
140
|
+
i("th", ce, p(c(m)("参数名")), 1),
|
|
141
|
+
i("th", de, p(c(m)("参数值")), 1)
|
|
142
|
+
])
|
|
143
|
+
]),
|
|
144
|
+
i("tbody", null, [
|
|
145
|
+
B.value.length === 0 ? (l(), d("tr", pe, [
|
|
146
|
+
i("td", me, p(c(m)("暂无参数")), 1)
|
|
147
|
+
])) : b("", !0),
|
|
148
|
+
(l(!0), d(Y, null, z(B.value, (u) => (l(), d("tr", {
|
|
149
|
+
key: u.key,
|
|
150
|
+
"data-test": "input-row"
|
|
151
|
+
}, [
|
|
152
|
+
i("td", {
|
|
153
|
+
class: "col-name",
|
|
154
|
+
title: u.key
|
|
155
|
+
}, p(u.name), 9, fe),
|
|
156
|
+
i("td", ye, [
|
|
157
|
+
u.isComplex ? (l(), v(ee, {
|
|
158
|
+
key: 0,
|
|
159
|
+
value: u.value,
|
|
160
|
+
"data-test": "json-viewer"
|
|
161
|
+
}, null, 8, ["value"])) : (l(), d("pre", _e, p(u.display), 1))
|
|
162
|
+
])
|
|
163
|
+
]))), 128))
|
|
164
|
+
])
|
|
165
|
+
])) : (l(), d("div", ve, [
|
|
166
|
+
C.value.length > 0 ? (l(), v(c(te), {
|
|
167
|
+
key: 0,
|
|
168
|
+
ref_key: "builtinVariableFormRef",
|
|
169
|
+
ref: x,
|
|
170
|
+
modelValue: s.value,
|
|
171
|
+
"onUpdate:modelValue": n[0] || (n[0] = (u) => s.value = u),
|
|
172
|
+
variables: C.value
|
|
173
|
+
}, null, 8, ["modelValue", "variables"])) : b("", !0),
|
|
174
|
+
_.value.length > 0 ? (l(), v(ae, {
|
|
175
|
+
key: 1,
|
|
176
|
+
ref_key: "renderFormRef",
|
|
177
|
+
ref: V,
|
|
178
|
+
scheme: _.value,
|
|
179
|
+
editable: "",
|
|
180
|
+
"form-option": {
|
|
181
|
+
showRequired: !0,
|
|
182
|
+
showGroup: !0,
|
|
183
|
+
showLabel: !1,
|
|
184
|
+
showHook: !1,
|
|
185
|
+
showDesc: !0,
|
|
186
|
+
formEdit: !0
|
|
187
|
+
},
|
|
188
|
+
"form-data": s.value,
|
|
189
|
+
onChange: T
|
|
190
|
+
}, null, 8, ["scheme", "form-data"])) : b("", !0),
|
|
191
|
+
N.value ? b("", !0) : (l(), v(oe, {
|
|
192
|
+
key: 2,
|
|
193
|
+
title: c(m)("暂无参数")
|
|
194
|
+
}, null, 8, ["title"]))
|
|
195
|
+
]))
|
|
196
|
+
])), [
|
|
197
|
+
[U, { loading: w.value }]
|
|
198
|
+
])
|
|
199
|
+
]),
|
|
200
|
+
_: 2
|
|
201
|
+
}, [
|
|
202
|
+
o.readonly ? void 0 : {
|
|
203
|
+
name: "footer",
|
|
204
|
+
fn: h(() => [
|
|
205
|
+
i("div", he, [
|
|
206
|
+
L(r, {
|
|
207
|
+
theme: "primary",
|
|
208
|
+
"data-test": "save-and-run",
|
|
209
|
+
loading: o.pending,
|
|
210
|
+
onClick: $
|
|
211
|
+
}, {
|
|
212
|
+
default: h(() => [
|
|
213
|
+
I(p(c(m)("保存并执行")), 1)
|
|
214
|
+
]),
|
|
215
|
+
_: 1
|
|
216
|
+
}, 8, ["loading"]),
|
|
217
|
+
L(r, {
|
|
218
|
+
disabled: o.pending,
|
|
219
|
+
onClick: R
|
|
220
|
+
}, {
|
|
221
|
+
default: h(() => [
|
|
222
|
+
I(p(c(m)("取消")), 1)
|
|
223
|
+
]),
|
|
224
|
+
_: 1
|
|
225
|
+
}, 8, ["disabled"])
|
|
226
|
+
])
|
|
227
|
+
]),
|
|
228
|
+
key: "0"
|
|
229
|
+
}
|
|
230
|
+
]), 1032, ["title", "is-show"]);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
}), De = /* @__PURE__ */ se(be, [["__scopeId", "data-v-8eaa2ef7"]]);
|
|
234
|
+
export {
|
|
235
|
+
De as default
|
|
236
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { defineComponent as A, ref as v, shallowRef as L, computed as C, watch as P, resolveComponent as _, resolveDirective as W, openBlock as r, createBlock as y, withCtx as u, withDirectives as G, createElementBlock as h, Fragment as H, renderList as K, createVNode as w, createCommentVNode as x, createElementVNode as F, createTextVNode as M, toDisplayString as b, unref as O } from "vue";
|
|
2
|
+
import "./context-De9a4Qek.js";
|
|
3
|
+
import { InfoBox as Q } from "bkui-vue/lib";
|
|
4
|
+
import X from "bkui-vue/lib/message";
|
|
5
|
+
import { u as Y, c as Z, M as $, p as ee, m as te, h as oe, r as B, f as se, a as ae, _ as ne } from "./index-B1ybORjU.js";
|
|
6
|
+
import { t as s } from "@blueking/flow-canvas";
|
|
7
|
+
const le = { class: "mock-data-sideslider__title" }, re = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "mock-data-sideslider__title-sep"
|
|
10
|
+
}, ce = ["title"], ie = { class: "mock-data-sideslider" }, ue = { class: "mock-data-sideslider__footer" }, de = /* @__PURE__ */ A({
|
|
11
|
+
__name: "index",
|
|
12
|
+
props: {
|
|
13
|
+
show: { type: Boolean },
|
|
14
|
+
node: { default: null },
|
|
15
|
+
outputs: { default: () => ({}) },
|
|
16
|
+
pending: { type: Boolean, default: !1 }
|
|
17
|
+
},
|
|
18
|
+
emits: ["confirm", "close", "update:show"],
|
|
19
|
+
setup(D, { emit: j }) {
|
|
20
|
+
const t = D, k = j, E = Y(), f = v(!1), d = L([]), m = v({}), g = v({}), p = v(!1), T = C(
|
|
21
|
+
() => p.value ? s("当前节点的输出不支持mock,是否需要在调试时跳过当前节点?") : s("暂无输出结果")
|
|
22
|
+
), N = C(
|
|
23
|
+
() => p.value ? s("跳过调试") : s("确定")
|
|
24
|
+
), R = async () => {
|
|
25
|
+
if (t.node) {
|
|
26
|
+
f.value = !0, g.value = {}, p.value = !1;
|
|
27
|
+
try {
|
|
28
|
+
const e = await ee(E, t.node.component);
|
|
29
|
+
d.value = te(e.outputs ?? []), p.value = oe(e.outputs);
|
|
30
|
+
const l = t.outputs ?? {}, a = {};
|
|
31
|
+
d.value.forEach((o) => {
|
|
32
|
+
const c = Object.prototype.hasOwnProperty.call(l, o.key) ? l[o.key] : o.type === "object" ? {} : void 0, n = B(o);
|
|
33
|
+
a[o.key] = n === "json-editor" || n === "data-table" ? se(c) : c;
|
|
34
|
+
}), m.value = a;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
console.error(e), d.value = [], m.value = {}, p.value = !1, X({ theme: "error", message: s("加载输出结果失败") });
|
|
37
|
+
} finally {
|
|
38
|
+
f.value = !1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, q = () => {
|
|
42
|
+
const e = {}, l = {};
|
|
43
|
+
return d.value.forEach((a) => {
|
|
44
|
+
const o = m.value[a.key], c = B(a);
|
|
45
|
+
if (c === "json-editor" || c === "data-table") {
|
|
46
|
+
const n = ae(o);
|
|
47
|
+
if (!n.valid) {
|
|
48
|
+
e[a.key] = n.message;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
n.value !== void 0 && (l[a.key] = n.value);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
o !== void 0 && o !== "" && (l[a.key] = o);
|
|
55
|
+
}), { errors: e, outputs: l };
|
|
56
|
+
}, I = (e) => {
|
|
57
|
+
Q({
|
|
58
|
+
title: s("确认 Mock 输出?"),
|
|
59
|
+
content: s("Mock 输出将覆盖当前输出结果,执行时跳过该节点并以 Mock 值替代实际输出"),
|
|
60
|
+
confirmText: s("确定"),
|
|
61
|
+
cancelText: s("取消"),
|
|
62
|
+
width: 400,
|
|
63
|
+
onConfirm: () => {
|
|
64
|
+
e();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}, J = () => {
|
|
68
|
+
if (p.value) {
|
|
69
|
+
k("confirm", { outputs: {} });
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const { errors: e, outputs: l } = q();
|
|
73
|
+
g.value = e, !(Object.keys(e).length > 0) && I(() => k("confirm", { outputs: l }));
|
|
74
|
+
}, V = () => {
|
|
75
|
+
k("close"), k("update:show", !1);
|
|
76
|
+
};
|
|
77
|
+
return P(
|
|
78
|
+
() => [t.show, t.node?.id],
|
|
79
|
+
([e]) => {
|
|
80
|
+
e && t.node && (m.value = Z(t.outputs ?? {}), R());
|
|
81
|
+
},
|
|
82
|
+
{ immediate: !0 }
|
|
83
|
+
), (e, l) => {
|
|
84
|
+
const a = _("bk-form-item"), o = _("bk-form"), c = _("bk-exception"), n = _("bk-button"), S = _("bk-sideslider"), U = W("bkloading");
|
|
85
|
+
return r(), y(S, {
|
|
86
|
+
"is-show": t.show,
|
|
87
|
+
width: 960,
|
|
88
|
+
"quick-close": "",
|
|
89
|
+
"esc-close": !1,
|
|
90
|
+
onClosed: V
|
|
91
|
+
}, {
|
|
92
|
+
header: u(() => [
|
|
93
|
+
F("span", le, b(O(s)("Mock输出")), 1),
|
|
94
|
+
t.node?.name ? (r(), h("span", re, "-")) : x("", !0),
|
|
95
|
+
t.node?.name ? (r(), h("span", {
|
|
96
|
+
key: 1,
|
|
97
|
+
class: "mock-data-sideslider__title-node",
|
|
98
|
+
title: t.node.name
|
|
99
|
+
}, b(t.node.name), 9, ce)) : x("", !0)
|
|
100
|
+
]),
|
|
101
|
+
footer: u(() => [
|
|
102
|
+
F("div", ue, [
|
|
103
|
+
w(n, {
|
|
104
|
+
theme: "primary",
|
|
105
|
+
"data-test": "mock-confirm",
|
|
106
|
+
loading: t.pending,
|
|
107
|
+
onClick: J
|
|
108
|
+
}, {
|
|
109
|
+
default: u(() => [
|
|
110
|
+
M(b(N.value), 1)
|
|
111
|
+
]),
|
|
112
|
+
_: 1
|
|
113
|
+
}, 8, ["loading"]),
|
|
114
|
+
w(n, {
|
|
115
|
+
disabled: t.pending,
|
|
116
|
+
onClick: V
|
|
117
|
+
}, {
|
|
118
|
+
default: u(() => [
|
|
119
|
+
M(b(O(s)("取消")), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["disabled"])
|
|
123
|
+
])
|
|
124
|
+
]),
|
|
125
|
+
default: u(() => [
|
|
126
|
+
G((r(), h("div", ie, [
|
|
127
|
+
d.value.length > 0 ? (r(), y(o, {
|
|
128
|
+
key: 0,
|
|
129
|
+
"form-type": "vertical",
|
|
130
|
+
"label-width": 120,
|
|
131
|
+
"data-test": "mock-outputs-form"
|
|
132
|
+
}, {
|
|
133
|
+
default: u(() => [
|
|
134
|
+
(r(!0), h(H, null, K(d.value, (i) => (r(), y(a, {
|
|
135
|
+
key: i.key,
|
|
136
|
+
label: i.name || i.key
|
|
137
|
+
}, {
|
|
138
|
+
default: u(() => [
|
|
139
|
+
w($, {
|
|
140
|
+
modelValue: m.value[i.key],
|
|
141
|
+
"onUpdate:modelValue": (z) => m.value[i.key] = z,
|
|
142
|
+
field: i,
|
|
143
|
+
error: g.value[i.key]
|
|
144
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "field", "error"])
|
|
145
|
+
]),
|
|
146
|
+
_: 2
|
|
147
|
+
}, 1032, ["label"]))), 128))
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
})) : f.value ? x("", !0) : (r(), y(c, {
|
|
151
|
+
key: 1,
|
|
152
|
+
class: "mock-data-sideslider__exception",
|
|
153
|
+
scene: "part",
|
|
154
|
+
type: "empty",
|
|
155
|
+
title: T.value
|
|
156
|
+
}, null, 8, ["title"]))
|
|
157
|
+
])), [
|
|
158
|
+
[U, { loading: f.value }]
|
|
159
|
+
])
|
|
160
|
+
]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 8, ["is-show"]);
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}), ye = /* @__PURE__ */ ne(de, [["__scopeId", "data-v-402876f9"]]);
|
|
166
|
+
export {
|
|
167
|
+
ye as default
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue");require("./context-C3QIuIf6.cjs");const F=require("bkui-vue/lib"),M=require("bkui-vue/lib/message"),s=require("./index-iB9uV7YQ.cjs"),l=require("@blueking/flow-canvas"),O={class:"mock-data-sideslider__title"},q={key:0,class:"mock-data-sideslider__title-sep"},S=["title"],T={class:"mock-data-sideslider"},j={class:"mock-data-sideslider__footer"},R=e.defineComponent({__name:"index",props:{show:{type:Boolean},node:{default:null},outputs:{default:()=>({})},pending:{type:Boolean,default:!1}},emits:["confirm","close","update:show"],setup(y,{emit:h}){const o=y,k=h,b=s.useFlowApiConfig(),_=e.ref(!1),d=e.shallowRef([]),m=e.ref({}),v=e.ref({}),p=e.ref(!1),g=e.computed(()=>p.value?l.t("当前节点的输出不支持mock,是否需要在调试时跳过当前节点?"):l.t("暂无输出结果")),w=e.computed(()=>p.value?l.t("跳过调试"):l.t("确定")),C=async()=>{if(o.node){_.value=!0,v.value={},p.value=!1;try{const t=await s.pluginDetailRequest(b,o.node.component);d.value=s.mergeOutputs(t.outputs??[]),p.value=s.hasOnlySystemOutputs(t.outputs);const c=o.outputs??{},a={};d.value.forEach(n=>{const i=Object.prototype.hasOwnProperty.call(c,n.key)?c[n.key]:n.type==="object"?{}:void 0,r=s.resolveMockFormControl(n);a[n.key]=r==="json-editor"||r==="data-table"?s.formatJsonFieldValue(i):i}),m.value=a}catch(t){console.error(t),d.value=[],m.value={},p.value=!1,M({theme:"error",message:l.t("加载输出结果失败")})}finally{_.value=!1}}},x=()=>{const t={},c={};return d.value.forEach(a=>{const n=m.value[a.key],i=s.resolveMockFormControl(a);if(i==="json-editor"||i==="data-table"){const r=s.parseJsonFieldValue(n);if(!r.valid){t[a.key]=r.message;return}r.value!==void 0&&(c[a.key]=r.value);return}n!==void 0&&n!==""&&(c[a.key]=n)}),{errors:t,outputs:c}},V=t=>{F.InfoBox({title:l.t("确认 Mock 输出?"),content:l.t("Mock 输出将覆盖当前输出结果,执行时跳过该节点并以 Mock 值替代实际输出"),confirmText:l.t("确定"),cancelText:l.t("取消"),width:400,onConfirm:()=>{t()}})},B=()=>{if(p.value){k("confirm",{outputs:{}});return}const{errors:t,outputs:c}=x();v.value=t,!(Object.keys(t).length>0)&&V(()=>k("confirm",{outputs:c}))},f=()=>{k("close"),k("update:show",!1)};return e.watch(()=>[o.show,o.node?.id],([t])=>{t&&o.node&&(m.value=s.cloneDeep(o.outputs??{}),C())},{immediate:!0}),(t,c)=>{const a=e.resolveComponent("bk-form-item"),n=e.resolveComponent("bk-form"),i=e.resolveComponent("bk-exception"),r=e.resolveComponent("bk-button"),N=e.resolveComponent("bk-sideslider"),D=e.resolveDirective("bkloading");return e.openBlock(),e.createBlock(N,{"is-show":o.show,width:960,"quick-close":"","esc-close":!1,onClosed:f},{header:e.withCtx(()=>[e.createElementVNode("span",O,e.toDisplayString(e.unref(l.t)("Mock输出")),1),o.node?.name?(e.openBlock(),e.createElementBlock("span",q,"-")):e.createCommentVNode("",!0),o.node?.name?(e.openBlock(),e.createElementBlock("span",{key:1,class:"mock-data-sideslider__title-node",title:o.node.name},e.toDisplayString(o.node.name),9,S)):e.createCommentVNode("",!0)]),footer:e.withCtx(()=>[e.createElementVNode("div",j,[e.createVNode(r,{theme:"primary","data-test":"mock-confirm",loading:o.pending,onClick:B},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(w.value),1)]),_:1},8,["loading"]),e.createVNode(r,{disabled:o.pending,onClick:f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l.t)("取消")),1)]),_:1},8,["disabled"])])]),default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",T,[d.value.length>0?(e.openBlock(),e.createBlock(n,{key:0,"form-type":"vertical","label-width":120,"data-test":"mock-outputs-form"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,u=>(e.openBlock(),e.createBlock(a,{key:u.key,label:u.name||u.key},{default:e.withCtx(()=>[e.createVNode(s.MockFieldRenderer,{modelValue:m.value[u.key],"onUpdate:modelValue":E=>m.value[u.key]=E,field:u,error:v.value[u.key]},null,8,["modelValue","onUpdate:modelValue","field","error"])]),_:2},1032,["label"]))),128))]),_:1})):_.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(i,{key:1,class:"mock-data-sideslider__exception",scene:"part",type:"empty",title:g.value},null,8,["title"]))])),[[D,{loading:_.value}]])]),_:1},8,["is-show"])}}}),I=s._export_sfc(R,[["__scopeId","data-v-402876f9"]]);exports.default=I;
|