fix(editor): Remove 'crashed' status from filter (#5524)

* fix(editor): remove 'crashed' status from filter

* fix(editor): remove 'crashed' and 'new' status from filter

* fix(editor): add 'status' to response

* fix(editor): create request filter for workflow level execution filtering

* fix(editor): update filters

* fix(editor): simplify condition

* fix(editor): update filters

* fix(editor): optimizing data loading flow

* fix(editor): always load past executions
This commit is contained in:
Csaba Tuncsik
2023-02-23 11:13:21 +01:00
committed by GitHub
parent 4998ab2350
commit 7c517cb530
9 changed files with 82 additions and 106 deletions

View File

@@ -938,33 +938,24 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, {
Vue.set(this, 'activeExecutions', newActiveExecutions);
},
async loadCurrentWorkflowExecutions(filter: {
finished: boolean;
status: string;
}): Promise<IExecutionsSummary[]> {
async loadCurrentWorkflowExecutions(requestFilter: IDataObject): Promise<IExecutionsSummary[]> {
let activeExecutions = [];
let finishedExecutions = [];
const requestFilter: IDataObject = { workflowId: this.workflowId };
if (!this.workflowId) {
if (!requestFilter.workflowId) {
return [];
}
try {
const rootStore = useRootStore();
if (filter.status === '' || !filter.finished) {
activeExecutions = await getCurrentExecutions(rootStore.getRestApiContext, requestFilter);
}
if (filter.status === '' || filter.finished) {
if (filter.status === 'waiting') {
requestFilter.waitTill = true;
} else if (filter.status !== '') {
requestFilter.finished = filter.status === 'success';
}
finishedExecutions = await getFinishedExecutions(
rootStore.getRestApiContext,
requestFilter,
);
if (!requestFilter.status || !requestFilter.finished) {
activeExecutions = await getCurrentExecutions(rootStore.getRestApiContext, {
workflowId: requestFilter.workflowId,
});
}
finishedExecutions = await getFinishedExecutions(
rootStore.getRestApiContext,
requestFilter,
);
this.finishedExecutionsCount = finishedExecutions.count;
return [...activeExecutions, ...(finishedExecutions.results || [])];
} catch (error) {