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]=`a0875251-c445-4cf8-ab9e-82af35f2f4ed`,e._sentryDebugIdIdentifier=`sentry-dbid-a0875251-c445-4cf8-ab9e-82af35f2f4ed`)})()}catch{}import{$ as e,A as t,C as n,E as r,Ft as i,N as a,O as o,S as s,Sn as c,T as l,Wt as u,X as d,_ as f,_n as p,gt as m,it as h,j as g,rt as _,w as v,yt as y}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{bt as b}from"./_MapCache-CUJwh2qp.js";import{P as x,Q as S,Yi as C,Zi as w,_t as T,gt as E,zt as D}from"./src-wni2AGA3.js";import{t as O}from"./_plugin-vue_export-helper-Dm3nT7Ps.js";import"./sanitize-html-my1ogl5v.js";import{Dn as k,Dr as A,Fi as j,X as M,Z as N,da as P,en as F,vn as I,w as L}from"./users.store-BHWXXawf.js";import{ms as R}from"./constants-CIP7tKq1.js";import"./merge-BqvKZ38d.js";import"./_baseOrderBy-CaKruttV.js";import"./dateformat-CYfyw486.js";import"./useDebounce-CTeIt-cH.js";import"./nodeIcon-BFJyt77y.js";import"./nodeTransforms-DgA3LbBA.js";import"./templateTransforms-Bcjcx-gt.js";import{t as z}from"./NodeIcon-0naEDfOR.js";import{t as B}from"./TimeAgo-B5--ltV7.js";import{n as V}from"./templateActions-CCQdJuTo.js";import{t as H}from"./TemplatesView-CArnrQsI.js";import{t as U}from"./TemplateList-Dp9EDBrf.js";var W=O(a({__name:`TemplateDetailsBlock`,props:{title:{}},setup(i){return(a,o)=>(e(),r(`div`,{class:p(a.$style.block)},[n(`div`,{class:p(a.$style.header)},[g(u(C),{tag:`h3`,size:`small`,color:`text-base`},{default:y(()=>[t(c(i.title),1)]),_:1})],2),n(`div`,{class:p(a.$style.content)},[h(a.$slots,`default`)],2)],2))}}),[[`__cssModules`,{$style:{block:`_block_67niz_125`,header:`_header_67niz_129`,content:`_content_67niz_134`}}]]),G=O(a({__name:`TemplateDetails`,props:{template:{},blockTitle:{},loading:{type:Boolean}},setup(i){let a=i,o=T(),d=b(),m=k(),h=s(()=>a.template&&`categories`in a.template?a.template.categories.map(e=>({id:`${e.id}`,name:e.name})):[]),S=e=>{m.resetSessionId(),o.push(`/templates?categories=${e}`)},C=e=>{m.resetSessionId(),o.push(`/templates?search=${e.displayName}`)};return(a,o)=>(e(),r(`div`,null,[g(u(D),{loading:i.loading,rows:5,variant:`p`},null,8,[`loading`]),!i.loading&&i.template&&i.template.nodes.length>0?(e(),v(W,{key:0,title:i.blockTitle},{default:y(()=>[n(`div`,{class:p(a.$style.icons)},[(e(!0),r(f,null,_(u(j)(i.template.nodes),t=>(e(),r(`div`,{key:t.name,class:p(a.$style.icon)},[g(z,{"node-type":t,size:24,"show-tooltip":!0,onClick:e=>C(t)},null,8,[`node-type`,`onClick`])],2))),128))],2)]),_:1},8,[`title`])):l(``,!0),!i.loading&&u(M)(i.template)&&h.value.length>0?(e(),v(W,{key:1,title:u(d).baseText(`template.details.categories`)},{default:y(()=>[g(u(x),{tags:h.value,"onClick:tag":S},null,8,[`tags`])]),_:1},8,[`title`])):l(``,!0),!i.loading&&i.template?(e(),v(W,{key:2,title:u(d).baseText(`template.details.details`)},{default:y(()=>[n(`div`,{class:p(a.$style.text)},[u(N)(i.template)?(e(),v(u(w),{key:0,size:`small`,color:`text-base`},{default:y(()=>[t(c(u(d).baseText(`template.details.created`))+` `,1),g(B,{date:i.template.createdAt},null,8,[`date`]),t(` `+c(u(d).baseText(`template.details.by`))+` `+c(i.template.user?i.template.user.username:`n8n team`),1)]),_:1})):l(``,!0)],2),n(`div`,{class:p(a.$style.text)},[u(N)(i.template)&&i.template.totalViews!==0?(e(),v(u(w),{key:0,size:`small`,color:`text-base`},{default:y(()=>[t(c(u(d).baseText(`template.details.viewed`))+` `+c(u(P)(i.template.totalViews))+` `+c(u(d).baseText(`template.details.times`)),1)]),_:1})):l(``,!0)],2)]),_:1},8,[`title`])):l(``,!0)]))}}),[[`__cssModules`,{$style:{icons:`_icons_1p4ga_125`,icon:`_icon_1p4ga_125`,text:`_text_1p4ga_136`}}]]),K=O(a({__name:`TemplatesCollectionView`,setup(a){let f=A(),h=k(),_=L(),x=E(),O=T(),j=F(),N=b(),P=I(),z=i(!0),B=i(!1),W=s(()=>{let{id:e}=x.params;return Array.isArray(e)?e[0]:e}),K=s(()=>h.getCollectionById[W.value]),q=s(()=>!K.value||z.value?[]:K.value.workflows.map(({id:e})=>h.getTemplatesById(e.toString())).filter(e=>!!e)),J=()=>{setTimeout(()=>{let e=document.getElementById(`content`);e&&e.scrollTo({top:0,behavior:`smooth`})},50)},Y=({event:e,id:t})=>{Z(e,R.TEMPLATE,`${t}`)},X=async({event:e,id:t})=>{await V({router:O,templateId:`${t}`,inNewBrowserTab:e.metaKey||e.ctrlKey,templatesStore:h,externalHooks:f,nodeTypesStore:_,telemetry:j,source:`template_list`})},Z=(e,t,n)=>{if(e.metaKey||e.ctrlKey){let{href:e}=O.resolve({name:t,params:{id:n}});window.open(e,`_blank`);return}else O.push({name:t,params:{id:n}})};return m(()=>K.value,()=>{K.value&&`full`in K.value&&K.value.full?P.set(`Template collection: ${K.value.name}`):P.set(`Templates`)}),d(async()=>{if(J(),K.value&&`full`in K.value&&K.value.full){z.value=!1;return}try{await h.fetchCollectionById(W.value)}catch{B.value=!0}z.value=!1}),(i,a)=>(e(),v(H,{"go-back-enabled":!0},o({header:y(()=>[B.value?(e(),r(`div`,{key:1,class:p(i.$style.notFound)},[g(u(w),{color:`text-base`},{default:y(()=>[t(c(u(N).baseText(`templates.collectionsNotFound`)),1)]),_:1})],2)):(e(),r(`div`,{key:0,class:p(i.$style.wrapper)},[n(`div`,{class:p(i.$style.title)},[K.value&&K.value.name?(e(),v(u(C),{key:0,tag:`h1`,size:`2xlarge`},{default:y(()=>[t(c(K.value.name),1)]),_:1})):l(``,!0),K.value&&K.value.name?(e(),v(u(w),{key:1,color:`text-base`,size:`small`},{default:y(()=>[t(c(u(N).baseText(`templates.collection`)),1)]),_:1})):l(``,!0),g(u(D),{loading:!K.value||!K.value.name,rows:2,variant:`h1`},null,8,[`loading`])],2)],2))]),_:2},[B.value?void 0:{name:`content`,fn:y(()=>[n(`div`,{class:p(i.$style.wrapper)},[n(`div`,{class:p(i.$style.mainContent)},[z.value||u(M)(K.value)?(e(),r(`div`,{key:0,class:p(i.$style.markdown)},[g(u(S),{content:u(M)(K.value)&&K.value.description?K.value.description:``,images:u(M)(K.value)&&K.value.image?K.value.image:void 0,loading:z.value},null,8,[`content`,`images`,`loading`])],2)):l(``,!0),g(U,{"infinite-scroll-enabled":!1,loading:z.value,"use-workflow-button":!0,workflows:q.value,onUseWorkflow:X,onOpenTemplate:Y},null,8,[`loading`,`workflows`])],2),n(`div`,{class:p(i.$style.details)},[g(G,{"block-title":u(N).baseText(`template.details.appsInTheCollection`),loading:z.value,template:K.value},null,8,[`block-title`,`loading`,`template`])],2)],2)]),key:`0`}]),1024))}}),[[`__cssModules`,{$style:{wrapper:`_wrapper_ibv33_125`,notFound:`_notFound_ibv33_135`,title:`_title_ibv33_139`,button:`_button_ibv33_143`,mainContent:`_mainContent_ibv33_147`,markdown:`_markdown_ibv33_158`,details:`_details_ibv33_162`}}]]);export{K as default};
//# sourceMappingURL=TemplatesCollectionView-BGq5y5qX.js.map