n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 6.82 kB
JavaScript
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`n8n@2.13.4`}}catch{}})();try{(function(){var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b54dfeef-7434-45dc-9724-23e127d07d9a`,e._sentryDebugIdIdentifier=`sentry-dbid-b54dfeef-7434-45dc-9724-23e127d07d9a`)})()}catch{}import{$ as e,A as t,C as n,E as r,Ft as i,N as a,S as o,Sn as s,Wt as c,X as l,_ as u,_n as d,gt as f,j as p,rt as m,w as h,yt as g}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{bt as _}from"./_MapCache-CUJwh2qp.js";import{Mi as v,Qi as y,Yi as b,_t as x,gt as S,lt as C,zt as w}from"./src-wni2AGA3.js";import{t as T}from"./_plugin-vue_export-helper-Dm3nT7Ps.js";import"./sanitize-html-my1ogl5v.js";import{Dn as E,Dr as D,Sn as O,Ta as k,at as A,en as j,s as M,w as N}from"./users.store-BHWXXawf.js";import{ms as P}from"./constants-CIP7tKq1.js";import"./merge-BqvKZ38d.js";import{j as F,r as I}from"./_baseOrderBy-CaKruttV.js";import"./dateformat-CYfyw486.js";import"./useDebounce-CTeIt-cH.js";import"./nodeIcon-BFJyt77y.js";import{t as L}from"./setupPanel.store-D0Kh-_X7.js";import"./nodeTransforms-DgA3LbBA.js";import"./templateTransforms-Bcjcx-gt.js";import"./NodeIcon-0naEDfOR.js";import{n as R,r as z,t as B}from"./SetupTemplateFormStep-xaVWzZRH.js";import"./CredentialPicker-Cr8cHjM9.js";import{t as V}from"./templateActions-CCQdJuTo.js";import{t as H}from"./TemplatesView-CArnrQsI.js";const U=F(`setupTemplate`,()=>{let e=i(``),t=i(!0),n=i(!1),r=E(),a=N(),s=A(),c=I(),l=M(),u=o(()=>e.value?r.getFullTemplateById(e.value):null),{appCredentials:d,credentialOverrides:f,credentialUsages:p,credentialsByKey:m,nodesRequiringCredentialsSorted:h,numFilledCredentials:g,selectedCredentialIdByKey:_,setSelectedCredentialId:v,unsetSelectedCredential:y}=z(o(()=>u.value?.workflow.nodes??[])),b=t=>{e.value=t},x=new Set([`httpBasicAuth`,`httpCustomAuth`,`httpDigestAuth`,`httpHeaderAuth`,`oAuth1Api`,`oAuth2Api`,`httpQueryAuth`]),S=()=>{for(let e of p.value){if(x.has(e.credentialType))continue;let t=s.getCredentialsByType(e.credentialType);t.length===1&&(_.value[e.key]=t[0].id)}},C=async()=>{u.value||!e.value||(await r.fetchTemplateById(e.value),S())};return{credentialsByKey:m,isLoading:t,isSaving:n,appCredentials:d,nodesRequiringCredentialsSorted:h,template:u,credentialUsages:p,selectedCredentialIdByKey:_,credentialOverrides:f,numFilledCredentials:g,createWorkflow:async t=>{let{router:i}=t,o=j();if(u.value)try{n.value=!0;let t=await V({template:u.value,credentialOverrides:f.value,rootStore:c,workflowsStore:l,nodeTypeProvider:a,clearResourceLocators:L().isFeatureEnabled});if(o.track(`User closed cred setup`,{completed:!0,creds_filled:g.value,creds_needed:p.value.length,workflow_id:t.id}),o.track(`User inserted workflow template`,{source:`workflow`,template_id:k(e.value),wf_template_repo_session_id:r.currentSessionId}),o.track(`User saved new workflow from template`,{template_id:k(e.value),workflow_id:t.id,wf_template_repo_session_id:r.currentSessionId}),L().isFeatureEnabled){let e=O();e.openFocusPanelForWorkflow(t.id),e.setSelectedTab(`setup`)}await i.replace({name:P.WORKFLOW,params:{name:t.id}})}finally{n.value=!1}},skipSetup:async({router:t})=>{let n=D(),i=j();await n.run(`templatesWorkflowView.openWorkflow`,{source:`workflow`,template_id:e.value,wf_template_repo_session_id:r.currentSessionId}),i.track(`User closed cred setup`,{completed:!1,creds_filled:0,creds_needed:p.value.length,workflow_id:null}),await t.replace({name:P.TEMPLATE_IMPORT,params:{id:e.value}})},init:async()=>{t.value=!0;try{_.value={},await Promise.all([s.fetchAllCredentials(),s.fetchCredentialTypes(!1),a.loadNodeTypesIfNotLoaded(),C()]),S()}finally{t.value=!1}},loadTemplateIfNeeded:C,setInitialCredentialSelection:S,setTemplateId:b,setSelectedCredentialId:v,unsetSelectedCredential:y}});var W={key:1},G=T(a({__name:`SetupWorkflowFromTemplateView`,setup(i){let a=U(),T=_(),E=S(),D=x(),O=o(()=>Array.isArray(E.params.id)?E.params.id[0]:E.params.id),k=o(()=>a.template?.name??`unknown`),A=o(()=>!a.isLoading),j=o(()=>D.resolve({name:P.TEMPLATE_IMPORT,params:{id:O.value}}).fullPath);f(O,async e=>{a.setTemplateId(e),await a.loadTemplateIfNeeded()});let M=async e=>{e.preventDefault(),await a.skipSetup({router:D})},N=async()=>a.template&&a.credentialUsages.length===0?(await a.skipSetup({router:D}),!0):!1;return a.setTemplateId(O.value),l(async()=>{await a.init(),await N()}),(i,o)=>(e(),h(H,{"go-back-enabled":!0},{header:g(()=>[A.value?(e(),h(c(b),{key:0,tag:`h1`,size:`2xlarge`},{default:g(()=>[t(s(c(T).baseText(`templateSetup.title`,{interpolate:{name:k.value}})),1)]),_:1})):(e(),h(c(w),{key:1,variant:`h1`}))]),content:g(()=>[n(`div`,{class:d(i.$style.grid)},[n(`div`,{class:d(i.$style.notice),"data-test-id":`info-callout`},[A.value?(e(),h(R,{key:0,"app-credentials":c(a).appCredentials},null,8,[`app-credentials`])):(e(),h(c(w),{key:1,variant:`p`}))],2),n(`div`,null,[A.value?(e(),r(`ol`,{key:0,class:d(i.$style.appCredentialsContainer)},[(e(!0),r(u,null,m(c(a).credentialUsages,(t,n)=>(e(),h(B,{key:t.key,class:d(i.$style.appCredential),order:n+1,credentials:t,"selected-credential-id":c(a).selectedCredentialIdByKey[t.key],onCredentialSelected:o[0]||=e=>c(a).setSelectedCredentialId(e.credentialUsageKey,e.credentialId),onCredentialDeselected:o[1]||=e=>c(a).unsetSelectedCredential(e.credentialUsageKey)},null,8,[`class`,`order`,`credentials`,`selected-credential-id`]))),128))],2)):(e(),r(`div`,{key:1,class:d(i.$style.appCredentialsContainer)},[p(c(w),{class:d(i.$style.appCredential),variant:`p`,rows:3},null,8,[`class`]),p(c(w),{class:d(i.$style.appCredential),variant:`p`,rows:3},null,8,[`class`])],2))]),n(`div`,{class:d(i.$style.actions)},[p(c(C),{href:j.value,"new-window":!1,onClick:o[2]||=e=>M(e)},{default:g(()=>[t(s(c(T).baseText(`templateSetup.skip`)),1)]),_:1},8,[`href`]),A.value?(e(),h(c(v),{key:0,content:c(T).baseText(`templateSetup.continue.button.fillRemaining`),disabled:c(a).numFilledCredentials>0},{default:g(()=>[p(c(y),{size:`large`,label:c(T).baseText(`templateSetup.continue.button`),disabled:c(a).isSaving||c(a).numFilledCredentials===0,"data-test-id":`continue-button`,onClick:o[3]||=e=>c(a).createWorkflow({router:c(D)})},null,8,[`label`,`disabled`])]),_:1},8,[`content`,`disabled`])):(e(),r(`div`,W,[p(c(w),{variant:`button`})]))],2)],2)]),_:1}))}}),[[`__cssModules`,{$style:{grid:`_grid_u018b_125`,notice:`_notice_u018b_133`,appCredentialsContainer:`_appCredentialsContainer_u018b_137`,appCredential:`_appCredential_u018b_137`,actions:`_actions_u018b_148`}}]]);export{G as default};
//# sourceMappingURL=SetupWorkflowFromTemplateView-CUxeD6pH.js.map