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

@@ -26,20 +26,15 @@ import ExecutionsSidebar from '@/components/ExecutionsView/ExecutionsSidebar.vue
import {
MAIN_HEADER_TABS,
MODAL_CANCEL,
MODAL_CLOSE,
MODAL_CONFIRMED,
PLACEHOLDER_EMPTY_WORKFLOW_ID,
VIEWS,
WEBHOOK_NODE_TYPE,
} from '@/constants';
import { IExecutionsListResponse, INodeUi, ITag, IWorkflowDb } from '@/Interface';
import {
IExecutionsListResponse,
ExecutionStatus,
IExecutionsSummary,
INodeUi,
ITag,
IWorkflowDb,
} from '@/Interface';
import {
IConnection,
IConnections,
IDataObject,
@@ -71,7 +66,7 @@ export default mixins(
debounceHelper,
workflowHelpers,
).extend({
name: 'executions-view',
name: 'executions-list',
components: {
ExecutionsSidebar,
},
@@ -87,9 +82,7 @@ export default mixins(
hidePreview(): boolean {
const activeNotPresent =
this.filterApplied &&
(this.executions as IExecutionsSummary[]).find(
(ex) => ex.id === this.activeExecution.id,
) === undefined;
!(this.executions as IExecutionsSummary[]).find((ex) => ex.id === this.activeExecution?.id);
return this.loading || !this.executions.length || activeNotPresent;
},
filterApplied(): boolean {
@@ -107,6 +100,31 @@ export default mixins(
totalFinishedExecutionsCount(): number {
return this.workflowsStore.getTotalFinishedExecutionsCount;
},
requestFilter(): IDataObject {
const rFilter: IDataObject = { workflowId: this.currentWorkflow };
if (this.filter.status === 'waiting') {
rFilter.waitTill = true;
} else if (this.filter.status !== '') {
rFilter.finished = this.filter.status === 'success';
}
switch (this.filter.status as ExecutionStatus) {
case 'waiting':
rFilter.status = ['waiting'];
break;
case 'error':
rFilter.status = ['failed', 'crashed'];
break;
case 'success':
rFilter.status = ['success'];
break;
case 'running':
rFilter.status = ['running'];
break;
}
return rFilter;
},
},
watch: {
$route(to: Route, from: Route) {
@@ -179,7 +197,7 @@ export default mixins(
await this.openWorkflow(this.$route.params.name);
this.uiStore.nodeViewInitialized = false;
if (this.workflowsStore.currentWorkflowExecutions.length === 0) {
this.setExecutions();
await this.setExecutions();
}
if (this.activeExecution) {
this.$router
@@ -193,7 +211,7 @@ export default mixins(
},
async onLoadMore(): Promise<void> {
if (!this.loadingMore) {
this.callDebounced('loadMore', { debounceTime: 1000 });
await this.callDebounced('loadMore', { debounceTime: 1000 });
}
},
async loadMore(limit = 20): Promise<void> {
@@ -211,15 +229,9 @@ export default mixins(
lastId = lastItem.id;
}
const requestFilter: IDataObject = { workflowId: this.currentWorkflow };
if (this.filter.status === 'waiting') {
requestFilter.waitTill = true;
} else if (this.filter.status !== '') {
requestFilter.finished = this.filter.status === 'success';
}
let data: IExecutionsListResponse;
try {
data = await this.restApi().getPastExecutions(requestFilter, limit, lastId);
data = await this.restApi().getPastExecutions(this.requestFilter, limit, lastId);
} catch (error) {
this.loadingMore = false;
this.$showError(error, this.$locale.baseText('executionsList.showError.loadMore.title'));
@@ -344,7 +356,7 @@ export default mixins(
if (existingStillRunning && currentFinished) {
existingExecutions[executionIndex] = currentItem;
if (currentItem.id === this.activeExecution.id) {
if (currentItem.id === this.activeExecution?.id) {
updatedActiveExecution = currentItem;
}
}
@@ -371,7 +383,7 @@ export default mixins(
if (updatedActiveExecution !== null) {
this.workflowsStore.activeWorkflowExecution = updatedActiveExecution;
} else {
const activeInList = existingExecutions.some((ex) => ex.id === this.activeExecution.id);
const activeInList = existingExecutions.some((ex) => ex.id === this.activeExecution?.id);
if (!activeInList && this.executions.length > 0) {
this.$router
.push({
@@ -390,7 +402,7 @@ export default mixins(
return [];
}
try {
return await this.workflowsStore.loadCurrentWorkflowExecutions(this.filter);
return await this.workflowsStore.loadCurrentWorkflowExecutions(this.requestFilter);
} catch (error) {
if (error.errorCode === NO_NETWORK_ERROR_CODE) {
this.$showMessage(
@@ -452,7 +464,10 @@ export default mixins(
}
// stop if the execution wasn't found in the first 1000 lookups
if (attemptCount >= 10) return;
if (attemptCount >= 10) {
this.workflowsStore.activeWorkflowExecution = null;
return;
}
// Fetch next batch of executions
await this.loadMore(100);
@@ -619,8 +634,7 @@ export default mixins(
}
},
async loadActiveWorkflows(): Promise<void> {
const activeWorkflows = await this.restApi().getActiveWorkflows();
this.workflowsStore.activeWorkflows = activeWorkflows;
this.workflowsStore.activeWorkflows = await this.restApi().getActiveWorkflows();
},
async onRetryExecution(payload: { execution: IExecutionsSummary; command: string }) {
const loadWorkflow = payload.command === 'current-workflow';