n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 5.56 kB
JavaScript
!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"n8n@2.13.4"}}catch(e){}}(),System.register(["./vue.runtime.esm-bundler-legacy-IafOlCW8.js","./_MapCache-legacy-DwgdC8YO.js","./src-legacy-Dwzr7bD0.js","./_plugin-vue_export-helper-legacy-DEZAmQqp.js","./users.store-legacy-OKuN0qAC.js","./executions.store-legacy-z6ytCHo9.js"],(function(e,o){var t,n,r,i,a,s,l,d,c,w,u,f,y,v,p,m,_,h,g,x,k,E,b;return{setters:[function(e){t=e.$,n=e.C,r=e.E,i=e.Ft,a=e.N,s=e.S,l=e.T,d=e.Wt,c=e.X,w=e._n,u=e.gt,f=e.j,y=e.q},function(e){v=e.bt},function(e){p=e.R,m=e.zt},function(e){_=e.t},function(e){h=e.Ft,g=e.Tr},function(e){x=e.t}],execute:function(){(k=document.createElement("style")).textContent="._container_ycaoi_125{justify-content:center;width:100%;height:100%;display:flex}._workflow_ycaoi_132{visibility:hidden;width:0;height:0}._show_ycaoi_138{visibility:visible;width:100%;height:100%}._openNDV_ycaoi_144{width:100%;height:100%;z-index:var(--workflow-preview-ndv--z);position:fixed;top:0;left:0}._spinner_ycaoi_153{color:var(--color--primary);position:absolute;transform:translateY(-50%);top:50%!important}._imageLoader_ycaoi_161{justify-content:center;align-items:center;width:100%;height:100%;display:flex}._executionPreview_ycaoi_169{height:100%}\n/*$vite$:1*/",document.head.appendChild(k);try{o="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},(I=(new o.Error).stack)&&(o._sentryDebugIds=o._sentryDebugIds||{},o._sentryDebugIds[I]="73644764-f69d-4215-a71d-154359f1e6b6",o._sentryDebugIdIdentifier="sentry-dbid-73644764-f69d-4215-a71d-154359f1e6b6")}catch(o){}var o,I;E=["src"],b=a({__name:"WorkflowPreview",props:{loading:{type:Boolean,default:!1},mode:{default:"workflow"},workflow:{default:void 0},executionId:{default:void 0},executionMode:{default:void 0},nodeId:{default:void 0},loaderType:{default:"image"},canOpenNDV:{type:Boolean,default:!0},hideNodeIssues:{type:Boolean,default:!1},focusOnLoad:{type:Boolean,default:!0},hideControls:{type:Boolean,default:!1}},emits:["close","ready"],setup(e,{emit:a}){const _=e,k=a,b=v(),I=g(),N=x(),T=h(),D=i(null),P=i(!1),j=i(!1),$=i(!1),L=i(0),M=i(0),O=s((()=>{const e=`${window.BASE_PATH??"/"}workflows/demo`;return _.hideControls?`${e}?hideControls=true`:e})),V=s((()=>!_.loading&&("workflow"===_.mode&&!!_.workflow||"execution"===_.mode&&!!_.executionId)&&j.value)),S=()=>{try{if(!_.workflow)throw new Error(b.baseText("workflowPreview.showError.missingWorkflow"));if(!_.workflow.nodes||!Array.isArray(_.workflow.nodes))throw new Error(b.baseText("workflowPreview.showError.arrayEmpty"));D.value?.contentWindow?.postMessage?.(JSON.stringify({command:"openWorkflow",workflow:_.workflow,canOpenNDV:_.canOpenNDV,hideNodeIssues:_.hideNodeIssues,projectId:T.currentProjectId}),"*")}catch(e){I.showError(e,b.baseText("workflowPreview.showError.previewError.title"),b.baseText("workflowPreview.showError.previewError.message"))}},W=()=>{try{if(!_.executionId)throw new Error(b.baseText("workflowPreview.showError.missingExecution"));D.value?.contentWindow?.postMessage?.(JSON.stringify({command:"openExecution",executionId:_.executionId,executionMode:_.executionMode??"",nodeId:_.nodeId,canOpenNDV:_.canOpenNDV,projectId:T.currentProjectId}),"*"),N.activeExecution&&D.value?.contentWindow?.postMessage?.(JSON.stringify({command:"setActiveExecution",executionId:N.activeExecution.id}),"*")}catch(e){I.showError(e,b.baseText("workflowPreview.showError.previewError.title"),b.baseText("workflowPreview.executionMode.showError.previewError.message"))}},C=()=>{$.value=!0,L.value=window.scrollX,M.value=window.scrollY},A=()=>{$.value=!1},B=({data:e})=>{if(e?.includes?.('"command"'))try{const o=JSON.parse(e);"n8nReady"===o.command?R():"openNDV"===o.command?J():"closeNDV"===o.command?z():"error"===o.command&&Y()}catch(o){console.error(o)}},R=()=>{j.value=!0,_.focusOnLoad&&setTimeout((()=>{D.value?.contentWindow?.focus()})),k("ready")},J=()=>{P.value=!0},z=()=>{P.value=!1},Y=()=>{k("close")},F=()=>{$.value&&window.scrollTo(L.value,M.value)};return c((()=>{window.addEventListener("message",B),document.addEventListener("scroll",F)})),y((()=>{window.removeEventListener("message",B),document.removeEventListener("scroll",F)})),u((()=>V.value),(()=>{V.value&&("workflow"===_.mode?S():"execution"===_.mode&&W())})),u((()=>_.executionId),(()=>{"execution"===_.mode&&_.executionId&&W()})),u((()=>_.workflow),(()=>{"workflow"===_.mode&&_.workflow&&S()})),(o,i)=>(t(),r("div",{class:w(o.$style.container)},["image"!==e.loaderType||V.value?"spinner"!==e.loaderType||V.value?l("",!0):(t(),r("div",{key:1,class:w(o.$style.spinner)},[f(d(p),{type:"dots"})],2)):(t(),r("div",{key:0,class:w(o.$style.imageLoader)},[f(d(m),{loading:!V.value,rows:1,variant:"image"},null,8,["loading"])],2)),n("iframe",{ref_key:"iframeRef",ref:D,class:w({[o.$style.workflow]:!P.value,[o.$style.executionPreview]:"execution"===e.mode,[o.$style.openNDV]:P.value,[o.$style.show]:V.value}),src:O.value,"data-test-id":"workflow-preview-iframe",onMouseenter:C,onMouseleave:A},null,42,E)],2))}}),e("t",_(b,[["__cssModules",{$style:{container:"_container_ycaoi_125",workflow:"_workflow_ycaoi_132",show:"_show_ycaoi_138",openNDV:"_openNDV_ycaoi_144",spinner:"_spinner_ycaoi_153",imageLoader:"_imageLoader_ycaoi_161",executionPreview:"_executionPreview_ycaoi_169"}}]]))}}}));
//# sourceMappingURL=WorkflowPreview-legacy-DP8CfnLP.js.map