n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 3.61 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]=`ee1a9cdf-4e4f-47bb-a500-2b3be475c913`,e._sentryDebugIdIdentifier=`sentry-dbid-ee1a9cdf-4e4f-47bb-a500-2b3be475c913`)})()}catch{}import{Ft as e}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{Bc as t,Hc as n,Lc as r,Rc as i,Vc as a,zc as o}from"./users.store-BHWXXawf.js";import{j as s,r as c}from"./_baseOrderBy-CaKruttV.js";var l=e=>{let t=e.match(/^[\w\s]+\.[\w\s]+/);if(t&&t?.length>0)return t[0]},u=(e,t=``)=>(e=e.replace(t+`.`,``),e.length>0&&(e=e[0].toUpperCase()+e.substring(1),e=e.replaceAll(`.`,` `)),e),d=(e,t=new Set)=>{let n=[],r=Array.from(e.values()),i=new Set;i.add(`n8n.workflow`),i.add(`n8n.node`);for(let e of r){let t=e.match(/^[\w\s]+\.[\w\s]+/);t&&t?.length>0&&i.add(t[0])}for(let e of i){let i={children:[],label:e,name:e,selected:t.has(e),indeterminate:!1},a=r.filter(t=>t.startsWith(e));for(let n of a){!i.selected&&t.has(n)&&(i.indeterminate=!0);let r={label:u(n,e),name:n,selected:t.has(n),indeterminate:!1};i.children.push(r)}n.push(i)}return n};const f=s(`logStreaming`,()=>{let s=e({}),u=e(new Set),f=c(),p=e=>{if(e.id){if(s.value[e.id]||(s.value[e.id]={destination:e,selectedEvents:new Set,eventGroups:[],isNew:!1}),s.value[e.id]?.selectedEvents?.clear(),e.subscribedEvents)for(let t of e.subscribedEvents)s.value[e.id]?.selectedEvents?.add(t);s.value[e.id].eventGroups=d(u.value,s.value[e.id]?.selectedEvents)}},m=e=>{e.id&&s.value[e.id]?s.value[e.id].destination=e:p(e)},h=e=>{if(s.value[e])return s.value[e].destination},g=()=>Object.values(s.value).map(e=>e.destination),_=()=>{s.value={}},v=e=>{u.value.add(e)},y=e=>{u.value.delete(e)},b=()=>{u.value.clear()},x=(e,t,n)=>{if(!s.value[e])return;let r=l(t),i=s.value[e].eventGroups.find(e=>e.name===r);if(!i)return;let a=i.children;if(r===t){i.selected=n,i.indeterminate=!1,a.forEach(e=>e.selected=!1);return}let o=a.find(e=>e.name===t);if(!o)return;o.selected=n,!n&&i.selected&&(i.selected=!1,i.children.filter(e=>e!==o).forEach(e=>e.selected=!0));let c=a.filter(e=>e.selected);n&&c.length===a.length&&(i.selected=!0,i.children.forEach(e=>e.selected=!1)),i.indeterminate=c.length>0&&c.length<a.length},S=(e,t)=>{s.value[e]?.selectedEvents?.add(t),x(e,t,!0)},C=(e,t)=>{s.value[e]?.selectedEvents?.delete(t),x(e,t,!1)},w=e=>{delete s.value[e]},T=e=>{e.id&&s.value[e.id]&&(s.value[e.id].destination=e)},E=e=>{e&&delete s.value[e]},D=e=>{let t=[];if(s.value[e])for(let n of s.value[e].eventGroups){n.selected&&t.push(n.name);for(let e of n.children)e.selected&&t.push(e.name)}return t};return{addDestination:m,setSelectionAndBuildItems:p,getDestination:h,getAllDestinations:g,clearDestinations:_,addEventName:v,removeEventName:y,clearEventNames:b,addSelectedEvent:S,removeSelectedEvent:C,setSelectedInGroup:x,removeDestinationItemTree:w,updateDestination:T,removeDestination:E,getSelectedEvents:D,saveDestination:async e=>{if(!t(e))return!1;let n=D(e.id);try{return await a(f.restApiContext,e,n),T(e),!0}catch{return!1}},sendTestMessage:async e=>t(e)?await n(f.restApiContext,e):!1,fetchEventNames:async()=>await o(f.restApiContext),fetchDestinations:async()=>await i(f.restApiContext),deleteDestination:async e=>{await r(f.restApiContext,e),E(e)},items:s}});export{f as t};
//# sourceMappingURL=logStreaming.store-CPI4uY9N.js.map