From f6dc4743a0fa517f3d75f9fc7b707ae263031871 Mon Sep 17 00:00:00 2001 From: ibolton336 Date: Wed, 1 Nov 2023 15:05:04 -0400 Subject: [PATCH] :sparkles: Add app detail to drawer Signed-off-by: ibolton336 --- client/public/locales/en/translation.json | 3 + .../application-detail-drawer-analysis.tsx | 10 -- .../application-detail-drawer-assessment.tsx | 11 +- .../application-detail-drawer.tsx | 37 ++--- .../application-detail-fields.tsx | 134 ++++++++++++++++++ 5 files changed, 149 insertions(+), 46 deletions(-) create mode 100644 client/src/app/pages/applications/components/application-detail-drawer/application-detail-fields.tsx diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index 6f35387789..07234494f1 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -235,6 +235,7 @@ "applicationImports": "Application imports", "applicationName": "Application name", "archetypeName": "Archetype name", + "applicationInformation": "Application information", "applications": "Applications", "archetype": "Archetype", "archetypes": "Archetypes", @@ -247,6 +248,7 @@ "assessmentSummary": "Assessment summary", "autoTagging": "Automated Tagging", "binary": "Binary", + "branch": "Branch", "binaryArtifact": "Artifact", "binaryGroup": "Group", "binaryPackaging": "Packaging", @@ -359,6 +361,7 @@ "reviewComments": "Review comments", "risk": "Risk", "riskFromApplication": "Application risk", + "rootPath": "Root path", "scheduled": "Scheduled", "select": "Select", "settingsAllowApps": "Allow reviewing applications without running an assessment first", diff --git a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx index 234678ec22..0069afa196 100644 --- a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx +++ b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-analysis.tsx @@ -69,16 +69,6 @@ export const ApplicationDetailDrawerAnalysis: React.FC< task={task} application={updatedApplication || null} onCloseClick={onCloseClick} - detailsTabMainContent={ - - - {t("terms.comments")} - - - {application?.comments || notAvailable} - - - } reportsTabContent={ diff --git a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-assessment.tsx b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-assessment.tsx index 67218dfc44..84cb27c584 100644 --- a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-assessment.tsx +++ b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-drawer-assessment.tsx @@ -8,7 +8,6 @@ import { TextContent, Text, Title, - Label, } from "@patternfly/react-core"; import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; @@ -38,7 +37,7 @@ export const ApplicationDetailDrawerAssessment: React.FC< application={application} task={task} onCloseClick={onCloseClick} - detailsTabMainContent={ + detailTabContent={ <> <Title headingLevel="h3" size="md"> {t("terms.archetypes")} @@ -88,14 +87,6 @@ export const ApplicationDetailDrawerAssessment: React.FC< <Text component="small" cy-data="comments"> <RiskLabel risk={application?.risk || "unknown"} /> </Text> - <Title headingLevel="h3" size="md"> - {t("terms.commentsFromApplication")} - - - {application?.comments || ( - - )} - } 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 3627375c33..fb28f1ee86 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 @@ -24,15 +24,15 @@ import { getDependenciesUrlFilteredByAppName, getIssuesSingleAppSelectedLocation, } from "@app/pages/issues/helpers"; -import { ApplicationBusinessService } from "../application-business-service"; import { ApplicationTags } from "../application-tags"; +import { ApplicationDetailFields } from "./application-detail-fields"; export interface IApplicationDetailDrawerProps extends Pick { application: Application | null; task: Task | undefined | null; applications?: Application[]; - detailsTabMainContent: React.ReactNode; + detailTabContent?: React.ReactNode; reportsTabContent?: React.ReactNode; factsTabContent?: React.ReactNode; reviewsTabContent?: React.ReactNode; @@ -52,7 +52,7 @@ export const ApplicationDetailDrawer: React.FC< onCloseClick, application, task, - detailsTabMainContent, + detailTabContent = null, reportsTabContent = null, factsTabContent = null, reviewsTabContent = null, @@ -63,7 +63,7 @@ export const ApplicationDetailDrawer: React.FC< ); const isTaskRunning = task?.state === "Running"; - + console.log("application", application); return ( ) : null} - - {t("terms.businessService")} - - - {application?.businessService ? ( - - ) : ( - t("terms.unassigned") - )} - - - {t("terms.migrationWave")} - - - {application?.migrationWave - ? application.migrationWave.name - : t("terms.unassigned")} - {t("terms.effort")} - {application?.effort ?? t("terms.unassigned")} + + {application?.effort !== 0 + ? application?.effort + : t("terms.unassigned")} + - {detailsTabMainContent} + {detailTabContent} + Tags}> diff --git a/client/src/app/pages/applications/components/application-detail-drawer/application-detail-fields.tsx b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-fields.tsx new file mode 100644 index 0000000000..c666c05074 --- /dev/null +++ b/client/src/app/pages/applications/components/application-detail-drawer/application-detail-fields.tsx @@ -0,0 +1,134 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { Title, TextContent, Text, TextVariants } from "@patternfly/react-core"; +import { Application } from "@app/api/models"; +import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing"; +import { ApplicationBusinessService } from "../application-business-service"; +import { EmptyTextMessage } from "@app/components/EmptyTextMessage"; + +export const ApplicationDetailFields: React.FC<{ + application: Application | null; +}> = ({ application }) => { + const { t } = useTranslation(); + + return ( + <> + + + {t("terms.applicationInformation")} + + + + {t("terms.owner")} + + + {application?.owner ?? t("terms.notAvailable")} + + + {t("terms.contributors")} + + + {application?.contributors?.length + ? application.contributors + .map((contributor) => contributor.name) + .join(", ") + : t("terms.notAvailable")} + + + {t("terms.sourceCode")} + + + {t("terms.repositoryType")} + {": "} + + + {application?.repository?.kind} + +
+ + + {application?.repository?.url} + + +
+ + {t("terms.branch")} + {": "} + + + {application?.repository?.branch} + +
+ + {t("terms.rootPath")} + {": "} + + + {application?.repository?.path} + +
+ + {t("terms.binary")} + + + {application?.binary} + + + {t("terms.businessService")} + + + {application?.businessService ? ( + + ) : ( + t("terms.unassigned") + )} + + + {t("terms.migrationWave")} + + + {application?.migrationWave + ? application.migrationWave.name + : t("terms.unassigned")} + + + {t("terms.commentsFromApplication")} + + + {application?.comments || ( + + )} + + + ); +};