UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

2 lines 5.87 kB
(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.16.1`}}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]=`bb1f0e77-3c0f-4e2f-8ad0-e0bc503a4963`,e._sentryDebugIdIdentifier=`sentry-dbid-bb1f0e77-3c0f-4e2f-8ad0-e0bc503a4963`)})()}catch{}import{o as e}from"./chunk-CACdhNlC.js";import{$ as t,A as n,C as r,E as i,Ft as a,N as o,S as s,Sn as c,T as l,Wt as u,_n as d,bt as f,j as p,ot as m,w as h,yt as g}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{at as _,ot as v}from"./core-Bz5WjPxS.js";import{Ji as y,R as b}from"./src-XqE2yCpG.js";import{t as x}from"./_plugin-vue_export-helper-CIL7EULb.js";import{Bi as S,Q as C,fr as w,it as T,w as E}from"./users.store-xP93bV7X.js";import{i as D}from"./nodeTransforms-lrtn9NPZ.js";import{n as O,r as k}from"./templateTransforms-otxtD9tz.js";import{t as A}from"./NodeIcon-T2UcO71E.js";import{t as j}from"./CredentialPicker-BSrpObuf.js";var M=e(C(),1),N=(e,t)=>t.map(t=>({node:t,requiredCredentials:D(e,t)})).filter(({requiredCredentials:e})=>e.length>0),P=e=>{let t=new Map;for(let{node:n,requiredCredentials:r}of e){let e=n.credentials?k(n.credentials):{};for(let i of r){let r=i.name,a=e[i.name]??``,o=O(r,a),s=t.get(o);s||(s={key:o,nodeTypeName:n.type,credentialName:a,credentialType:r,usedBy:[]},t.set(o,s)),s.usedBy.push(n)}}return t},F=(e,t)=>{let n=new Map;for(let r of e){let e=r.nodeTypeName,i=t(e)??e,a=n.get(i);a?a.credentials.push(r):n.set(i,{appName:i,credentials:[r]})}return Array.from(n.values())},I=e=>{let t=a({}),n=E(),r=T(),i=(e,t)=>{let r=n.getNodeType(e,t);return r?S(r.displayName):e},o=s(()=>(0,M.default)(e.value?N(n,e.value):[],({node:e})=>e.position[0])),c=s(()=>P(o.value)),l=s(()=>Array.from(c.value.values()));return{appCredentials:s(()=>F(l.value,i)),credentialOverrides:s(()=>{let e={};for(let[n,i]of Object.entries(t.value)){let t=r.getCredentialById(i);t&&(e[n]={id:i,name:t.name})}return e}),credentialUsages:l,credentialsByKey:c,nodesRequiringCredentialsSorted:o,numFilledCredentials:s(()=>Object.keys(t.value).length),selectedCredentialIdByKey:t,setSelectedCredentialId:(e,n)=>{t.value[e]=n},unsetSelectedCredential:e=>{delete t.value[e]}}},L=(e,t)=>{let{i18n:n,formatFn:r}=t;if(e.length===0)return``;if(e.length===1)return r(e[0]);let i=e.slice(0,-1),a=e[e.length-1];return`${i.map(r).join(`, `)} ${n.baseText(`generic.and`)} ${r(a)}`},R=x(o({__name:`AppsRequiringCredsNotice`,props:{appCredentials:{},source:{}},setup(e){let n=_(),i=e,a=s(()=>i.source===`builder`?`templateSetup.instructions.builder`:`templateSetup.instructions`),o=e=>`<b>${e.credentials.length}x ${e.appName}</b>`,c=s(()=>L(i.appCredentials,{formatFn:o,i18n:n}));return(e,n)=>{let i=m(`n8n-html`);return t(),h(u(b),{class:d(e.$style.notice),theme:`info`},{default:g(()=>[p(u(v),{tag:`span`,keypath:a.value,scope:`global`},{default:g(()=>[f(r(`span`,null,null,512),[[i,c.value]])]),_:1},8,[`keypath`])]),_:1},8,[`class`])}}}),[[`__cssModules`,{$style:{notice:`_notice_e6am5_125`}}]]),z={},B={class:`el-icon-success`};function V(e,n){return t(),i(`i`,B)}var H=x(z,[[`render`,V],[`__scopeId`,`data-v-563d175d`]]),U=x(o({__name:`SetupTemplateFormStep`,props:{order:{},credentials:{},selectedCredentialId:{default:null},source:{}},emits:[`credentialSelected`,`credentialDeselected`],setup(e,{emit:a}){let o=e,h=a,b=E(),x=_(),C=w(),T=s(()=>o.credentials.usedBy[0]),D=s(()=>b.getNodeType(T.value.type,T.value.typeVersion)),O=s(()=>D.value?S(D.value.displayName):T.value.type),k=s(()=>L(o.credentials.usedBy,{formatFn:e=>`<b>${e.name}</b>`,i18n:x})),M=s(()=>o.source===`builder`?`templateSetup.credential.description.builder`:`templateSetup.credential.description`),N=()=>{C.track(`User opened Credential modal`,{source:`cred_setup`,credentialType:o.credentials.credentialType,new_credential:!o.selectedCredentialId})};return(a,s)=>{let _=m(`n8n-html`);return t(),i(`li`,{class:d(a.$style.container),"data-test-id":`setup-credentials-form-step`},[p(u(y),{tag:`h2`,size:`large`},{default:g(()=>[D.value?(t(),i(`div`,{key:0,class:d(a.$style.heading),"data-test-id":`credential-step-heading`},[r(`span`,{class:d(a.$style.headingOrder)},c(e.order)+`.`,3),r(`span`,{class:d(a.$style.headingIcon)},[p(A,{"node-type":D.value},null,8,[`node-type`])],2),n(` `+c(O.value),1)],2)):l(``,!0)]),_:1}),r(`p`,{class:d(a.$style.description),"data-test-id":`credential-step-description`},[p(u(v),{tag:`span`,keypath:M.value,plural:e.credentials.usedBy.length,scope:`global`},{default:g(()=>[f(r(`span`,null,null,512),[[_,k.value]])]),_:1},8,[`keypath`,`plural`])],2),r(`div`,{class:d(a.$style.credentials)},[p(j,{class:d(a.$style.credentialPicker),"app-name":O.value,"credential-type":o.credentials.credentialType,"selected-credential-id":e.selectedCredentialId,onCredentialSelected:s[0]||=e=>h(`credentialSelected`,{credentialUsageKey:a.$props.credentials.key,credentialId:e}),onCredentialDeselected:s[1]||=e=>h(`credentialDeselected`,{credentialUsageKey:a.$props.credentials.key}),onCredentialModalOpened:N},null,8,[`class`,`app-name`,`credential-type`,`selected-credential-id`]),p(H,{class:d({[a.$style.credentialOk]:!0,[a.$style.invisible]:!e.selectedCredentialId})},null,8,[`class`])],2)],2)}}}),[[`__cssModules`,{$style:{container:`_container_atvc6_125`,heading:`_heading_atvc6_129`,headingOrder:`_headingOrder_atvc6_135`,headingIcon:`_headingIcon_atvc6_140`,description:`_description_atvc6_144`,credentials:`_credentials_atvc6_150`,credentialPicker:`_credentialPicker_atvc6_156`,credentialOk:`_credentialOk_atvc6_160`,invisible:`_invisible_atvc6_165`}}]]);export{I as i,H as n,R as r,U as t}; //# sourceMappingURL=SetupTemplateFormStep-BmfyAgg6.js.map