n8n-editor-ui
Version:
Workflow Editor UI for n8n
2 lines • 16.8 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]=`b7576a2c-bf04-47c7-a863-be1490b78232`,e._sentryDebugIdIdentifier=`sentry-dbid-b7576a2c-bf04-47c7-a863-be1490b78232`)})()}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-C3C09Zii.js";import{at as x}from"./core-Bz5WjPxS.js";import{Di as S,Ji as C,Mt as w,Qi as T,T as E,Xi as D,ct as O,dt as k,jt as A,k as j,lt as M,st as N}from"./src-XqE2yCpG.js";import{t as P}from"./_plugin-vue_export-helper-CIL7EULb.js";import{Pn as F,_ as I,fr as L,s as R,sn as z,sr as B,xr as V,zt as H}from"./users.store-xP93bV7X.js";import{Bo as U,Qc as W,Qo as G,Zo as K}from"./constants-DuQbSl-q.js";import{t as q}from"./settings.store-CAFiYCMH.js";import{t as J}from"./useDebounce-DyDXl6eh.js";import{t as Y}from"./usePageRedirectionHelper-CC6sh9o0.js";import{t as X}from"./executions.store-BkB9JOf7.js";import{t as Z}from"./useInjectWorkflowId-BV3E4pXM.js";import{a as Q,i as $}from"./dateFormatter-uA6jMwOH.js";import{t as ee}from"./useExecutionHelpers-DaszaQT9.js";import{t as te}from"./WorkflowExecutionsInfoAccordion-YeKG277r.js";import{i as ne,n as re,r as ie,t as ae}from"./ExecutionsTime-VvdTfRMo.js";import{t as oe}from"./useIntersectionObserver-Ygaf4Xk3.js";var se={key:2},ce=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=O(),_=x(),v=ee(),C=q(),k=o(()=>C.isEnterpriseFeatureEnabled[W.AdvancedExecutionFilters]),A=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)),F=o(()=>d.execution.id===g.params.executionId),I=o(()=>v.isExecutionRetriable(d.execution));u(()=>{m(`mounted`,d.execution.id)});function L(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]:F.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(D),{key:0,color:`text-dark`,bold:!0,size:`medium`,"data-test-id":`execution-time`},{default:b(()=>[t(s(l($)(P.value.createdAt))+` - `+s(l(_).baseText(`executionDetails.startingSoon`)),1)]),_:1})):(e(),y(l(D),{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(j),{key:0,size:`small`,class:f([a.$style.spinner,`mr-4xs`])},null,8,[`class`])):c(``,!0),h(l(D),{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(D),{key:1,color:F.value?`text-dark`:`text-base`,size:`small`,"data-test-id":`execution-time-in-status`},{default:b(()=>[t(s(l(_).baseText(`executionDetails.runningTimeRunning`))+` `,1),h(ae,{"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(D),{key:2,color:F.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(D),{key:3,color:F.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`,se,[h(l(D),{color:F.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),A.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(T),{key:0,class:f(a.$style.up),icon:`thumbs-up`},null,8,[`class`])):(e(),y(l(T),{key:1,class:f(a.$style.down),icon:`thumbs-down`},null,8,[`class`]))],2)):c(``,!0),P.value.tags.length>0?(e(),y(l(E),{key:1,tags:P.value.tags,clickable:!1},null,8,[`tags`])):c(``,!0)],2)):c(``,!0)],2),n(`div`,{class:f(a.$style.icons)},[I.value?(e(),y(l(w),{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:L},null,8,[`class`,`items`,`disabled`])):c(``,!0),i.execution.mode===`manual`?(e(),y(l(S),{key:1,placement:`top`},{content:b(()=>[n(`span`,null,s(l(_).baseText(`executionsList.test`)),1)]),default:b(()=>[h(l(T),{class:f([a.$style.icon,a.$style.manual]),icon:`flask-conical`},null,8,[`class`])]),_:1})):c(``,!0),i.execution.mode===`evaluation`?(e(),y(l(S),{key:2,placement:`top`},{content:b(()=>[n(`span`,null,s(l(_).baseText(`executionsList.evaluation`)),1)]),default:b(()=>[h(l(T),{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`}}]]),le={key:0,class:`mr-l`},ue={key:3,class:`mr-m`},de=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=O(),w=M(),T=x(),E=X(),j=q(),N=Y(),P=i({activeExecutionSet:!1,cardsMounted:!1,scroll:!0}),F=i({}),I=i(null),{observe:L}=oe({root:I,threshold:.01,onIntersect:()=>g(`loadMore`,20)}),R=o(()=>U(p.workflow?.scopes).workflow),z=o(()=>j.isConcurrencyEnabled&&!j.isQueueModeEnabled);m(()=>S,(e,t)=>{t.name===G.EXECUTION_PREVIEW&&e.name===G.EXECUTION_HOME&&w.go(-1)}),m(()=>E.activeExecution,(e,t)=>{e&&e.id!==t?.id&&(P.value.activeExecutionSet=!0)}),m(P,e=>{Object.values(e).every(Boolean)&&Q()},{deep:!0});function B(e,t){e&&V(e)&&t&&(F.value[t]=e)}function H(e){let t=p.executions.findIndex(t=>t.id===e);if(E.activeExecution?.id===e&&(P.value.activeExecutionSet=!0,P.value.cardsMounted=!0),t===p.executions.length-1&&!p.loading&&!p.loadingMore){let t=F.value[e]?.$el;L(t)}}function W(e=20){if(!p.loading&&I.value){let t=I.value.offsetHeight-(I.value.scrollHeight-I.value.scrollTop);t>-10&&t<10&&g(`loadMore`,e)}}function K(e){g(`retryExecution`,e)}function J(e){P.value.activeExecutionSet=!1,P.value.cardsMounted=!1,P.value.scroll=!0,g(`filterUpdated`,e)}function Z(e){g(`update:autoRefresh`,e)}function Q(){if(I.value&&E.activeExecution&&F.value[E.activeExecution.id]){let e=F.value[E.activeExecution.id].$el.getBoundingClientRect();e.top>I.value.offsetHeight&&(P.value.scroll=!1,I.value.scrollTo({top:e.top-200,behavior:`smooth`}))}}let $=()=>{N.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(C),{tag:`h2`,size:`medium`,color:`text-dark`},{default:b(()=>[t(s(l(T).baseText(`generic.executions`)),1)]),_:1}),z.value?(e(),y(ne,{key:0,"running-executions-count":l(E).concurrentExecutionsCount,"concurrency-cap":l(j).concurrency,"is-cloud-deployment":l(j).isCloudDeployment,onGoToUpgrade:$},null,8,[`running-executions-count`,`concurrency-cap`,`is-cloud-deployment`])):c(``,!0),h(re,{executions:p.executions},null,8,[`executions`])],2),n(`div`,{class:f(i.$style.controls)},[h(l(k),{modelValue:l(E).autoRefresh,"onUpdate:modelValue":[o[0]||=e=>l(E).autoRefresh=e,Z],"data-test-id":`auto-refresh-checkbox`,label:l(T).baseText(`executionsList.autoRefresh`)},null,8,[`modelValue`,`label`]),h(ie,{"popover-side":`right`,"popover-align":`start`,"workflow-id":p.workflow?.id,onFilterChanged:J},null,8,[`workflow-id`])],2),n(`div`,{ref_key:`executionListRef`,ref:I,class:f(i.$style.executionList),"data-test-id":`current-executions-list`,onScroll:o[1]||=e=>W(20)},[a.loading?(e(),r(`div`,le,[h(l(A),{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(D),{color:`text-base`,size:`medium`,align:`center`},{default:b(()=>[t(s(l(T).baseText(`executionsLandingPage.noResults`)),1)]),_:1})],2)):a.temporaryExecution?(e(),y(ce,{key:2,ref:e=>B(e,a.temporaryExecution?.id),execution:a.temporaryExecution,"data-test-id":`execution-details-${a.temporaryExecution.id}`,"show-gap":!0,"workflow-permissions":R.value,onRetryExecution:K},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(ce,{key:t.id,ref_for:!0,ref:e=>B(e,t.id),execution:t,"workflow-permissions":R.value,"data-test-id":`execution-details-${t.id}`,onRetryExecution:K,onMounted:H},null,8,[`execution`,`workflow-permissions`,`data-test-id`]))),128))]),_:1}),a.loadingMore?(e(),r(`div`,ue,[h(l(A),{variant:`p`,rows:1})])):c(``,!0)],34),n(`div`,{class:f(i.$style.infoAccordion)},[h(te,{"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-0357c9fd`]]),fe=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}=H({router:M()}),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 N(async(e,t,n)=>{if(z(e)===K.WORKFLOW){n();return}await s(n)}),(n,i)=>{let o=p(`RouterView`);return e(),r(`div`,{class:f(n.$style.container)},[h(de,{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`}}]]),pe=a({__name:`WorkflowExecutionsView`,setup(t){let n=X(),r=R(),a=B(),s=x(),l=L(),d=O(),f=M(),p=F(),{callDebounced:h}=J(),_=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(()=>{let e=w.value.find(e=>e.id===C.value),t=E.value;return e?t?.id===e.id&&t.workflowVersionId?{...e,workflowVersionId:t.workflowVersionId}:e:t}),E=i(),D=o(()=>d.query.new===`true`);m(()=>S.value,()=>{N()}),m(()=>C.value,async()=>{await k()}),u(async()=>{N(),S.value&&await Promise.all([n.initialize(S.value),k()]),await j(),document.addEventListener(`visibilitychange`,A)}),g(()=>{n.reset(),document.removeEventListener(`visibilitychange`,A)});async function k(){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 A(){document.visibilityState===`hidden`?n.stopAutoRefreshInterval():n.startAutoRefreshInterval(S.value)}async function j(){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 z(){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 V(e){n.reset(),n.setFilters(e),await n.initialize(S.value)}async function H(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 z()}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 z(),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=I((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(Y,{debounceTime:1e3})}async function Y(){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(fe,{key:0,executions:w.value,execution:T.value,workflow:b.value,loading:_.value,"loading-more":v.value,"onExecution:stop":H,"onExecution:delete":U,"onExecution:retry":W,"onUpdate:filters":V,"onUpdate:autoRefresh":P,onLoadMore:q,onReload:z},null,8,[`executions`,`execution`,`workflow`,`loading`,`loading-more`])):c(``,!0)}});export{pe as default};
//# sourceMappingURL=WorkflowExecutionsView-B-XRTKeJ.js.map