mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Fix displaying logic of execution retry button (#9061)
This commit is contained in:
@@ -894,15 +894,6 @@ export default defineComponent({
|
|||||||
this.showError(error, this.i18n.baseText('executionsList.showError.stopExecution.title'));
|
this.showError(error, this.i18n.baseText('executionsList.showError.stopExecution.title'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isExecutionRetriable(execution: ExecutionSummary): boolean {
|
|
||||||
return (
|
|
||||||
execution.stoppedAt !== undefined &&
|
|
||||||
!execution.finished &&
|
|
||||||
execution.retryOf === undefined &&
|
|
||||||
execution.retrySuccessId === undefined &&
|
|
||||||
!execution.waitTill
|
|
||||||
);
|
|
||||||
},
|
|
||||||
async deleteExecution(execution: ExecutionSummary) {
|
async deleteExecution(execution: ExecutionSummary) {
|
||||||
this.isDataLoading = true;
|
this.isDataLoading = true;
|
||||||
try {
|
try {
|
||||||
@@ -1160,6 +1151,7 @@ export default defineComponent({
|
|||||||
background: var(--execution-card-border-waiting);
|
background: var(--execution-card-border-waiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.canceled td:first-child::before,
|
||||||
&.unknown td:first-child::before {
|
&.unknown td:first-child::before {
|
||||||
background: var(--execution-card-border-unknown);
|
background: var(--execution-card-border-unknown);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div :class="$style.icons">
|
<div :class="$style.icons">
|
||||||
<n8n-action-dropdown
|
<n8n-action-dropdown
|
||||||
v-if="executionUIDetails.name === 'error'"
|
v-if="isRetriable"
|
||||||
:class="[$style.icon, $style.retry]"
|
:class="[$style.icon, $style.retry]"
|
||||||
:items="retryExecutionActions"
|
:items="retryExecutionActions"
|
||||||
activator-icon="redo"
|
activator-icon="redo"
|
||||||
@@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import type { ExecutionSummary } from '@/Interface';
|
import type { ExecutionSummary } from 'n8n-workflow';
|
||||||
import type { IExecutionUIData } from '@/mixins/executionsHelpers';
|
import type { IExecutionUIData } from '@/mixins/executionsHelpers';
|
||||||
import { executionHelpers } from '@/mixins/executionsHelpers';
|
import { executionHelpers } from '@/mixins/executionsHelpers';
|
||||||
import { VIEWS } from '@/constants';
|
import { VIEWS } from '@/constants';
|
||||||
@@ -133,6 +133,9 @@ export default defineComponent({
|
|||||||
isActive(): boolean {
|
isActive(): boolean {
|
||||||
return this.execution.id === this.$route.params.executionId;
|
return this.execution.id === this.$route.params.executionId;
|
||||||
},
|
},
|
||||||
|
isRetriable(): boolean {
|
||||||
|
return this.isExecutionRetriable(this.execution);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onRetryMenuItemSelect(action: string): void {
|
onRetryMenuItemSelect(action: string): void {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
</n8n-button>
|
</n8n-button>
|
||||||
|
|
||||||
<ElDropdown
|
<ElDropdown
|
||||||
v-if="executionUIDetails?.name === 'error'"
|
v-if="isRetriable"
|
||||||
ref="retryDropdown"
|
ref="retryDropdown"
|
||||||
trigger="click"
|
trigger="click"
|
||||||
class="mr-xs"
|
class="mr-xs"
|
||||||
@@ -190,6 +190,9 @@ export default defineComponent({
|
|||||||
type: 'primary',
|
type: 'primary',
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
isRetriable(): boolean {
|
||||||
|
return !!this.activeExecution && this.isExecutionRetriable(this.activeExecution);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onDeleteExecution(): Promise<void> {
|
async onDeleteExecution(): Promise<void> {
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import { createComponentRenderer } from '@/__tests__/render';
|
||||||
|
import ExecutionCard from '@/components/ExecutionsView/ExecutionCard.vue';
|
||||||
|
import { createPinia, setActivePinia } from 'pinia';
|
||||||
|
|
||||||
|
const renderComponent = createComponentRenderer(ExecutionCard, {
|
||||||
|
global: {
|
||||||
|
stubs: {
|
||||||
|
'router-link': {
|
||||||
|
template: '<div><slot /></div>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mocks: {
|
||||||
|
$route: {
|
||||||
|
params: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('ExecutionCard', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
setActivePinia(createPinia());
|
||||||
|
});
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
{
|
||||||
|
id: '1',
|
||||||
|
mode: 'manual',
|
||||||
|
status: 'success',
|
||||||
|
retryOf: null,
|
||||||
|
retrySuccessId: null,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
id: '2',
|
||||||
|
mode: 'manual',
|
||||||
|
status: 'error',
|
||||||
|
retryOf: null,
|
||||||
|
retrySuccessId: null,
|
||||||
|
},
|
||||||
|
true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
id: '3',
|
||||||
|
mode: 'manual',
|
||||||
|
status: 'error',
|
||||||
|
retryOf: '2',
|
||||||
|
retrySuccessId: null,
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
id: '4',
|
||||||
|
mode: 'manual',
|
||||||
|
status: 'error',
|
||||||
|
retryOf: null,
|
||||||
|
retrySuccessId: '3',
|
||||||
|
},
|
||||||
|
false,
|
||||||
|
],
|
||||||
|
])('with execution %j retry button visibility is %s', (execution, shouldRenderRetryBtn) => {
|
||||||
|
const { queryByTestId } = renderComponent({
|
||||||
|
props: {
|
||||||
|
execution,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(!!queryByTestId('retry-execution-button') && shouldRenderRetryBtn).toBe(
|
||||||
|
shouldRenderRetryBtn,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -74,5 +74,12 @@ export const executionHelpers = defineComponent({
|
|||||||
const { date, time } = convertToDisplayDate(fullDate);
|
const { date, time } = convertToDisplayDate(fullDate);
|
||||||
return locale.baseText('executionsList.started', { interpolate: { time, date } });
|
return locale.baseText('executionsList.started', { interpolate: { time, date } });
|
||||||
},
|
},
|
||||||
|
isExecutionRetriable(execution: ExecutionSummary): boolean {
|
||||||
|
return (
|
||||||
|
['crashed', 'error'].includes(execution.status ?? '') &&
|
||||||
|
!execution.retryOf &&
|
||||||
|
!execution.retrySuccessId
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user