fix(editor): Fix execution retry button (#10275)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Csaba Tuncsik 2024-08-02 16:05:17 +02:00 committed by GitHub
parent 57d1c9a99e
commit 55f2ffe256
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 6 deletions

View file

@ -51,7 +51,7 @@ describe('WorkflowExecutionsCard', () => {
retryOf: '2',
retrySuccessId: null,
},
false,
true,
],
[
{

View file

@ -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);
});
});
});

View file

@ -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 {