n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 3.6 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.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]=`abe6cb18-f79e-4625-975e-c51dcadda58c`,e._sentryDebugIdIdentifier=`sentry-dbid-abe6cb18-f79e-4625-975e-c51dcadda58c`)})()}catch{}import{Ft as e}from"./vue.runtime.esm-bundler-C3C09Zii.js";import{T as t,t as n}from"./useRootStore-XEREVjMN.js";import{$t as r,Jt as i,Qt as a,Xt as o,Yt as s,Zt as c}from"./settings.store-CAFiYCMH.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},f=t(`logStreaming`,()=>{let t=e({}),u=e(new Set),f=n(),p=e=>{if(e.id){if(t.value[e.id]||(t.value[e.id]={destination:e,selectedEvents:new Set,eventGroups:[],isNew:!1}),t.value[e.id]?.selectedEvents?.clear(),e.subscribedEvents)for(let n of e.subscribedEvents)t.value[e.id]?.selectedEvents?.add(n);t.value[e.id].eventGroups=d(u.value,t.value[e.id]?.selectedEvents)}},m=e=>{e.id&&t.value[e.id]?t.value[e.id].destination=e:p(e)},h=e=>{if(t.value[e])return t.value[e].destination},g=()=>Object.values(t.value).map(e=>e.destination),_=()=>{t.value={}},v=e=>{u.value.add(e)},y=e=>{u.value.delete(e)},b=()=>{u.value.clear()},x=(e,n,r)=>{if(!t.value[e])return;let i=l(n),a=t.value[e].eventGroups.find(e=>e.name===i);if(!a)return;let o=a.children;if(i===n){a.selected=r,a.indeterminate=!1,o.forEach(e=>e.selected=!1);return}let s=o.find(e=>e.name===n);if(!s)return;s.selected=r,!r&&a.selected&&(a.selected=!1,a.children.filter(e=>e!==s).forEach(e=>e.selected=!0));let c=o.filter(e=>e.selected);r&&c.length===o.length&&(a.selected=!0,a.children.forEach(e=>e.selected=!1)),a.indeterminate=c.length>0&&c.length<o.length},S=(e,n)=>{t.value[e]?.selectedEvents?.add(n),x(e,n,!0)},C=(e,n)=>{t.value[e]?.selectedEvents?.delete(n),x(e,n,!1)},w=e=>{delete t.value[e]},T=e=>{e.id&&t.value[e.id]&&(t.value[e.id].destination=e)},E=e=>{e&&delete t.value[e]},D=e=>{let n=[];if(t.value[e])for(let r of t.value[e].eventGroups){r.selected&&n.push(r.name);for(let e of r.children)e.selected&&n.push(e.name)}return n};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(!c(e))return!1;let t=D(e.id);try{return await a(f.restApiContext,e,t),T(e),!0}catch{return!1}},sendTestMessage:async e=>c(e)?await r(f.restApiContext,e):!1,fetchEventNames:async()=>await o(f.restApiContext),fetchDestinations:async()=>await s(f.restApiContext),deleteDestination:async e=>{await i(f.restApiContext,e),E(e)},items:t}});export{f as t};
//# sourceMappingURL=logStreaming.store-DUIyRSVQ.js.map