From 2bc6eb17cfe5b0cd07a9e3ba620fcf06f0e9ea88 Mon Sep 17 00:00:00 2001 From: Miri Safra <122939076+MiriSafra@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:40:08 +0200 Subject: [PATCH 1/3] :sparkles: Add cancel option for multiple analyses (#2099) Added support for cancelling multiple analyses simultaneously. Integrated functionality into the actions menu for bulk applications. Resolves: https://issues.redhat.com/browse/MTA-3639 --------- Signed-off-by: MiriSafra Signed-off-by: shevijacobson Co-authored-by: shevijacobson --- client/public/locales/en/translation.json | 6 ++ .../applications-table/applications-table.tsx | 63 +++++++++++++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 6942e06e7d..c47a362674 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -14,6 +14,7 @@ "accept": "Accept", "back": "Back", "cancel": "Cancel", + "cancelTasks": "Cancel tasks", "checkDocumentation": "Check documentation", "clearAllFilters": "Clear all filters", "clearRepositoryNotSupported": "This action is disabled when RWX volumes are not available", @@ -107,7 +108,9 @@ "dialog": { "message": { "applicationsBulkDelete": "The selected application(s) will be deleted.", + "TasksBulkCancel": "The selected task(s) will be canceled.", "delete": "This action cannot be undone.", + "cancel": "This action cannot be undone.", "discardAssessment": "The assessment(s) for <1>{{applicationName}} will be discarded. Do you wish to continue?", "discardReview": "The review for <1>{{applicationName}} will be discarded. Do you wish to continue?", "leavePage": "Are you sure you want to leave this page? Be sure to save your changes, or they will be lost.", @@ -124,7 +127,9 @@ "copyApplicationAssessmentAndReviewFrom": "Copy {{what}} assessment and review", "copyApplicationAssessmentFrom": "Copy {{what}} assessment", "delete": "Delete {{what}}?", + "cancel": "Cancel {{what}}?", "deleteWithName": "Delete {{what}} \"{{name}}\"?", + "cancelWithName": "Cancel {{what}} \"{{name}}\"?", "discard": "Discard {{what}}?", "download": "Download {{what}}", "edit": "Edit {{what}}", @@ -481,6 +486,7 @@ "tagCategoryDeleted": "Tag category deleted", "tagCategories": "Tag categories", "tasks": "Tasks", + "task": "Task", "teamMember": "team member", "terminated": "Terminated", "ticket": "Ticket", 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..a7542103c7 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -116,7 +116,6 @@ export const ApplicationsTable: React.FC = () => { const history = useHistory(); const token = keycloak.tokenParsed; - // ----- State for the modals const [saveApplicationModalState, setSaveApplicationModalState] = useState< "create" | DecoratedApplication | null @@ -156,7 +155,9 @@ export const ApplicationsTable: React.FC = () => { const [applicationsToDelete, setApplicationsToDelete] = useState< DecoratedApplication[] >([]); - + const [tasksToCancel, setTasksToCancel] = useState( + [] + ); const [assessmentToDiscard, setAssessmentToDiscard] = useState(null); @@ -214,7 +215,7 @@ export const ApplicationsTable: React.FC = () => { const isTaskCancellable = (application: DecoratedApplication) => { const task = application.tasks.currentAnalyzer; - return !TaskStates.Terminal.includes(task?.state ?? ""); + return !!task && !TaskStates.Terminal.includes(task?.state ?? ""); }; // TODO: Review the refetchInterval calculation for the application list @@ -272,7 +273,6 @@ export const ApplicationsTable: React.FC = () => { }); } ); - const discardReview = async (application: DecoratedApplication) => { if (application.review) { deleteReview({ @@ -297,7 +297,6 @@ export const ApplicationsTable: React.FC = () => { }); } ); - const discardAssessment = async (application: DecoratedApplication) => { if (application.assessments) { application.assessments.forEach((assessment) => { @@ -575,6 +574,23 @@ export const ApplicationsTable: React.FC = () => { > {t("actions.delete")} , + ...(tasksReadAccess && tasksWriteAccess + ? [ + + isTaskCancellable(application) + ) + } + onClick={() => { + handleCancelBulkAnalysis(); + }} + > + {t("actions.cancelAnalysis")} + , + ] + : []), ...(credentialsReadAccess ? [ { }) ); }; + const handleCancelBulkAnalysis = () => { + const runningTasksToCancel = selectedRows.filter((application) => + isTaskCancellable(application) + ); + setTasksToCancel(runningTasksToCancel); + }; const assessSelectedApp = async (application: DecoratedApplication) => { setApplicationToAssess(application); @@ -1149,6 +1171,37 @@ export const ApplicationsTable: React.FC = () => { if (ids) bulkDeleteApplication({ ids: ids }); }} /> + 1 + ? "dialog.title.cancel" + : "dialog.title.cancelWithName", + { + what: + tasksToCancel.length > 1 + ? t("terms.tasks").toLowerCase() + : t("terms.task").toLowerCase(), + name: tasksToCancel.length === 1 && tasksToCancel[0].name, + } + )} + titleIconVariant={"warning"} + isOpen={tasksToCancel.length > 0} + message={`${ + tasksToCancel.length > 1 ? t("dialog.message.TasksBulkCancel") : "" + } ${t("dialog.message.cancel")}`} + aria-label="Tasks bulk cancel" + confirmBtnVariant={ButtonVariant.danger} + confirmBtnLabel={t("actions.cancelTasks")} + cancelBtnLabel={t("actions.cancel")} + onCancel={() => setTasksToCancel([])} + onClose={() => setTasksToCancel([])} + onConfirm={() => { + tasksToCancel.forEach((application) => { + cancelAnalysis(application); + }); + setTasksToCancel([]); + }} + /> Date: Mon, 4 Nov 2024 20:15:09 +0200 Subject: [PATCH 2/3] :sparkles: Add ActionsColumn to Job Functions table (#2101) Update the Actions column in the Job Functions table to use PatternFly 5 controls, replacing the PatternFly 4 controls. Relates to #1318 --------- Signed-off-by: DvoraShechter1 --- client/public/locales/en/translation.json | 1 + .../app/pages/controls/job-functions/job-functions.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index c47a362674..a26eb9ebb9 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -185,6 +185,7 @@ "blockedDeleteApplication": "Cannot delete {{what}} because it is associated with an application.", "blockedDeleteTarget": "Cannot delete {{what}} because it is associated with a target.", "defaultBlockedDelete": "Cannot delete {{what}} because it is associated with another object.", + "cannotDeleteJobFunctionWithStakeholders": "Cannot remove a Job function associated with stakeholder(s)", "cannotDeleteApplicationsAssignedToMigrationWave": "Cannot delete applications that are assigned to a migration wave.", "cannotDeleteNonEmptyTagCategory": "Cannot delete a tag category that contains tags.", "continueConfirmation": "Yes, continue", diff --git a/client/src/app/pages/controls/job-functions/job-functions.tsx b/client/src/app/pages/controls/job-functions/job-functions.tsx index d6b76d6e2f..2032493413 100644 --- a/client/src/app/pages/controls/job-functions/job-functions.tsx +++ b/client/src/app/pages/controls/job-functions/job-functions.tsx @@ -16,7 +16,6 @@ import { import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; import { AppPlaceholder } from "@app/components/AppPlaceholder"; -import { AppTableActionButtons } from "@app/components/AppTableActionButtons"; import { ConditionalRender } from "@app/components/ConditionalRender"; import { ConfirmDialog } from "@app/components/ConfirmDialog"; import { getAxiosErrorMessage } from "@app/utils/utils"; @@ -37,6 +36,7 @@ import { import { useLocalTableControls } from "@app/hooks/table-controls"; import { CubesIcon } from "@patternfly/react-icons"; import { RBAC, RBAC_TYPE, controlsWriteScopes } from "@app/rbac"; +import { ControlTableActionButtons } from "../ControlTableActionButtons"; export const JobFunctions: React.FC = () => { const { t } = useTranslation(); @@ -215,9 +215,11 @@ export const JobFunctions: React.FC = () => { {jobFunction.name} - setCreateUpdateModalState(jobFunction)} onDelete={() => deleteRow(jobFunction)} /> From 76a051a8e3371b89c119abf166583749462b734e Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Mon, 4 Nov 2024 14:08:27 -0500 Subject: [PATCH 3/3] :book: Update README.md for release-0.6 branch (#2155) Include CI badges for the release-0.6 branch. Signed-off-by: Scott J Dickerson --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7a6b2adee6..233e02fb07 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Konveyor UI component | branch | last merge CI | last merge image build | nightly CI | | :---------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | main | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=main&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Amain+event%3Apush) | [![Multiple Architecture Image Build](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml/badge.svg?branch=main&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml?query=branch%3Amain+event%3Apush) | [![Nightly CI (repo level @main)](https://github.com/konveyor/tackle2-ui/actions/workflows/nightly-ci-repo.yaml/badge.svg?branch=main&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/nightly-ci-repo.yaml?query=branch%3Amain+event%3Aschedule) | +| release-0.6 | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.6&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.6+event%3Apush) | [![Multiple Architecture Image Build](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml/badge.svg?branch=release-0.6&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml?query=branch%3Arelease-0.6+event%3Apush) | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.6&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.6+event%3Aschedule) | | release-0.5 | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.5&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.5+event%3Apush) | [![Multiple Architecture Image Build](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml/badge.svg?branch=release-0.5&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml?query=branch%3Arelease-0.5+event%3Apush) | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.5&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.5+event%3Aschedule) | | release-0.4 | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.4&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.4+event%3Apush) | [![Multiple Architecture Image Build](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml/badge.svg?branch=release-0.4&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml?query=branch%3Arelease-0.4+event%3Apush) | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.4&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.ymlquery=branch%3Arelease-0.4+event%3Aschedule) | | release-0.3 | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.3&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.3+event%3Apush) | [![Multiple Architecture Image Build](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml/badge.svg?branch=release-0.3&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/image-build.yaml?query=branch%3Arelease-0.3+event%3Apush) | [![CI (repo level)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml/badge.svg?branch=release-0.3&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-repo.yml?query=branch%3Arelease-0.3+event%3Aschedule) | @@ -16,6 +17,7 @@ Konveyor UI component | branch | last merge e2e CI | nightly e2e CI | | :---------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | main | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=main&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Amain+event%3Apush) | [![Nightly CI (global konveyor CI @main)](https://github.com/konveyor/tackle2-ui/actions/workflows/nightly-ci-global.yaml/badge.svg?branch=main&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/nightly-ci-global.yaml?query=branch%3Amain+event%3Aschedule) | +| release-0.6 | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.6&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.6+event%3Apush) | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.6&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.6+event%3Aschedule) | | release-0.5 | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.5&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.5+event%3Apush) | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.5&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.5+event%3Aschedule) | | release-0.4 | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.4&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.4+event%3Apush) | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.4&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.4+event%3Aschedule) | | release-0.3 | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.3&event=push)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.3+event%3Apush) | [![CI (global konveyor CI)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml/badge.svg?branch=release-0.3&event=schedule)](https://github.com/konveyor/tackle2-ui/actions/workflows/ci-global.yml?query=branch%3Arelease-0.3+event%3Aschedule) |