n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 17 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]=`4d919002-0537-4278-9de8-d3e988c1e5ca`,e._sentryDebugIdIdentifier=`sentry-dbid-4d919002-0537-4278-9de8-d3e988c1e5ca`)})()}catch{}import{$ as e,A as t,C as n,E as r,Ft as i,N as a,S as o,Sn as s,T as c,Wt as l,X as u,_ as d,_n as f,at as p,gt as m,j as h,q as g,r as _,rt as v,w as y,yt as b}from"./vue.runtime.esm-bundler-D9KLAxvJ.js";import{bt as x}from"./_MapCache-CUJwh2qp.js";import{$i as S,Bt as C,Mi as w,P as T,R as E,Yi as D,Zi as O,_t as k,gt as A,ht as j,yt as M,zt as N}from"./src-wni2AGA3.js";import{t as P}from"./_plugin-vue_export-helper-Dm3nT7Ps.js";import"./sanitize-html-my1ogl5v.js";import"./date-picker-_u2qOcgh.js";import{As as F,Gr as I,Tr as L,Un as R,Xr as z,_ as B,en as V,s as H,yn as U}from"./users.store-BHWXXawf.js";import{is as W,ms as G,pl as K,ps as q}from"./constants-CIP7tKq1.js";import"./merge-BqvKZ38d.js";import{s as J}from"./_baseOrderBy-CaKruttV.js";import"./dateformat-CYfyw486.js";import{t as Y}from"./useDebounce-CTeIt-cH.js";import"./versions.store-CNV-esbv.js";import{t as ee}from"./usePageRedirectionHelper-Dxb_B6-R.js";import{t as X}from"./executions.store-CZbPSd3l.js";import{t as Z}from"./useInjectWorkflowId-BSmCE6rY.js";import{a as Q,i as te}from"./dateFormatter-aoRZizgK.js";import{t as ne}from"./useExecutionHelpers-D8SD8Eej.js";import"./TagsDropdown-DD1kUoaA.js";import"./WorkflowTagsDropdown-BqoujWpp.js";import{t as re}from"./WorkflowExecutionsInfoAccordion-C3OaFKJX.js";import"./AnnotationTagsDropdown.ee-Dib88PNH.js";import{i as ie,n as ae,r as oe,t as se}from"./ExecutionsTime-CnDmC4T3.js";import{t as ce}from"./useIntersectionObserver-nLSY8GHt.js";var le={key:2},$=P(a({__name:`WorkflowExecutionsCard`,props:{execution:{},highlight:{type:Boolean},showGap:{type:Boolean},workflowPermissions:{}},emits:[`retryExecution`,`mounted`],setup(i,{emit:a}){let d=i,m=a,g=A(),_=x(),v=ne(),D=F(),k=o(()=>D.isEnterpriseFeatureEnabled[K.AdvancedExecutionFilters]),j=o(()=>k.value),M=Z(),N=o(()=>[{id:`current-workflow`,label:_.baseText(`executionsList.retryWithCurrentlySavedWorkflow`)},{id:`original-workflow`,label:_.baseText(`executionsList.retryWithOriginalWorkflow`)}]),P=o(()=>v.getUIDetails(d.execution)),I=o(()=>d.execution.id===g.params.executionId),L=o(()=>v.isExecutionRetriable(d.execution));u(()=>{m(`mounted`,d.execution.id)});function R(e){m(`retryExecution`,{execution:d.execution,command:e})}return(a,o)=>{let u=p(`RouterLink`);return e(),r(`div`,{class:f({"execution-card":!0,[a.$style.WorkflowExecutionsCard]:!0,[a.$style.active]:I.value,[a.$style[P.value.name]]:!0,[a.$style.highlight]:i.highlight,[a.$style.showGap]:i.showGap})},[h(u,{class:f(a.$style.executionLink),to:{name:l(G).EXECUTION_PREVIEW,params:{name:l(M),executionId:i.execution.id},query:l(g).query},"data-test-execution-status":P.value.name},{default:b(()=>[n(`div`,{class:f(a.$style.description)},[P.value.name===`new`?(e(),y(l(O),{key:0,color:`text-dark`,bold:!0,size:`medium`,"data-test-id":`execution-time`},{default:b(()=>[t(s(l(te)(P.value.createdAt))+` - `+s(l(_).baseText(`executionDetails.startingSoon`)),1)]),_:1})):(e(),y(l(O),{key:1,color:`text-dark`,bold:!0,size:`medium`,"data-test-id":`execution-time`},{default:b(()=>[t(s(P.value.startTime),1)]),_:1})),n(`div`,{class:f(a.$style.executionStatus)},[P.value.name===`running`?(e(),y(l(E),{key:0,size:`small`,class:f([a.$style.spinner,`mr-4xs`])},null,8,[`class`])):c(``,!0),h(l(O),{class:f(a.$style.statusLabel),size:`small`},{default:b(()=>[t(s(P.value.label),1)]),_:1},8,[`class`]),o[0]||=t(` `+s(` `)+` `,-1),P.value.name===`running`&&!i.execution.stoppedAt?(e(),y(l(O),{key:1,color:I.value?`text-dark`:`text-base`,size:`small`,"data-test-id":`execution-time-in-status`},{default:b(()=>[t(s(l(_).baseText(`executionDetails.runningTimeRunning`))+` `,1),h(se,{"start-time":i.execution.startedAt??i.execution.createdAt},null,8,[`start-time`])]),_:1},8,[`color`])):c(``,!0),P.value.name===`new`&&i.execution.createdAt?(e(),y(l(O),{key:2,color:I.value?`text-dark`:`text-base`,size:`small`},{default:b(()=>[n(`span`,null,s(l(_).baseText(`executionDetails.at`))+` `+s(l(Q)(i.execution.createdAt)),1)]),_:1},8,[`color`])):P.value.runningTime===``?c(``,!0):(e(),y(l(O),{key:3,color:I.value?`text-dark`:`text-base`,size:`small`},{default:b(()=>[t(s(l(_).baseText(`executionDetails.runningTimeFinished`,{interpolate:{time:P.value?.runningTime}})),1)]),_:1},8,[`color`]))],2),i.execution.mode===`retry`?(e(),r(`div`,le,[h(l(O),{color:I.value?`text-dark`:`text-base`,size:`small`},{default:b(()=>[t(s(l(_).baseText(`executionDetails.retry`))+` #`+s(i.execution.retryOf),1)]),_:1},8,[`color`])])):c(``,!0),j.value?(e(),r(`div`,{key:3,class:f(a.$style.annotation)},[i.execution.annotation?.vote?(e(),r(`div`,{key:0,class:f(a.$style.ratingIcon)},[i.execution.annotation.vote==`up`?(e(),y(l(S),{key:0,class:f(a.$style.up),icon:`thumbs-up`},null,8,[`class`])):(e(),y(l(S),{key:1,class:f(a.$style.down),icon:`thumbs-down`},null,8,[`class`]))],2)):c(``,!0),P.value.tags.length>0?(e(),y(l(T),{key:1,tags:P.value.tags,clickable:!1},null,8,[`tags`])):c(``,!0)],2)):c(``,!0)],2),n(`div`,{class:f(a.$style.icons)},[L.value?(e(),y(l(C),{key:0,class:f([a.$style.icon,a.$style.retry]),items:N.value,disabled:!i.workflowPermissions.execute,"activator-icon":`redo-2`,"data-test-id":`retry-execution-button`,onSelect:R},null,8,[`class`,`items`,`disabled`])):c(``,!0),i.execution.mode===`manual`?(e(),y(l(w),{key:1,placement:`top`},{content:b(()=>[n(`span`,null,s(l(_).baseText(`executionsList.test`)),1)]),default:b(()=>[h(l(S),{class:f([a.$style.icon,a.$style.manual]),icon:`flask-conical`},null,8,[`class`])]),_:1})):c(``,!0),i.execution.mode===`evaluation`?(e(),y(l(w),{key:2,placement:`top`},{content:b(()=>[n(`span`,null,s(l(_).baseText(`executionsList.evaluation`)),1)]),default:b(()=>[h(l(S),{class:f([a.$style.icon,a.$style.evaluation]),icon:`check-check`},null,8,[`class`])]),_:1})):c(``,!0)],2)]),_:1},8,[`class`,`to`,`data-test-execution-status`])],2)}}}),[[`__cssModules`,{$style:{WorkflowExecutionsCard:`_WorkflowExecutionsCard_m24vz_125`,active:`_active_m24vz_132`,executionStatus:`_executionStatus_m24vz_135`,executionLink:`_executionLink_m24vz_138`,new:`_new_m24vz_141`,spinner:`_spinner_m24vz_141`,running:`_running_m24vz_141`,statusLabel:`_statusLabel_m24vz_148`,success:`_success_m24vz_153`,waiting:`_waiting_m24vz_162`,error:`_error_m24vz_168`,unknown:`_unknown_m24vz_174`,annotation:`_annotation_m24vz_177`,ratingIcon:`_ratingIcon_m24vz_184`,up:`_up_m24vz_184`,down:`_down_m24vz_187`,icon:`_icon_m24vz_204`,icons:`_icons_m24vz_209`,retry:`_retry_m24vz_217`,manual:`_manual_m24vz_220`,showGap:`_showGap_m24vz_228`}}]]),ue={key:0,class:`mr-l`},de={key:3,class:`mr-m`},fe=P(a({__name:`WorkflowExecutionsSidebar`,props:{workflow:{},executions:{},loading:{type:Boolean},loadingMore:{type:Boolean},temporaryExecution:{}},emits:[`retryExecution`,`loadMore`,`filterUpdated`,`update:autoRefresh`,`execution:stopMany`],setup(a,{emit:u}){let p=a,g=u,S=A(),C=k(),w=x(),T=X(),E=F(),j=ee(),P=i({activeExecutionSet:!1,cardsMounted:!1,scroll:!0}),I=i({}),L=i(null),{observe:R}=ce({root:L,threshold:.01,onIntersect:()=>g(`loadMore`,20)}),B=o(()=>W(p.workflow?.scopes).workflow),V=o(()=>E.isConcurrencyEnabled&&!E.isQueueModeEnabled);m(()=>S,(e,t)=>{t.name===G.EXECUTION_PREVIEW&&e.name===G.EXECUTION_HOME&&C.go(-1)}),m(()=>T.activeExecution,(e,t)=>{e&&e.id!==t?.id&&(P.value.activeExecutionSet=!0)}),m(P,e=>{Object.values(e).every(Boolean)&&Z()},{deep:!0});function H(e,t){e&&z(e)&&t&&(I.value[t]=e)}function U(e){let t=p.executions.findIndex(t=>t.id===e);if(T.activeExecution?.id===e&&(P.value.activeExecutionSet=!0,P.value.cardsMounted=!0),t===p.executions.length-1&&!p.loading&&!p.loadingMore){let t=I.value[e]?.$el;R(t)}}function K(e=20){if(!p.loading&&L.value){let t=L.value.offsetHeight-(L.value.scrollHeight-L.value.scrollTop);t>-10&&t<10&&g(`loadMore`,e)}}function q(e){g(`retryExecution`,e)}function J(e){P.value.activeExecutionSet=!1,P.value.cardsMounted=!1,P.value.scroll=!0,g(`filterUpdated`,e)}function Y(e){g(`update:autoRefresh`,e)}function Z(){if(L.value&&T.activeExecution&&I.value[T.activeExecution.id]){let e=I.value[T.activeExecution.id].$el.getBoundingClientRect();e.top>L.value.offsetHeight&&(P.value.scroll=!1,L.value.scrollTo({top:e.top-200,behavior:`smooth`}))}}let Q=()=>{j.goToUpgrade(`concurrency`,`upgrade-concurrency`)};return(i,o)=>(e(),r(`div`,{class:f([`executions-sidebar`,i.$style.container]),"data-test-id":`executions-sidebar`},[n(`div`,{class:f(i.$style.heading)},[h(l(D),{tag:`h2`,size:`medium`,color:`text-dark`},{default:b(()=>[t(s(l(w).baseText(`generic.executions`)),1)]),_:1}),V.value?(e(),y(ie,{key:0,"running-executions-count":l(T).concurrentExecutionsCount,"concurrency-cap":l(E).concurrency,"is-cloud-deployment":l(E).isCloudDeployment,onGoToUpgrade:Q},null,8,[`running-executions-count`,`concurrency-cap`,`is-cloud-deployment`])):c(``,!0),h(ae,{executions:p.executions},null,8,[`executions`])],2),n(`div`,{class:f(i.$style.controls)},[h(l(M),{modelValue:l(T).autoRefresh,"onUpdate:modelValue":[o[0]||=e=>l(T).autoRefresh=e,Y],"data-test-id":`auto-refresh-checkbox`,label:l(w).baseText(`executionsList.autoRefresh`)},null,8,[`modelValue`,`label`]),h(oe,{"popover-side":`right`,"popover-align":`start`,onFilterChanged:J})],2),n(`div`,{ref_key:`executionListRef`,ref:L,class:f(i.$style.executionList),"data-test-id":`current-executions-list`,onScroll:o[1]||=e=>K(20)},[a.loading?(e(),r(`div`,ue,[h(l(N),{variant:`rect`})])):c(``,!0),!a.loading&&a.executions.length===0?(e(),r(`div`,{key:1,class:f(i.$style.noResultsContainer),"data-test-id":`execution-list-empty`},[h(l(O),{color:`text-base`,size:`medium`,align:`center`},{default:b(()=>[t(s(l(w).baseText(`executionsLandingPage.noResults`)),1)]),_:1})],2)):a.temporaryExecution?(e(),y($,{key:2,ref:e=>H(e,a.temporaryExecution?.id),execution:a.temporaryExecution,"data-test-id":`execution-details-${a.temporaryExecution.id}`,"show-gap":!0,"workflow-permissions":B.value,onRetryExecution:q},null,8,[`execution`,`data-test-id`,`workflow-permissions`])):c(``,!0),h(_,{name:`executions-list`},{default:b(()=>[(e(!0),r(d,null,v(a.executions,t=>(e(),y($,{key:t.id,ref_for:!0,ref:e=>H(e,t.id),execution:t,"workflow-permissions":B.value,"data-test-id":`execution-details-${t.id}`,onRetryExecution:q,onMounted:U},null,8,[`execution`,`workflow-permissions`,`data-test-id`]))),128))]),_:1}),a.loadingMore?(e(),r(`div`,de,[h(l(N),{variant:`p`,rows:1})])):c(``,!0)],34),n(`div`,{class:f(i.$style.infoAccordion)},[h(re,{"initially-expanded":!1})],2)],2))}}),[[`__cssModules`,{$style:{container:`_container_1nvjo_125`,heading:`_heading_1nvjo_137`,controls:`_controls_1nvjo_144`,executionList:`_executionList_1nvjo_152`,infoAccordion:`_infoAccordion_1nvjo_170`,noResultsContainer:`_noResultsContainer_1nvjo_183`}}],[`__scopeId`,`data-v-b9def645`]]),pe=P(a({__name:`WorkflowExecutionsList`,props:{loading:{type:Boolean,default:!1},workflow:{},executions:{default:()=>[]},execution:{},loadingMore:{type:Boolean,default:!1}},emits:[`execution:delete`,`execution:stop`,`execution:retry`,`update:auto-refresh`,`update:filters`,`load-more`,`reload`],setup(t,{emit:n}){let i=t,a=n,{promptSaveUnsavedWorkflowChanges:s}=U({router:k()}),l=o(()=>i.executions.find(e=>e.id===i.execution?.id)?void 0:i.execution??void 0),u=o(()=>i.loading||!i.execution&&i.executions.length),d=()=>{i.execution?.id&&a(`execution:delete`,i.execution.id)},m=()=>{i.execution?.id&&a(`execution:stop`,i.execution.id)},g=e=>{let t=e.command===`current-workflow`;a(`execution:retry`,{id:e.execution.id,loadWorkflow:t})};return j(async(e,t,n)=>{if(R(e)===q.WORKFLOW){n();return}await s(n)}),(n,i)=>{let o=p(`RouterView`);return e(),r(`div`,{class:f(n.$style.container)},[h(fe,{executions:t.executions,loading:t.loading&&!t.executions.length,"loading-more":t.loadingMore,"temporary-execution":l.value,workflow:t.workflow,"onUpdate:autoRefresh":i[0]||=e=>a(`update:auto-refresh`,e),onReloadExecutions:i[1]||=e=>a(`reload`),onFilterUpdated:i[2]||=e=>a(`update:filters`,e),onLoadMore:i[3]||=e=>a(`load-more`),onRetryExecution:g},null,8,[`executions`,`loading`,`loading-more`,`temporary-execution`,`workflow`]),u.value?c(``,!0):(e(),r(`div`,{key:0,class:f(n.$style.content)},[h(o,{name:`executionPreview`,execution:t.execution,onDeleteCurrentExecution:d,onRetryExecution:g,onStopExecution:m},null,8,[`execution`])],2))],2)}}}),[[`__cssModules`,{$style:{container:`_container_pd7qp_125`,content:`_content_pd7qp_131`}}]]),me=a({__name:`WorkflowExecutionsView`,setup(t){let n=X(),r=H(),a=I(),s=x(),l=V(),d=A(),f=k(),p=L(),{callDebounced:h}=Y(),_=i(!1),v=i(!1),b=i(),S=Z(),C=o(()=>{let e=d.params.executionId;return typeof e==`string`?e:void 0}),w=o(()=>S.value?[...n.currentExecutionsByWorkflowId[S.value]??[],...n.executionsByWorkflowId[S.value]??[]]:[]),T=o(()=>w.value.find(e=>e.id===C.value)??E.value),E=i(),D=o(()=>d.query.new===`true`);m(()=>S.value,()=>{N()}),m(()=>C.value,async()=>{await O()}),u(async()=>{N(),S.value&&await Promise.all([n.initialize(S.value),O()]),await M(),document.addEventListener(`visibilitychange`,j)}),g(()=>{n.reset(),document.removeEventListener(`visibilitychange`,j)});async function O(){if(C.value){try{E.value=await n.fetchExecution(C.value),n.activeExecution=E.value}catch(e){p.showError(e,s.baseText(`nodeView.showError.openExecution.title`))}if(!E.value){p.showMessage({type:`error`,title:s.baseText(`openExecution.missingExeuctionId.title`),message:s.baseText(`openExecution.missingExeuctionId.message`)});return}}}function j(){document.visibilityState===`hidden`?n.stopAutoRefreshInterval():n.startAutoRefreshInterval(S.value)}async function M(){d.name===G.EXECUTION_HOME&&w.value.length>0&&b.value&&await f.replace({name:G.EXECUTION_PREVIEW,params:{name:b.value.id,executionId:w.value[0].id},query:d.query}).catch(()=>{})}function N(){if(D.value||!S.value){b.value=r.workflow;return}b.value=a.workflowsById[S.value]??r.workflow}async function P(e){e?await n.startAutoRefreshInterval(S.value):n.stopAutoRefreshInterval()}async function F(){if(S.value)try{await n.fetchExecutions({...n.executionsFilters,workflowId:S.value})}catch(e){e.errorCode===999?p.showMessage({title:s.baseText(`executionsList.showError.refreshData.title`),message:e.message,type:`error`,duration:3500},!1):p.showError(e,s.baseText(`executionsList.showError.refreshData.title`))}}async function R(e){n.reset(),n.setFilters(e),await n.initialize(S.value)}async function z(e){if(e)try{await n.stopCurrentExecution(e),p.showMessage({title:s.baseText(`executionsList.showMessage.stopExecution.title`),message:s.baseText(`executionsList.showMessage.stopExecution.message`,{interpolate:{activeExecutionId:e}}),type:`success`}),await F()}catch(e){p.showError(e,s.baseText(`executionsList.showError.stopExecution.title`))}}async function U(e){if(e){_.value=!0;try{let t=w.value.findIndex(t=>t.id===e),r=w.value[t+1]||w.value[t-1]||w.value[0];await n.deleteExecutions({ids:[e]}),b.value&&(w.value.length>0?await f.replace({name:G.EXECUTION_PREVIEW,params:{name:b.value.id,executionId:r.id}}).catch(()=>{}):await f.replace({name:G.EXECUTION_HOME,params:{name:b.value.id}}))}catch(e){_.value=!1,p.showError(e,s.baseText(`executionsList.showError.handleDeleteSelected.title`));return}_.value=!1,p.showMessage({title:s.baseText(`executionsList.showMessage.handleDeleteSelected.title`),type:`success`})}}async function W(e){p.showMessage({title:s.baseText(`executionDetails.runningMessage`),type:`info`,duration:2e3}),await K(e),await F(),l.track(`User clicked retry execution button`,{workflow_id:b.value?.id,execution_id:e.id,retry_type:e.loadWorkflow?`current`:`original`})}async function K(e){try{let t=B((await n.retryExecution(e.id,e.loadWorkflow)).status);t&&p.showMessage(t)}catch(e){p.showError(e,s.baseText(`executionsList.showError.retryExecution.title`))}}async function q(){v.value||await h(J,{debounceTime:1e3})}async function J(){if(n.executionsFilters.status?.includes(`running`)||w.value.length>=n.executionsCount)return;v.value=!0;let e;w.value.length!==0&&(e=w.value.slice(-1)[0].id);try{await n.fetchExecutions(n.executionsFilters,e)}catch(e){v.value=!1,p.showError(e,s.baseText(`executionsList.showError.loadMore.title`));return}v.value=!1}return(t,n)=>b.value?(e(),y(pe,{key:0,executions:w.value,execution:T.value,workflow:b.value,loading:_.value,"loading-more":v.value,"onExecution:stop":z,"onExecution:delete":U,"onExecution:retry":W,"onUpdate:filters":R,"onUpdate:autoRefresh":P,onLoadMore:q,onReload:F},null,8,[`executions`,`execution`,`workflow`,`loading`,`loading-more`])):c(``,!0)}});export{me as default};
//# sourceMappingURL=WorkflowExecutionsView-CzJOPmej.js.map