From cc40cb80ae82cbf6edaf15a065016e47d1ac70f0 Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Wed, 3 Jan 2024 19:33:02 -0500 Subject: [PATCH] :bug: Address in progress inherited status gap (#1652) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Screenshot 2024-01-03 at 5 43 10 PM Screenshot 2024-01-03 at 5 42 58 PM Screenshot 2024-01-03 at 5 42 54 PM https://issues.redhat.com/browse/MTA-1878 https://issues.redhat.com/browse/MTA-1954 Signed-off-by: ibolton336 --- client/src/app/components/IconedStatus.tsx | 32 ++++++++++++++++++- .../application-assessment-status.tsx | 22 +++++++++---- .../application-review-status.tsx | 10 +++++- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/client/src/app/components/IconedStatus.tsx b/client/src/app/components/IconedStatus.tsx index fb82edfe2..6dbf102e9 100644 --- a/client/src/app/components/IconedStatus.tsx +++ b/client/src/app/components/IconedStatus.tsx @@ -10,6 +10,8 @@ import TopologyIcon from "@patternfly/react-icons/dist/esm/icons/topology-icon"; export type IconedStatusPreset = | "InheritedReviews" + | "InProgressInheritedReviews" + | "InProgressInheritedAssessments" | "InheritedAssessments" | "Canceled" | "Completed" @@ -52,6 +54,22 @@ export const IconedStatus: React.FC = ({ }: IIconedStatusProps) => { const { t } = useTranslation(); const presets: IconedStatusPresetType = { + InProgressInheritedReviews: { + icon: , + status: "info", + label: t("terms.inProgress"), + tooltipMessage: t("message.inheritedReviewTooltip", { + count: tooltipCount, + }), + }, + InProgressInheritedAssessments: { + icon: , + status: "info", + label: t("terms.inProgress"), + tooltipMessage: t("message.inheritedAssessmentTooltip", { + count: tooltipCount, + }), + }, InheritedReviews: { icon: , status: "success", @@ -131,6 +149,15 @@ export const IconedStatus: React.FC = ({ return t("message.inheritedAssessmentTooltip", { count: tooltipCount, }); + case "InProgressInheritedReviews": + return t("message.inheritedReviewTooltip", { + count: tooltipCount, + }); + case "InProgressInheritedAssessments": + return t("message.inheritedAssessmentTooltip", { + count: tooltipCount, + }); + default: return ""; } @@ -149,7 +176,10 @@ export const IconedStatus: React.FC = ({ {label || presetProps?.label} - {(preset === "InheritedReviews" || preset === "InheritedAssessments") && ( + {(preset === "InheritedReviews" || + preset === "InheritedAssessments" || + preset === "InProgressInheritedAssessments" || + preset === "InProgressInheritedReviews") && ( diff --git a/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx b/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx index 949f9da7b..56b6cf738 100644 --- a/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx +++ b/client/src/app/pages/applications/components/application-assessment-status/application-assessment-status.tsx @@ -22,9 +22,13 @@ export const ApplicationAssessmentStatus: React.FC< return archetypes?.find((archetype) => archetype.id === archetypeRef.id); }); - const hasAssessedArchetype = applicationArchetypes?.some( + const someArchetypesAssessed = applicationArchetypes?.some( (archetype) => !!archetype?.assessments?.length ?? 0 > 0 ); + const areAllArchetypesAssessed = + applicationArchetypes?.every( + (archetype) => archetype?.assessments?.length ?? 0 > 0 + ) ?? false; const { assessments, @@ -42,16 +46,22 @@ export const ApplicationAssessmentStatus: React.FC< let statusPreset: IconedStatusPreset = "NotStarted"; // Default status let tooltipCount: number = 0; + + const assessedArchetypeCount = + applicationArchetypes?.filter( + (archetype) => archetype?.assessments?.length ?? 0 > 0 + ).length || 0; + const isDirectlyAssessed = application.assessed && (application.assessments?.length ?? 0) > 0; + if (isDirectlyAssessed) { statusPreset = "Completed"; - } else if (hasAssessedArchetype) { + } else if (areAllArchetypesAssessed) { statusPreset = "InheritedAssessments"; - const assessedArchetypeCount = - applicationArchetypes?.filter( - (archetype) => archetype?.assessments?.length ?? 0 > 0 - ).length || 0; + tooltipCount = assessedArchetypeCount; + } else if (someArchetypesAssessed) { + statusPreset = "InProgressInheritedAssessments"; tooltipCount = assessedArchetypeCount; } else if ( assessments?.some( diff --git a/client/src/app/pages/applications/components/application-review-status/application-review-status.tsx b/client/src/app/pages/applications/components/application-review-status/application-review-status.tsx index bf118dbba..37b629306 100644 --- a/client/src/app/pages/applications/components/application-review-status/application-review-status.tsx +++ b/client/src/app/pages/applications/components/application-review-status/application-review-status.tsx @@ -38,10 +38,18 @@ export const ApplicationReviewStatus: React.FC< let statusPreset: IconedStatusPreset; let tooltipCount = 0; + const areAllArchetypesReviewed = + applicationArchetypes?.every((archetype) => !!archetype?.review) ?? false; + const someArchetypesReviewed = + applicationArchetypes?.some((archetype) => !!archetype?.review) ?? false; + if (isAppReviewed) { statusPreset = "Completed"; - } else if (reviewedArchetypeCount > 0) { + } else if (areAllArchetypesReviewed) { + tooltipCount = reviewedArchetypeCount; statusPreset = "InheritedReviews"; + } else if (someArchetypesReviewed) { + statusPreset = "InProgressInheritedReviews"; tooltipCount = reviewedArchetypeCount; } else { statusPreset = "NotStarted";