From df80673c96c8ebec0a9020822b8cfc8cf03be277 Mon Sep 17 00:00:00 2001 From: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com> Date: Tue, 15 Jul 2025 15:10:39 +0200 Subject: [PATCH] feat(editor): Add "Stop Test" button to stop running evaluations (#17328) --- .../frontend/@n8n/i18n/src/locales/en.json | 2 + .../editor-ui/src/api/evaluation.ee.ts | 4 +- .../src/stores/evaluation.store.ee.ts | 2 - .../views/Evaluations.ee/EvaluationsView.vue | 66 +++++++++++++------ .../tests/EvaluationsView.test.ts | 49 +++++++++++++- 5 files changed, 98 insertions(+), 25 deletions(-) diff --git a/packages/frontend/@n8n/i18n/src/locales/en.json b/packages/frontend/@n8n/i18n/src/locales/en.json index 9060580e782..32dd71caaf1 100644 --- a/packages/frontend/@n8n/i18n/src/locales/en.json +++ b/packages/frontend/@n8n/i18n/src/locales/en.json @@ -3144,6 +3144,7 @@ "evaluation.listRuns.error.unknownError": "Execution error{description}", "evaluation.listRuns.error.cantFetchTestRuns": "Couldn’t fetch test runs", "evaluation.listRuns.error.cantStartTestRun": "Couldn’t start test run", + "evaluation.listRuns.error.cantStopTestRun": "Couldn’t stop test run", "evaluation.listRuns.error.unknownError.description": "Click for more details", "evaluation.listRuns.error.evaluationTriggerNotFound": "Evaluation trigger missing", "evaluation.listRuns.error.evaluationTriggerNotConfigured": "Evaluation trigger is not configured", @@ -3171,6 +3172,7 @@ "evaluation.runDetail.error.noMetricsCollected": "No 'Set metrics' node executed", "evaluation.runDetail.error.partialCasesFailed": "Finished with errors", "evaluation.runTest": "Run Test", + "evaluation.stopTest": "Stop Test", "evaluation.cancelTestRun": "Cancel Test Run", "evaluation.notImplemented": "This feature is not implemented yet!", "evaluation.viewDetails": "View Details", diff --git a/packages/frontend/editor-ui/src/api/evaluation.ee.ts b/packages/frontend/editor-ui/src/api/evaluation.ee.ts index 5d6dbead02f..c0e2505f246 100644 --- a/packages/frontend/editor-ui/src/api/evaluation.ee.ts +++ b/packages/frontend/editor-ui/src/api/evaluation.ee.ts @@ -5,11 +5,11 @@ export interface TestRunRecord { id: string; workflowId: string; status: 'new' | 'running' | 'completed' | 'error' | 'cancelled' | 'warning' | 'success'; - metrics?: Record; + metrics?: Record | null; createdAt: string; updatedAt: string; runAt: string; - completedAt: string; + completedAt: string | null; errorCode?: string; errorDetails?: Record; finalResult?: 'success' | 'error' | 'warning'; diff --git a/packages/frontend/editor-ui/src/stores/evaluation.store.ee.ts b/packages/frontend/editor-ui/src/stores/evaluation.store.ee.ts index eac8c558811..fbe777e54e5 100644 --- a/packages/frontend/editor-ui/src/stores/evaluation.store.ee.ts +++ b/packages/frontend/editor-ui/src/stores/evaluation.store.ee.ts @@ -14,7 +14,6 @@ export const useEvaluationStore = defineStore( () => { // State const loadingTestRuns = ref(false); - const fetchedAll = ref(false); const testRunsById = ref>({}); const testCaseExecutionsById = ref>({}); const pollingTimeouts = ref>({}); @@ -170,7 +169,6 @@ export const useEvaluationStore = defineStore( return { // State - fetchedAll, testRunsById, testCaseExecutionsById, diff --git a/packages/frontend/editor-ui/src/views/Evaluations.ee/EvaluationsView.vue b/packages/frontend/editor-ui/src/views/Evaluations.ee/EvaluationsView.vue index 50dd029da48..808daf81eee 100644 --- a/packages/frontend/editor-ui/src/views/Evaluations.ee/EvaluationsView.vue +++ b/packages/frontend/editor-ui/src/views/Evaluations.ee/EvaluationsView.vue @@ -1,6 +1,6 @@