diff --git a/packages/editor-ui/src/components/ExecutionsList.vue b/packages/editor-ui/src/components/ExecutionsList.vue index fd30d70660..da6888cfb0 100644 --- a/packages/editor-ui/src/components/ExecutionsList.vue +++ b/packages/editor-ui/src/components/ExecutionsList.vue @@ -16,7 +16,19 @@ -   +   + + + + + + + +   @@ -169,6 +181,7 @@ export default mixins( checkAll: false, filter: { + status: 'ALL', workflowId: 'ALL', }, @@ -180,6 +193,24 @@ export default mixins( stoppingExecutions: [] as string[], workflows: [] as IWorkflowShortResponse[], + statuses: [ + { + id: 'ALL', + name: 'Any Status', + }, + { + id: 'error', + name: 'Error', + }, + { + id: 'running', + name: 'Running', + }, + { + id: 'success', + name: 'Success', + }, + ], }; }, @@ -190,8 +221,12 @@ export default mixins( combinedExecutions (): IExecutionsSummary[] { const returnData: IExecutionsSummary[] = []; - returnData.push.apply(returnData, this.activeExecutions); - returnData.push.apply(returnData, this.finishedExecutions); + if (['ALL', 'running'].includes(this.filter.status)) { + returnData.push.apply(returnData, this.activeExecutions); + } + if (['ALL', 'error', 'success'].includes(this.filter.status)) { + returnData.push.apply(returnData, this.finishedExecutions); + } return returnData; }, @@ -215,13 +250,23 @@ export default mixins( } return false; }, - workflowFilter (): IDataObject { + workflowFilterCurrent (): IDataObject { const filter: IDataObject = {}; if (this.filter.workflowId !== 'ALL') { filter.workflowId = this.filter.workflowId; } return filter; }, + workflowFilterPast (): IDataObject { + const filter: IDataObject = {}; + if (this.filter.workflowId !== 'ALL') { + filter.workflowId = this.filter.workflowId; + } + if (['error', 'success'].includes(this.filter.status)) { + filter.finished = this.filter.status === 'success'; + } + return filter; + }, }, watch: { dialogVisible (newValue, oldValue) { @@ -272,7 +317,7 @@ export default mixins( sendData.ids = Object.keys(this.selectedItems); } - sendData.filters = this.workflowFilter; + sendData.filters = this.workflowFilterPast; try { await this.restApi().deleteExecutions(sendData); @@ -315,7 +360,7 @@ export default mixins( return workflow.name; }, async loadActiveExecutions (): Promise { - const activeExecutions = await this.restApi().getCurrentExecutions(this.workflowFilter); + const activeExecutions = await this.restApi().getCurrentExecutions(this.workflowFilterCurrent); for (const activeExecution of activeExecutions) { if (activeExecution.workflowId !== undefined && activeExecution.workflowName === undefined) { activeExecution.workflowName = this.getWorkflowName(activeExecution.workflowId); @@ -325,14 +370,23 @@ export default mixins( this.$store.commit('setActiveExecutions', activeExecutions); }, async loadFinishedExecutions (): Promise { - const data = await this.restApi().getPastExecutions(this.workflowFilter, this.requestItemsPerRequest); + if (this.filter.status === 'running') { + this.finishedExecutions = []; + this.finishedExecutionsCount = 0; + return; + } + const data = await this.restApi().getPastExecutions(this.workflowFilterPast, this.requestItemsPerRequest); this.finishedExecutions = data.results; this.finishedExecutionsCount = data.count; }, async loadMore () { + if (this.filter.status === 'running') { + return; + } + this.isDataLoading = true; - const filter = this.workflowFilter; + const filter = this.workflowFilterPast; let lastId: string | number | undefined; if (this.finishedExecutions.length !== 0) { @@ -370,7 +424,7 @@ export default mixins( // @ts-ignore workflows.unshift({ id: 'ALL', - name: 'All', + name: 'All Workflows', }); Vue.set(this, 'workflows', workflows);