From 5dafea01c8d6530ded50bea8eecf3e7eda070878 Mon Sep 17 00:00:00 2001 From: Sarah Gillespie <73313222+gillespi314@users.noreply.github.com> Date: Mon, 13 May 2024 09:36:13 -0500 Subject: [PATCH] Fix unreleased UI bugs for software installers (#18928) --- .../SoftwareInstallDetails.tsx | 1 + .../components/VersionCell/VersionCell.tsx | 2 +- .../HostDetailsPage/HostDetailsPage.tsx | 4 +- .../hosts/details/cards/Software/Software.tsx | 2 +- .../SoftwareDetailsModal.tsx | 50 +++++++++++-------- .../SoftwareDetailsModal/_styles.scss | 11 ++++ 6 files changed, 45 insertions(+), 25 deletions(-) diff --git a/frontend/pages/SoftwarePage/components/SoftwareInstallDetails/SoftwareInstallDetails.tsx b/frontend/pages/SoftwarePage/components/SoftwareInstallDetails/SoftwareInstallDetails.tsx index 4c9c5fa77b..ca735dcf5a 100644 --- a/frontend/pages/SoftwarePage/components/SoftwareInstallDetails/SoftwareInstallDetails.tsx +++ b/frontend/pages/SoftwarePage/components/SoftwareInstallDetails/SoftwareInstallDetails.tsx @@ -86,6 +86,7 @@ export const SoftwareInstallDetails = ({ }, { refetchOnWindowFocus: false, + staleTime: 3000, select: (data) => data.results, } ); diff --git a/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx b/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx index a21e2dc7c7..45441e779f 100644 --- a/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx +++ b/frontend/pages/SoftwarePage/components/VersionCell/VersionCell.tsx @@ -48,7 +48,7 @@ const VersionCell = ({ // only one version, no need for tooltip const cellText = generateText(versions); - if (!versions) { + if (!versions || versions.length <= 1) { return <>{cellText}; } diff --git a/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx b/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx index 001b59ffca..5e7e16ee43 100644 --- a/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx +++ b/frontend/pages/hosts/details/HostDetailsPage/HostDetailsPage.tsx @@ -853,9 +853,7 @@ const HostDetailsPage = ({ router={router} queryParams={queryParams} pathname={location.pathname} - onShowSoftwareDetails={(software) => - setSelectedSoftwareDetails(software) - } + onShowSoftwareDetails={setSelectedSoftwareDetails} /> {host?.platform === "darwin" && macadmins?.munki?.version && ( ); }; -export default SoftwareCard; +export default React.memo(SoftwareCard); diff --git a/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/SoftwareDetailsModal.tsx b/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/SoftwareDetailsModal.tsx index 3633901f13..ba20637ce4 100644 --- a/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/SoftwareDetailsModal.tsx +++ b/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/SoftwareDetailsModal.tsx @@ -13,6 +13,8 @@ import Button from "components/buttons/Button"; import DataSet from "components/DataSet"; import { dateAgo } from "utilities/date_format"; +import { SoftwareInstallDetails } from "pages/SoftwarePage/components/SoftwareInstallDetails"; + const baseClass = "software-details-modal"; const generateVulnerabilitiesValue = (vulnerabilities: string[]) => { @@ -40,7 +42,7 @@ const SoftwareDetailsInfo = ({ source, bundleIdentifier, }: ISoftwareDetailsInfoProps) => { - const { vulnerabilities } = installedVersion; + const { vulnerabilities, installed_paths } = installedVersion; return (
@@ -57,19 +59,21 @@ const SoftwareDetailsInfo = ({ /> )}
-
- - {installedVersion.installed_paths.map((path) => ( - {path} - ))} -
- } - /> - + {!!installed_paths?.length && ( +
+ + {installed_paths.map((path) => ( + {path} + ))} +
+ } + /> + + )} {vulnerabilities && vulnerabilities.length !== 0 && (
{ + const installUuid = software.last_install?.install_uuid || ""; + const renderSoftwareDetails = () => { const { installed_versions } = software; @@ -98,16 +104,18 @@ const SoftwareDetailsModal = ({ // software type atm. if (!installed_versions || installed_versions.length === 0) { return ( - +
+ +
); } return (
- {installed_versions.map((installedVersion) => { + {installed_versions?.map((installedVersion) => { return ( Install Details {renderSoftwareDetails()} - test 2 + + + ); diff --git a/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/_styles.scss b/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/_styles.scss index 6b241115a0..1b2374dd61 100644 --- a/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/_styles.scss +++ b/frontend/pages/hosts/details/cards/Software/SoftwareDetailsModal/_styles.scss @@ -1,4 +1,7 @@ .software-details-modal { + &__software-details { + margin-top: 24px; + } &__details-info { display: flex; @@ -43,4 +46,12 @@ white-space: nowrap; } } + + .modal__content { + margin-top: $pad-small; + } + + .react-tabs__tab-panel { + margin-top: $pad-large; + } }