From 101509cc2464fcf325d7198c104948b63128aafe Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Tue, 27 Feb 2024 10:57:39 -0500 Subject: [PATCH 1/2] :bug: Add parser for custom rule file label title in manual upload flow (#1702) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Resolves https://issues.redhat.com/browse/MTA-2004 Screenshot 2024-02-27 at 9 59 25 AM --------- Signed-off-by: Ian Bolton --- .../applications/analysis-wizard/custom-rules.tsx | 8 +++++--- client/src/app/utils/rules-utils.ts | 11 ++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx b/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx index 24508ac36..e839cf4b2 100644 --- a/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx +++ b/client/src/app/pages/applications/analysis-wizard/custom-rules.tsx @@ -163,6 +163,10 @@ export const CustomRules: React.FC = () => { filteredItems?.forEach((item) => { const { source, target, total } = parseRules(item); + const sourceLabelName = getParsedLabel(source)?.labelValue ?? ""; + const targetLabelName = getParsedLabel(target)?.labelValue ?? ""; + const sourceTargetLabel = `${sourceLabelName} / ${targetLabelName}`; + rows.push({ entity: item, cells: [ @@ -171,9 +175,7 @@ export const CustomRules: React.FC = () => { }, { title: ( - - {source} / {target} - + {sourceTargetLabel} ), }, { diff --git a/client/src/app/utils/rules-utils.ts b/client/src/app/utils/rules-utils.ts index a04dc8858..3c460d658 100644 --- a/client/src/app/utils/rules-utils.ts +++ b/client/src/app/utils/rules-utils.ts @@ -104,16 +104,25 @@ interface ParsedLabel { labelValue: string; } -export const getParsedLabel = (label: string): ParsedLabel => { +export const getParsedLabel = (label: string | null): ParsedLabel => { + if (label === null) { + return { + labelType: "", + labelValue: "", + }; + } + const char1 = label.indexOf("/") + 1; const char2 = label.lastIndexOf("="); const type = label.substring(char1, char2); const value = label.split("=").pop(); + return { labelType: type || "", labelValue: value || "", }; }; + export const getLabels = (labels: string[]) => labels.reduce( (map: ILabelMap, label) => { From 6a56b53e6d582b6d9303e08feba534a765b2f601 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Tue, 27 Feb 2024 13:57:01 -0500 Subject: [PATCH 2/2] :bug: Add tooltip for migration wave delete option in app table Signed-off-by: Ian Bolton --- client/public/locales/en/translation.json | 1 + .../applications-table/applications-table.tsx | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 7b3c3993c..32f0ae1e7 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -176,6 +176,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.", + "cannotDeleteApplicationsAssignedToMigrationWave": "Cannot delete applications that are assigned to a migration wave.", "continueConfirmation": "Yes, continue", "copyAssessmentAndReviewBody": "Some of the selected target applications have an in-progress or complete assessment/review. By continuing, the existing assessment(s)/review(s) will be replaced by the copied assessment/review. Do you wish to continue?", "copyAssessmentAndReviewQuestion": "Copy assessment and review?", 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 09ae2e7d9..796d9f316 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -573,15 +573,12 @@ export const ApplicationsTable: React.FC = () => { , ] : []; - const applicationDropdownItems = applicationWriteAccess ? [ { ...(applicationWriteAccess ? [ { + isAriaDisabled: + application.migrationWave !== null, + tooltipProps: { + content: + application.migrationWave !== null + ? t( + "message.cannotDeleteApplicationsAssignedToMigrationWave" + ) + : "", + }, + title: t("actions.delete"), onClick: () => setApplicationsToDelete([application]), - isDisabled: - application.migrationWave !== null, }, ] : []),