From 20c167ea689c3a20aa9b178da01d0366e326fbbd 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 dc311ae2dec7a661906db35e1868b3707d8976a7 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Tue, 27 Feb 2024 14:49:19 -0500 Subject: [PATCH 2/2] :bug: Address style issues on assessment summary / questionnaire view pages Signed-off-by: Ian Bolton --- client/public/locales/en/translation.json | 1 + .../questionnaire-summary/questionnaire-summary.tsx | 1 + .../components/questions-table/questions-table.tsx | 13 ++++++++----- .../questionnaire/questionnaire-page.css | 5 +++++ .../assessment-summary/assessment-summary-page.css | 11 ----------- .../assessment-summary/assessment-summary-page.tsx | 1 - 6 files changed, 15 insertions(+), 17 deletions(-) delete mode 100644 client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.css diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 7b3c3993c..ea952691b 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -322,6 +322,7 @@ "email": "Email", "error": "Error", "errorReport": "Error report", + "explanation": "Explanation", "exclude": "Exclude", "exportToIssue": "Export to Issue Manager", "facts": "Facts", diff --git a/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx b/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx index d9b44830a..0fded7820 100644 --- a/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx +++ b/client/src/app/components/questionnaire-summary/questionnaire-summary.tsx @@ -166,6 +166,7 @@ const QuestionnaireSummary: React.FC = ({ isVertical aria-label="Tabs for summaryData sections" role="region" + className="tabs-vertical-container__tabs" > {[ - {question.explanation} - +
+ {t("terms.explanation")}:   + {question.explanation} + +
diff --git a/client/src/app/pages/assessment-management/questionnaire/questionnaire-page.css b/client/src/app/pages/assessment-management/questionnaire/questionnaire-page.css index 52420e3fe..597d20610 100644 --- a/client/src/app/pages/assessment-management/questionnaire/questionnaire-page.css +++ b/client/src/app/pages/assessment-management/questionnaire/questionnaire-page.css @@ -1,5 +1,10 @@ .tabs-vertical-container { display: flex; + margin-top: 1.5em; +} + +.tabs-vertical-container__tabs { + margin-top: 1.5em; } .tabs-vertical-container .pf-v5-c-tabs { diff --git a/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.css b/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.css deleted file mode 100644 index 52420e3fe..000000000 --- a/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.css +++ /dev/null @@ -1,11 +0,0 @@ -.tabs-vertical-container { - display: flex; -} - -.tabs-vertical-container .pf-v5-c-tabs { - width: 20%; -} - -.tabs-vertical-container .pf-v5-c-tab-content { - width: 80%; -} diff --git a/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.tsx b/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.tsx index 8a840c8e0..1325284d2 100644 --- a/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.tsx +++ b/client/src/app/pages/assessment/components/assessment-summary/assessment-summary-page.tsx @@ -1,6 +1,5 @@ import React from "react"; import { useParams } from "react-router-dom"; -import "./assessment-summary-page.css"; import QuestionnaireSummary, { SummaryType, } from "@app/components/questionnaire-summary/questionnaire-summary";