From 727ee63a32f24d72cbc850214b623be0170b8bec Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Tue, 23 Jul 2024 10:51:46 -0400 Subject: [PATCH] :bug: Fix application table `isTaskCancellable` (#2023) Application analysis tasks should be cancellable when the task in NOT in a terminal state. Use the `TaskStates.Terminal` collection for the check so all current terminal states are considered. Resolves: #1993 Resolves: https://issues.redhat.com/browse/MTA-3219 Signed-off-by: Scott J Dickerson --- .../applications-table/applications-table.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 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 a329dbd1bb..87c50834bd 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -212,7 +212,7 @@ export const ApplicationsTable: React.FC = () => { const isTaskCancellable = (application: DecoratedApplication) => { const task = application.tasks.currentAnalyzer; - return task?.state && !["Succeeded", "Failed"].includes(task.state); + return !TaskStates.Terminal.includes(task?.state ?? ""); }; // TODO: Review the refetchInterval calculation for the application list @@ -979,16 +979,16 @@ export const ApplicationsTable: React.FC = () => { title: t("actions.assess"), onClick: () => assessSelectedApp(application), }, - reviewsWriteAccess && { - title: t("actions.review"), - onClick: () => reviewSelectedApp(application), - }, assessmentWriteAccess && (application.assessments?.length ?? 0) > 0 && { title: t("actions.discardAssessment"), onClick: () => setAssessmentToDiscard(application), }, + reviewsWriteAccess && { + title: t("actions.review"), + onClick: () => reviewSelectedApp(application), + }, reviewsWriteAccess && application?.review && { title: t("actions.discardReview"),