Skip to content

Commit

Permalink
fix(editor): Fix execution retry button (#10275)
Browse files Browse the repository at this point in the history
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
  • Loading branch information
cstuncsik and netroy authored Aug 2, 2024
1 parent 57d1c9a commit 55f2ffe
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('WorkflowExecutionsCard', () => {
retryOf: '2',
retrySuccessId: null,
},
false,
true,
],
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,25 @@ describe('useExecutionHelpers()', () => {
);
});
});

describe('isExecutionRetriable', () => {
const { isExecutionRetriable } = useExecutionHelpers();

it.each(['crashed', 'error'])('returns true when execution status is %s', (status) => {
expect(isExecutionRetriable({ status } as ExecutionSummary)).toEqual(true);
});

it.each(['canceled', 'new', 'running', 'success', 'unknown', 'waiting'])(
'returns false when execution status is %s',
(status) => {
expect(isExecutionRetriable({ status } as ExecutionSummary)).toEqual(false);
},
);

it('should return false if retrySuccessId is set', () => {
expect(
isExecutionRetriable({ status: 'crashed', retrySuccessId: '123' } as ExecutionSummary),
).toEqual(false);
});
});
});
6 changes: 1 addition & 5 deletions packages/editor-ui/src/composables/useExecutionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,7 @@ export function useExecutionHelpers() {
}

function isExecutionRetriable(execution: ExecutionSummary): boolean {
return (
['crashed', 'error'].includes(execution.status) &&
!execution.retryOf &&
!execution.retrySuccessId
);
return ['crashed', 'error'].includes(execution.status) && !execution.retrySuccessId;
}

return {
Expand Down

0 comments on commit 55f2ffe

Please sign in to comment.