UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 5.67 kB
!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"n8n@2.16.1"}}catch(e){}}(),System.register(["./vue.runtime.esm-bundler-legacy-BW6xDdqj.js","./core-legacy-VD8c7QJ-.js","./src-legacy-B67uuxhB.js","./_plugin-vue_export-helper-legacy-DFdC_I5Z.js","./users.store-legacy-azRUgFdP.js","./executions.store-legacy-Cfatr-ks.js"],(function(e,o){var t,n,r,i,a,s,l,d,c,w,u,f,y,p,v,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){p=e.at},function(e){v=e.jt,m=e.k},function(e){_=e.t},function(e){h=e.Pn,g=e.ai},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]="754eb238-18d9-47a5-ade9-78874c68003f",o._sentryDebugIdIdentifier="sentry-dbid-754eb238-18d9-47a5-ade9-78874c68003f")}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},suppressNotifications:{type:Boolean,default:!1}},emits:["close","ready"],setup(e,{expose:a,emit:_}){const k=e,b=_,I=p(),N=h(),T=x(),P=g(),D=i(null),j=i(!1),$=i(!1),L=i(!1),O=i(0),V=i(0),M=s((()=>{const e=`${window.BASE_PATH??"/"}workflows/demo`;return k.hideControls?`${e}?hideControls=true`:e})),S=s((()=>!k.loading&&("workflow"===k.mode&&!!k.workflow||"execution"===k.mode&&!!k.executionId)&&$.value)),W=()=>{try{if(!k.workflow)throw new Error(I.baseText("workflowPreview.showError.missingWorkflow"));if(!k.workflow.nodes||!Array.isArray(k.workflow.nodes))throw new Error(I.baseText("workflowPreview.showError.arrayEmpty"));D.value?.contentWindow?.postMessage?.(JSON.stringify({command:"openWorkflow",workflow:k.workflow,canOpenNDV:k.canOpenNDV,hideNodeIssues:k.hideNodeIssues,suppressNotifications:k.suppressNotifications,projectId:P.currentProjectId}),"*")}catch(e){N.showError(e,I.baseText("workflowPreview.showError.previewError.title"),I.baseText("workflowPreview.showError.previewError.message"))}},B=()=>{try{if(!k.executionId)throw new Error(I.baseText("workflowPreview.showError.missingExecution"));D.value?.contentWindow?.postMessage?.(JSON.stringify({command:"openExecution",executionId:k.executionId,executionMode:k.executionMode??"",nodeId:k.nodeId,canOpenNDV:k.canOpenNDV,projectId:P.currentProjectId}),"*"),T.activeExecution&&D.value?.contentWindow?.postMessage?.(JSON.stringify({command:"setActiveExecution",executionId:T.activeExecution.id}),"*")}catch(e){N.showError(e,I.baseText("workflowPreview.showError.previewError.title"),I.baseText("workflowPreview.executionMode.showError.previewError.message"))}},A=()=>{L.value=!0,O.value=window.scrollX,V.value=window.scrollY},C=()=>{L.value=!1},R=({data:e})=>{if(e?.includes?.('"command"'))try{const o=JSON.parse(e);"n8nReady"===o.command?J():"openNDV"===o.command?Y():"closeNDV"===o.command?z():"error"===o.command&&F()}catch(o){console.error(o)}},J=()=>{$.value=!0,k.focusOnLoad&&setTimeout((()=>{D.value?.contentWindow?.focus()})),b("ready")},Y=()=>{j.value=!0},z=()=>{j.value=!1},F=()=>{b("close")},X=()=>{L.value&&window.scrollTo(O.value,V.value)};return c((()=>{window.addEventListener("message",R),document.addEventListener("scroll",X)})),y((()=>{window.removeEventListener("message",R),document.removeEventListener("scroll",X)})),u((()=>S.value),(()=>{S.value&&("workflow"===k.mode?W():"execution"===k.mode&&B())})),u((()=>k.executionId),(()=>{"execution"===k.mode&&k.executionId&&B()})),u((()=>k.workflow),(()=>{"workflow"===k.mode&&k.workflow&&W()})),a({iframeRef:D}),(o,i)=>(t(),r("div",{class:w(o.$style.container)},["image"!==e.loaderType||S.value?"spinner"!==e.loaderType||S.value?l("",!0):(t(),r("div",{key:1,class:w(o.$style.spinner)},[f(d(m),{type:"dots"})],2)):(t(),r("div",{key:0,class:w(o.$style.imageLoader)},[f(d(v),{loading:!S.value,rows:1,variant:"image"},null,8,["loading"])],2)),n("iframe",{ref_key:"iframeRef",ref:D,class:w({[o.$style.workflow]:!j.value,[o.$style.executionPreview]:"execution"===e.mode,[o.$style.openNDV]:j.value,[o.$style.show]:S.value}),src:M.value,"data-test-id":"workflow-preview-iframe",onMouseenter:A,onMouseleave:C},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-DvhLtneb.js.map