From f2ad368463f36723533030e993ddea29d51051b4 Mon Sep 17 00:00:00 2001 From: RachelElysia <71795832+RachelElysia@users.noreply.github.com> Date: Thu, 27 Feb 2025 15:09:05 -0500 Subject: [PATCH] Fleet UI: Hide auto install tag if null (#26660) --- .../SoftwareOptionsSelector.tsx | 10 ++----- .../SoftwareNameCell/SoftwareNameCell.tsx | 9 ++---- .../SoftwareInstallerCard.tsx | 28 +++++++++++++------ frontend/pages/SoftwarePage/helpers.tsx | 12 ++++---- .../InstallStatusCell/InstallStatusCell.tsx | 4 +-- 5 files changed, 32 insertions(+), 31 deletions(-) diff --git a/frontend/components/SoftwareOptionsSelector/SoftwareOptionsSelector.tsx b/frontend/components/SoftwareOptionsSelector/SoftwareOptionsSelector.tsx index 16fee60c94..0067929fdf 100644 --- a/frontend/components/SoftwareOptionsSelector/SoftwareOptionsSelector.tsx +++ b/frontend/components/SoftwareOptionsSelector/SoftwareOptionsSelector.tsx @@ -6,6 +6,7 @@ import InfoBanner from "components/InfoBanner"; import CustomLink from "components/CustomLink"; import { LEARN_MORE_ABOUT_BASE_LINK } from "utilities/constants"; +import { SELF_SERVICE_TOOLTIP } from "pages/SoftwarePage/helpers"; import { ISoftwareVppFormData } from "pages/SoftwarePage/SoftwareAddPage/SoftwareAppStoreVpp/SoftwareVppForm/SoftwareVppForm"; import { IFleetMaintainedAppFormData } from "pages/SoftwarePage/SoftwareAddPage/SoftwareFleetMaintained/FleetMaintainedAppDetailsPage/FleetAppDetailsForm/FleetAppDetailsForm"; import { IPackageFormData } from "pages/SoftwarePage/components/PackageForm/PackageForm"; @@ -56,14 +57,7 @@ const SoftwareOptionsSelector = ({ value={formData.selfService} onChange={(newVal: boolean) => onToggleSelfService(newVal)} className={`${baseClass}__self-service-checkbox`} - tooltipContent={ - !isSelfServiceDisabled && ( - <> - End users can install from Fleet Desktop {">"}{" "} - Self-service. - - ) - } + tooltipContent={!isSelfServiceDisabled && SELF_SERVICE_TOOLTIP} disabled={isSelfServiceDisabled} > Self-service diff --git a/frontend/components/TableContainer/DataTable/SoftwareNameCell/SoftwareNameCell.tsx b/frontend/components/TableContainer/DataTable/SoftwareNameCell/SoftwareNameCell.tsx index ca9bcf5065..d550f07fb2 100644 --- a/frontend/components/TableContainer/DataTable/SoftwareNameCell/SoftwareNameCell.tsx +++ b/frontend/components/TableContainer/DataTable/SoftwareNameCell/SoftwareNameCell.tsx @@ -3,10 +3,11 @@ import { InjectedRouter } from "react-router"; import ReactTooltip from "react-tooltip"; import { uniqueId } from "lodash"; +import { SELF_SERVICE_TOOLTIP } from "pages/SoftwarePage/helpers"; + import Icon from "components/Icon"; import { IconNames } from "components/icons"; import SoftwareIcon from "pages/SoftwarePage/components/icons/SoftwareIcon"; - import LinkCell from "../LinkCell"; const baseClass = "software-name-cell"; @@ -29,11 +30,7 @@ const installIconMap: Record = { }, selfService: { iconName: "user", - tooltip: ( - <> - End users can install from Fleet Desktop {">"} Self-service. - - ), + tooltip: SELF_SERVICE_TOOLTIP, }, automatic: { iconName: "refresh", diff --git a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx index da85f13f13..a9dbe25ae0 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareInstallerCard/SoftwareInstallerCard.tsx @@ -11,6 +11,7 @@ import { import softwareAPI from "services/entities/software"; import { getPathWithQueryParams } from "utilities/url"; +import { SELF_SERVICE_TOOLTIP } from "pages/SoftwarePage/helpers"; import Card from "components/Card"; @@ -307,22 +308,31 @@ const SoftwareInstallerCard = ({ addedTimestamp={addedTimestamp} />
- {(!softwareInstaller?.automatic_install_policies || - softwareInstaller?.automatic_install_policies.length > 0) && ( + {Array.isArray(softwareInstaller.automatic_install_policies) && + softwareInstaller.automatic_install_policies.length > 0 && ( + + setShowAutomaticInstallModal(true)} + /> + + )} + {isSelfService && ( - setShowAutomaticInstallModal(true)} - /> + )} - {isSelfService && }
diff --git a/frontend/pages/SoftwarePage/helpers.tsx b/frontend/pages/SoftwarePage/helpers.tsx index 5ff3b39b3b..7a03d2058d 100644 --- a/frontend/pages/SoftwarePage/helpers.tsx +++ b/frontend/pages/SoftwarePage/helpers.tsx @@ -13,12 +13,6 @@ import { getErrorReason } from "interfaces/errors"; import { ISoftwarePackage, IAppStoreApp } from "interfaces/software"; import { IDropdownOption } from "interfaces/dropdownOption"; -import Radio from "components/forms/fields/Radio"; -import TooltipWrapper from "components/TooltipWrapper"; -import InfoBanner from "components/InfoBanner"; -import CustomLink from "components/CustomLink"; -import { LEARN_MORE_ABOUT_BASE_LINK } from "utilities/constants"; - /** * helper function to generate error message for secret variables based * on the error reason. @@ -166,3 +160,9 @@ export const CUSTOM_TARGET_OPTIONS: IDropdownOption[] = [ disabled: false, }, ]; + +export const SELF_SERVICE_TOOLTIP = ( + <> + End users can install from Fleet Desktop > Self-service. + +); diff --git a/frontend/pages/hosts/details/cards/Software/InstallStatusCell/InstallStatusCell.tsx b/frontend/pages/hosts/details/cards/Software/InstallStatusCell/InstallStatusCell.tsx index e32e33df45..3192b2d721 100644 --- a/frontend/pages/hosts/details/cards/Software/InstallStatusCell/InstallStatusCell.tsx +++ b/frontend/pages/hosts/details/cards/Software/InstallStatusCell/InstallStatusCell.tsx @@ -4,6 +4,7 @@ import ReactTooltip from "react-tooltip"; import { uniqueId } from "lodash"; import { IHostSoftware, SoftwareInstallStatus } from "interfaces/software"; +import { SELF_SERVICE_TOOLTIP } from "pages/SoftwarePage/helpers"; import Icon from "components/Icon"; import TextCell from "components/TableContainer/DataTable/TextCell"; @@ -102,8 +103,7 @@ export const INSTALL_STATUS_DISPLAY_OPTIONS: Record< tooltip: ({ softwareName }) => ( <> {softwareName ? {softwareName} : "Software"} can be installed on - the host. End users can install from{" "} - Fleet Desktop {">"} Self-service. + the host. {SELF_SERVICE_TOOLTIP} ), },