From 2ee9fe9ac5955c84a975e57b0f4cf882ef98a917 Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Wed, 17 Jul 2024 10:04:08 -0400 Subject: [PATCH] :bug: Update task terminal state check to include "SucceededWithErrors" (#2018) Resolves: #2017 The check used to only allow starting an analysis if an application's analysis task is still running (i.e. not in a terminal state) needs to also consider the frontend synthetic state `SucceededWithErrors` as a non-running / terminal state. Signed-off-by: Scott J Dickerson --- .../applications/applications-table/applications-table.tsx | 5 ++--- client/src/app/queries/tasks.ts | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index f3b7c7baf..a329dbd1b 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -76,6 +76,7 @@ import { useFetchApplications, } from "@app/queries/applications"; import { + TaskStates, useCancelTaskMutation, useFetchTaskDashboard, } from "@app/queries/tasks"; @@ -609,12 +610,10 @@ export const ApplicationsTable: React.FC = () => { .flatMap((app) => app.tasks.currentAnalyzer) .filter(Boolean); - const terminalStates = ["Succeeded", "Failed", "Canceled", ""]; - return ( currentAnalyzerTasksForSelected.length === 0 || currentAnalyzerTasksForSelected.every(({ state }) => - terminalStates.includes(state ?? "") + TaskStates.Terminal.includes(state ?? "") ) ); }; diff --git a/client/src/app/queries/tasks.ts b/client/src/app/queries/tasks.ts index 67dd81c5d..6c9818dbf 100644 --- a/client/src/app/queries/tasks.ts +++ b/client/src/app/queries/tasks.ts @@ -28,6 +28,7 @@ export const TaskStates = { Running: ["Running"], Success: ["Succeeded", "SucceededWithErrors"], SuccessWithErrors: ["SucceededWithErrors"], + Terminal: ["Succeeded", "SucceededWithErrors", "Failed", "Canceled"], }; export const TasksQueryKey = "tasks";