Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export interface IExecutionsCurrentSummary {
startedAt: Date;
mode: WorkflowExecuteMode;
workflowId: string;
status?: ExecutionStatus;
status: ExecutionStatus;
}

export interface IExecutingWorkflowData {
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/Interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ export interface IExecutionBase {
id?: string;
finished: boolean;
mode: WorkflowExecuteMode;
status: ExecutionStatus;
retryOf?: string;
retrySuccessId?: string;
startedAt: Date;
Expand All @@ -404,7 +405,6 @@ export interface IExecutionPushResponse {

export interface IExecutionResponse extends IExecutionBase {
id: string;
status: string;
data?: IRunExecutionData;
workflowData: IWorkflowDb;
executedNode?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
});

Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/composables/useExecutionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
23 changes: 1 addition & 22 deletions packages/editor-ui/src/stores/executions.store.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -83,15 +83,13 @@ export const useExecutionsStore = defineStore('executions', () => {
function addExecution(execution: ExecutionSummary) {
executionsById.value[execution.id] = {
...execution,
status: execution.status ?? getExecutionStatus(execution),
mode: execution.mode,
};
}

function addCurrentExecution(execution: ExecutionSummary) {
currentExecutionsById.value[execution.id] = {
...execution,
status: execution.status ?? getExecutionStatus(execution),
mode: execution.mode,
};
}
Expand All @@ -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,
Expand Down Expand Up @@ -274,7 +254,6 @@ export const useExecutionsStore = defineStore('executions', () => {
activeExecution,
fetchExecutions,
fetchExecution,
getExecutionStatus,
autoRefresh,
autoRefreshTimeout,
startAutoRefreshInterval,
Expand Down
6 changes: 2 additions & 4 deletions packages/editor-ui/src/utils/apiUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion packages/workflow/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ export interface ExecutionSummary {
stoppedAt?: Date;
workflowId: string;
workflowName?: string;
status?: ExecutionStatus;
status: ExecutionStatus;
lastNodeExecuted?: string;
executionError?: ExecutionError;
nodeExecutionStatus?: {
Expand Down
Loading