Skip to content

Commit

Permalink
🐛 Fix application table isTaskCancellable (#2023)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sjd78 authored Jul 23, 2024
1 parent 0ba6691 commit 727ee63
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 727ee63

Please sign in to comment.