n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 4.07 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]=`6c42c928-721d-4f22-95fe-f5fb9345b148`,e._sentryDebugIdIdentifier=`sentry-dbid-6c42c928-721d-4f22-95fe-f5fb9345b148`)})()}catch{}import{Ft as e,S as t}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{As as n,Ft as r,S as i,g as a,v as o}from"./users.store-BHWXXawf.js";import{d as s,j as c,r as l}from"./_baseOrderBy-CaKruttV.js";const u=c(`executions`,()=>{let c=l(),u=r(),d=n(),f=e(!1),p=e(10),m=e(null),h=e(o()),g=t(()=>{let e=a(h.value);return u.currentProjectId&&(e.projectId=u.currentProjectId),e}),_=t(()=>({...h.value.workflowId===`all`?{}:{workflowId:h.value.workflowId}})),v=e(!0),y=e(null),b=e(4*1e3),x=e({}),S=e(0),C=e(!1),w=e(0),T=t(()=>{let e=Object.values(x.value);return e.sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()),e}),E=t(()=>T.value.reduce((e,t)=>(e[t.workflowId]||(e[t.workflowId]=[]),e[t.workflowId].push(t),e),{})),D=e({}),O=(e,t)=>new Date(t.startedAt??t.createdAt).getTime()-new Date(e.startedAt??e.createdAt).getTime(),k=d.isConcurrencyEnabled?(e,t)=>{if(e.status&&t.status){let n={running:1,new:2},r=n[e.status]-n[t.status];if(r!==0)return r}return O(e,t)}:O,A=t(()=>{let e=Object.values(D.value);return e.sort(k),e}),j=t(()=>A.value.reduce((e,t)=>(e[t.workflowId]||(e[t.workflowId]=[]),e[t.workflowId].push(t),e),{})),M=t(()=>[...A.value,...T.value]);function N(e){x.value={...x.value,[e.id]:{...e,mode:e.mode}}}function P(e){D.value[e.id]={...e,mode:e.mode}}function F(e){let{[e]:t,...n}=x.value;x.value=n}function I(e){h.value=e}async function L(e){e&&(h.value.workflowId=e),await R(),await V(e)}async function R(e=g.value,t,n){f.value=!0;try{let r=await s(c.restApiContext,`GET`,`/executions`,{...e?{filter:e}:{},...n?{firstId:n}:{},...t?{lastId:t}:{},limit:p.value});return D.value={},r.results.forEach(e=>{[`new`,`running`].includes(e.status)?P(e):N(e)}),S.value=r.count,C.value=r.estimated,w.value=r.concurrentExecutionsCount,r}finally{f.value=!1}}async function z(e){let t=await s(c.restApiContext,`GET`,`/executions/${e}`);return t?i(t):void 0}async function B(e){let t={...g.value,...e?{workflowId:e}:{}};y.value=setTimeout(async()=>{v.value&&(await R(t),V(e))},b.value)}async function V(e){H(),await B(e)}function H(){y.value&&=(clearTimeout(y.value),null)}async function U(e,t){let n=await s(c.restApiContext,`PATCH`,`/executions/${e}`,t);N(n),n.id===m.value?.id&&(m.value=n)}async function W(e){return await s(c.restApiContext,`POST`,`/executions/stopMany`,{filter:{...e,workflowId:h.value.workflowId}})}async function G(e){return await s(c.restApiContext,`POST`,`/executions/${e}/stop`)}async function K(e,t){return await s(c.restApiContext,`POST`,`/executions/${e}/retry`,t?{loadWorkflow:!0}:void 0)}async function q(e){if(await s(c.restApiContext,`POST`,`/executions/delete`,e),e.ids&&e.ids.forEach(F),e.deleteBefore){let t=new Date(e.deleteBefore);M.value.forEach(e=>{new Date(e.startedAt??e.createdAt)<t&&F(e.id)})}}function J(){x.value={},D.value={},S.value=0,C.value=!1,w.value=0}function Y(){p.value=10,h.value=o(),v.value=!0,J(),H()}return{loading:f,annotateExecution:U,executionsById:x,executions:T,executionsCount:S,executionsCountEstimated:C,concurrentExecutionsCount:w,executionsByWorkflowId:E,currentExecutions:A,currentExecutionsByWorkflowId:j,activeExecution:m,fetchExecutions:R,fetchExecution:z,autoRefresh:v,autoRefreshTimeout:y,startAutoRefreshInterval:V,stopAutoRefreshInterval:H,initialize:L,filters:h,setFilters:I,executionsFilters:g,currentExecutionsFilters:_,allExecutions:M,stopCurrentExecution:G,retryExecution:K,deleteExecutions:q,addExecution:N,resetData:J,reset:Y,itemsPerPage:p,stopManyExecutions:W}});export{u as t};
//# sourceMappingURL=executions.store-CZbPSd3l.js.map