Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Address in progress inherited status gap #1652

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion client/src/app/components/IconedStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import TopologyIcon from "@patternfly/react-icons/dist/esm/icons/topology-icon";

export type IconedStatusPreset =
| "InheritedReviews"
| "InProgressInheritedReviews"
| "InProgressInheritedAssessments"
| "InheritedAssessments"
| "Canceled"
| "Completed"
Expand Down Expand Up @@ -52,6 +54,22 @@ export const IconedStatus: React.FC<IIconedStatusProps> = ({
}: IIconedStatusProps) => {
const { t } = useTranslation();
const presets: IconedStatusPresetType = {
InProgressInheritedReviews: {
icon: <InProgressIcon />,
status: "info",
label: t("terms.inProgress"),
tooltipMessage: t("message.inheritedReviewTooltip", {
count: tooltipCount,
}),
},
InProgressInheritedAssessments: {
icon: <InProgressIcon />,
status: "info",
label: t("terms.inProgress"),
tooltipMessage: t("message.inheritedAssessmentTooltip", {
count: tooltipCount,
}),
},
InheritedReviews: {
icon: <CheckCircleIcon />,
status: "success",
Expand Down Expand Up @@ -131,6 +149,15 @@ export const IconedStatus: React.FC<IIconedStatusProps> = ({
return t("message.inheritedAssessmentTooltip", {
count: tooltipCount,
});
case "InProgressInheritedReviews":
return t("message.inheritedReviewTooltip", {
count: tooltipCount,
});
case "InProgressInheritedAssessments":
return t("message.inheritedAssessmentTooltip", {
count: tooltipCount,
});

default:
return "";
}
Expand All @@ -149,7 +176,10 @@ export const IconedStatus: React.FC<IIconedStatusProps> = ({
</IconWithOptionalTooltip>
</FlexItem>
<FlexItem>{label || presetProps?.label}</FlexItem>
{(preset === "InheritedReviews" || preset === "InheritedAssessments") && (
{(preset === "InheritedReviews" ||
preset === "InheritedAssessments" ||
preset === "InProgressInheritedAssessments" ||
preset === "InProgressInheritedReviews") && (
<FlexItem>
<Tooltip content={getTooltipContent()}>
<TopologyIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Loading