refactor(editor): Stop expecting null execution status (no-changelog) (#9672)

This commit is contained in:
Iván Ovejero 2024-06-10 10:19:40 +02:00 committed by GitHub
parent 67932c0b76
commit b0b4093072
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 31 deletions

View file

@ -185,7 +185,7 @@ export interface IExecutionsCurrentSummary {
startedAt: Date;
mode: WorkflowExecuteMode;
workflowId: string;
status?: ExecutionStatus;
status: ExecutionStatus;
}
export interface IExecutingWorkflowData {

View file

@ -381,6 +381,7 @@ export interface IExecutionBase {
id?: string;
finished: boolean;
mode: WorkflowExecuteMode;
status: ExecutionStatus;
retryOf?: string;
retrySuccessId?: string;
startedAt: Date;
@ -404,7 +405,6 @@ export interface IExecutionPushResponse {
export interface IExecutionResponse extends IExecutionBase {
id: string;
status: string;
data?: IRunExecutionData;
workflowData: IWorkflowDb;
executedNode?: string;

View file

@ -51,7 +51,7 @@ const isRetriable = computed(() => executionHelpers.isExecutionRetriable(props.e
const classes = computed(() => {
return {
[style.executionListItem]: true,
[style[props.execution.status ?? '']]: !!props.execution.status,
[style[props.execution.status]]: true,
};
});

View file

@ -56,7 +56,7 @@ export function useExecutionHelpers() {
function isExecutionRetriable(execution: ExecutionSummary): boolean {
return (
['crashed', 'error'].includes(execution.status ?? '') &&
['crashed', 'error'].includes(execution.status) &&
!execution.retryOf &&
!execution.retrySuccessId
);

View file

@ -1,6 +1,6 @@
import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
import type { ExecutionStatus, IDataObject, ExecutionSummary } from 'n8n-workflow';
import type { IDataObject, ExecutionSummary } from 'n8n-workflow';
import type {
ExecutionFilterType,
ExecutionsQueryFilter,
@ -83,7 +83,6 @@ export const useExecutionsStore = defineStore('executions', () => {
function addExecution(execution: ExecutionSummary) {
executionsById.value[execution.id] = {
...execution,
status: execution.status ?? getExecutionStatus(execution),
mode: execution.mode,
};
}
@ -91,7 +90,6 @@ export const useExecutionsStore = defineStore('executions', () => {
function addCurrentExecution(execution: ExecutionSummary) {
currentExecutionsById.value[execution.id] = {
...execution,
status: execution.status ?? getExecutionStatus(execution),
mode: execution.mode,
};
}
@ -113,24 +111,6 @@ export const useExecutionsStore = defineStore('executions', () => {
await startAutoRefreshInterval(workflowId);
}
function getExecutionStatus(execution: ExecutionSummary): ExecutionStatus {
if (execution.status) {
return execution.status;
} else {
if (execution.waitTill) {
return 'waiting';
} else if (execution.stoppedAt === undefined) {
return 'running';
} else if (execution.finished) {
return 'success';
} else if (execution.stoppedAt !== null) {
return 'error';
} else {
return 'unknown';
}
}
}
async function fetchExecutions(
filter = executionsFilters.value,
lastId?: string,
@ -274,7 +254,6 @@ export const useExecutionsStore = defineStore('executions', () => {
activeExecution,
fetchExecutions,
fetchExecution,
getExecutionStatus,
autoRefresh,
autoRefreshTimeout,
startAutoRefreshInterval,

View file

@ -175,11 +175,9 @@ export async function patch(
*
* @param {IExecutionFlattedResponse} fullExecutionData The data to unflatten
*/
export function unflattenExecutionData(
fullExecutionData: IExecutionFlattedResponse,
): Omit<IExecutionResponse, 'status'> {
export function unflattenExecutionData(fullExecutionData: IExecutionFlattedResponse) {
// Unflatten the data
const returnData: Omit<IExecutionResponse, 'status'> = {
const returnData: IExecutionResponse = {
...fullExecutionData,
workflowData: fullExecutionData.workflowData,
data: parse(fullExecutionData.data),

View file

@ -2371,7 +2371,7 @@ export interface ExecutionSummary {
stoppedAt?: Date;
workflowId: string;
workflowName?: string;
status?: ExecutionStatus;
status: ExecutionStatus;
lastNodeExecuted?: string;
executionError?: ExecutionError;
nodeExecutionStatus?: {