mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
refactor(editor): Stop expecting null
execution status (no-changelog) (#9672)
This commit is contained in:
parent
67932c0b76
commit
b0b4093072
|
@ -185,7 +185,7 @@ export interface IExecutionsCurrentSummary {
|
||||||
startedAt: Date;
|
startedAt: Date;
|
||||||
mode: WorkflowExecuteMode;
|
mode: WorkflowExecuteMode;
|
||||||
workflowId: string;
|
workflowId: string;
|
||||||
status?: ExecutionStatus;
|
status: ExecutionStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IExecutingWorkflowData {
|
export interface IExecutingWorkflowData {
|
||||||
|
|
|
@ -381,6 +381,7 @@ export interface IExecutionBase {
|
||||||
id?: string;
|
id?: string;
|
||||||
finished: boolean;
|
finished: boolean;
|
||||||
mode: WorkflowExecuteMode;
|
mode: WorkflowExecuteMode;
|
||||||
|
status: ExecutionStatus;
|
||||||
retryOf?: string;
|
retryOf?: string;
|
||||||
retrySuccessId?: string;
|
retrySuccessId?: string;
|
||||||
startedAt: Date;
|
startedAt: Date;
|
||||||
|
@ -404,7 +405,6 @@ export interface IExecutionPushResponse {
|
||||||
|
|
||||||
export interface IExecutionResponse extends IExecutionBase {
|
export interface IExecutionResponse extends IExecutionBase {
|
||||||
id: string;
|
id: string;
|
||||||
status: string;
|
|
||||||
data?: IRunExecutionData;
|
data?: IRunExecutionData;
|
||||||
workflowData: IWorkflowDb;
|
workflowData: IWorkflowDb;
|
||||||
executedNode?: string;
|
executedNode?: string;
|
||||||
|
|
|
@ -51,7 +51,7 @@ const isRetriable = computed(() => executionHelpers.isExecutionRetriable(props.e
|
||||||
const classes = computed(() => {
|
const classes = computed(() => {
|
||||||
return {
|
return {
|
||||||
[style.executionListItem]: true,
|
[style.executionListItem]: true,
|
||||||
[style[props.execution.status ?? '']]: !!props.execution.status,
|
[style[props.execution.status]]: true,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ export function useExecutionHelpers() {
|
||||||
|
|
||||||
function isExecutionRetriable(execution: ExecutionSummary): boolean {
|
function isExecutionRetriable(execution: ExecutionSummary): boolean {
|
||||||
return (
|
return (
|
||||||
['crashed', 'error'].includes(execution.status ?? '') &&
|
['crashed', 'error'].includes(execution.status) &&
|
||||||
!execution.retryOf &&
|
!execution.retryOf &&
|
||||||
!execution.retrySuccessId
|
!execution.retrySuccessId
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import type { ExecutionStatus, IDataObject, ExecutionSummary } from 'n8n-workflow';
|
import type { IDataObject, ExecutionSummary } from 'n8n-workflow';
|
||||||
import type {
|
import type {
|
||||||
ExecutionFilterType,
|
ExecutionFilterType,
|
||||||
ExecutionsQueryFilter,
|
ExecutionsQueryFilter,
|
||||||
|
@ -83,7 +83,6 @@ export const useExecutionsStore = defineStore('executions', () => {
|
||||||
function addExecution(execution: ExecutionSummary) {
|
function addExecution(execution: ExecutionSummary) {
|
||||||
executionsById.value[execution.id] = {
|
executionsById.value[execution.id] = {
|
||||||
...execution,
|
...execution,
|
||||||
status: execution.status ?? getExecutionStatus(execution),
|
|
||||||
mode: execution.mode,
|
mode: execution.mode,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -91,7 +90,6 @@ export const useExecutionsStore = defineStore('executions', () => {
|
||||||
function addCurrentExecution(execution: ExecutionSummary) {
|
function addCurrentExecution(execution: ExecutionSummary) {
|
||||||
currentExecutionsById.value[execution.id] = {
|
currentExecutionsById.value[execution.id] = {
|
||||||
...execution,
|
...execution,
|
||||||
status: execution.status ?? getExecutionStatus(execution),
|
|
||||||
mode: execution.mode,
|
mode: execution.mode,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -113,24 +111,6 @@ export const useExecutionsStore = defineStore('executions', () => {
|
||||||
await startAutoRefreshInterval(workflowId);
|
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(
|
async function fetchExecutions(
|
||||||
filter = executionsFilters.value,
|
filter = executionsFilters.value,
|
||||||
lastId?: string,
|
lastId?: string,
|
||||||
|
@ -274,7 +254,6 @@ export const useExecutionsStore = defineStore('executions', () => {
|
||||||
activeExecution,
|
activeExecution,
|
||||||
fetchExecutions,
|
fetchExecutions,
|
||||||
fetchExecution,
|
fetchExecution,
|
||||||
getExecutionStatus,
|
|
||||||
autoRefresh,
|
autoRefresh,
|
||||||
autoRefreshTimeout,
|
autoRefreshTimeout,
|
||||||
startAutoRefreshInterval,
|
startAutoRefreshInterval,
|
||||||
|
|
|
@ -175,11 +175,9 @@ export async function patch(
|
||||||
*
|
*
|
||||||
* @param {IExecutionFlattedResponse} fullExecutionData The data to unflatten
|
* @param {IExecutionFlattedResponse} fullExecutionData The data to unflatten
|
||||||
*/
|
*/
|
||||||
export function unflattenExecutionData(
|
export function unflattenExecutionData(fullExecutionData: IExecutionFlattedResponse) {
|
||||||
fullExecutionData: IExecutionFlattedResponse,
|
|
||||||
): Omit<IExecutionResponse, 'status'> {
|
|
||||||
// Unflatten the data
|
// Unflatten the data
|
||||||
const returnData: Omit<IExecutionResponse, 'status'> = {
|
const returnData: IExecutionResponse = {
|
||||||
...fullExecutionData,
|
...fullExecutionData,
|
||||||
workflowData: fullExecutionData.workflowData,
|
workflowData: fullExecutionData.workflowData,
|
||||||
data: parse(fullExecutionData.data),
|
data: parse(fullExecutionData.data),
|
||||||
|
|
|
@ -2371,7 +2371,7 @@ export interface ExecutionSummary {
|
||||||
stoppedAt?: Date;
|
stoppedAt?: Date;
|
||||||
workflowId: string;
|
workflowId: string;
|
||||||
workflowName?: string;
|
workflowName?: string;
|
||||||
status?: ExecutionStatus;
|
status: ExecutionStatus;
|
||||||
lastNodeExecuted?: string;
|
lastNodeExecuted?: string;
|
||||||
executionError?: ExecutionError;
|
executionError?: ExecutionError;
|
||||||
nodeExecutionStatus?: {
|
nodeExecutionStatus?: {
|
||||||
|
|
Loading…
Reference in a new issue