From 35ea8ac5fb0688e086e0f2e30197eed751eb9ea8 Mon Sep 17 00:00:00 2001 From: ibolton336 Date: Wed, 13 Dec 2023 06:43:27 -0500 Subject: [PATCH] pr updates Signed-off-by: ibolton336 --- .../application-detail-drawer.tsx | 56 ++++++++++++++----- .../assessed-archetype-item.tsx | 15 ----- .../reviewed-archetype-item.tsx | 15 ----- 3 files changed, 43 insertions(+), 43 deletions(-) delete mode 100644 client/src/app/pages/applications/components/application-detail-drawer/assessed-archetype-item.tsx delete mode 100644 client/src/app/pages/applications/components/application-detail-drawer/reviewed-archetype-item.tsx diff --git a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx index ce07f95a90..12887de1d3 100644 --- a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx +++ b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer.tsx @@ -20,9 +20,17 @@ import { DescriptionListTerm, Divider, Tooltip, + Label, } from "@patternfly/react-core"; import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; -import { Application, Identity, Task, MimeType, Ref } from "@app/api/models"; +import { + Application, + Identity, + Task, + MimeType, + Ref, + Archetype, +} from "@app/api/models"; import { IPageDrawerContentProps, PageDrawerContent, @@ -46,10 +54,9 @@ import ExclamationCircleIcon from "@patternfly/react-icons/dist/esm/icons/exclam import { ApplicationFacts } from "./application-facts"; import { ReviewFields } from "./review-fields"; import { LabelsFromItems } from "@app/components/labels/labels-from-items/labels-from-items"; -import { ReviewedArchetypeItem } from "./reviewed-archetype-item"; import { RiskLabel } from "@app/components/RiskLabel"; import { ApplicationDetailFields } from "./application-detail-fields"; -import { AssessedArchetypeItem } from "./assessed-archetype-item"; +import { useFetchArchetypes } from "@app/queries/archetypes"; export interface IApplicationDetailDrawerProps extends Pick { @@ -78,7 +85,9 @@ export const ApplicationDetailDrawer: React.FC< const isTaskRunning = task?.state === "Running"; const { identities } = useFetchIdentities(); + const { archetypes } = useFetchArchetypes(); const { facts, isFetching } = useFetchFacts(application?.id); + const [taskIdToView, setTaskIdToView] = React.useState(); let matchingSourceCredsRef: Identity | undefined; @@ -92,6 +101,22 @@ export const ApplicationDetailDrawer: React.FC< const enableDownloadSetting = useSetting("download.html.enabled"); + const assessedArchetypes = + application?.archetypes + ?.map((archetypeRef) => + archetypes.find((archetype) => archetype.id === archetypeRef.id) + ) + .filter((fullArchetype) => fullArchetype?.assessed) + .filter(Boolean) || []; + + const reviewedArchetypes = + application?.archetypes + ?.map((archetypeRef) => + archetypes.find((archetype) => archetype.id === archetypeRef.id) + ) + .filter((fullArchetype) => fullArchetype?.review) + .filter(Boolean) || []; + return ( - {application?.archetypes?.length ?? 0 > 0 ? ( - application?.archetypes?.map((archetypeRef) => ( - ( + )) ) : ( @@ -198,16 +223,17 @@ export const ApplicationDetailDrawer: React.FC< )} + {t("terms.archetypesReviewed")} - {application?.archetypes?.length ?? 0 > 0 ? ( - application?.archetypes?.map((archetypeRef) => ( - ( + )) ) : ( @@ -426,3 +452,7 @@ export const ApplicationDetailDrawer: React.FC< const ArchetypeLabels: React.FC<{ archetypeRefs?: Ref[] }> = ({ archetypeRefs, }) => ; + +const ArchetypeItem: React.FC<{ archetype: Archetype }> = ({ archetype }) => { + return ; +}; diff --git a/client/src/app/pages/applications/components/application-detail-drawer/assessed-archetype-item.tsx b/client/src/app/pages/applications/components/application-detail-drawer/assessed-archetype-item.tsx deleted file mode 100644 index e224e0fec9..0000000000 --- a/client/src/app/pages/applications/components/application-detail-drawer/assessed-archetype-item.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { useFetchArchetypeById } from "@app/queries/archetypes"; -import { Label } from "@patternfly/react-core"; -import React from "react"; - -export const AssessedArchetypeItem = ({ id }: { id: number }) => { - const { archetype } = useFetchArchetypeById(id); - - if (!archetype?.assessed) return null; - - return ( - - ); -}; diff --git a/client/src/app/pages/applications/components/application-detail-drawer/reviewed-archetype-item.tsx b/client/src/app/pages/applications/components/application-detail-drawer/reviewed-archetype-item.tsx deleted file mode 100644 index 912d8588dc..0000000000 --- a/client/src/app/pages/applications/components/application-detail-drawer/reviewed-archetype-item.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { useFetchArchetypeById } from "@app/queries/archetypes"; -import { Label } from "@patternfly/react-core"; -import React from "react"; - -export const ReviewedArchetypeItem = ({ id }: { id: number }) => { - const { archetype } = useFetchArchetypeById(id); - - if (!archetype?.review) return null; - - return ( - - ); -};