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 d102d69a2a..767d5090eb 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -156,7 +156,9 @@ export const ApplicationsTable: React.FC = () => { const [applicationsToDelete, setApplicationsToDelete] = useState< DecoratedApplication[] >([]); - + const [applicationsToCancel, setApplicationsToCancel] = useState< + DecoratedApplication[] + >([]); const [assessmentToDiscard, setAssessmentToDiscard] = useState(null); @@ -575,6 +577,21 @@ export const ApplicationsTable: React.FC = () => { > {t("actions.delete")} , + ...(tasksReadAccess && + tasksWriteAccess && + selectedRows.every((application) => isTaskCancellable(application)) + ? [ + { + handleCancelBulkAnalysis(selectedRows); + }} + > + {t("actions.cancelAnalysis")} + , + ] + : []), ...(credentialsReadAccess ? [ { }) ); }; - + const handleCancelBulkAnalysis = async ( + selectedRows: DecoratedApplication[] + ) => { + setApplicationsToCancel(selectedRows); + selectedRows.map((application) => { + cancelAnalysis(application); + }); + }; const assessSelectedApp = async (application: DecoratedApplication) => { setApplicationToAssess(application);