From 69cef7c20b1097143d5f19a700ec42fdb87b16fa Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Fri, 3 Jan 2025 17:36:42 +0000 Subject: [PATCH 01/25] Chore UI more fixes scoped software label (#25118) relates to #25067, #25061 includes two fixes for the scoped software via labels feature: 1. update the delete label modal copy 2. don't show the confirm changes modal if only the self service value has changed. - [x] Manual QA for all new/changed functionality --- frontend/components/PlatformSelector/PlatformSelector.tsx | 4 ++-- frontend/interfaces/software.ts | 2 +- .../ConfirmSaveChangesModal/ConfirmSaveChangesModal.tsx | 4 +--- .../EditSoftwareModal/EditSoftwareModal.tsx | 8 +++----- .../pages/SoftwarePage/components/PackageForm/helpers.tsx | 4 ++++ .../components/DeleteLabelModal/DeleteLabelModal.tsx | 8 +++++--- frontend/pages/hosts/ManageHostsPage/helpers.ts | 2 +- 7 files changed, 17 insertions(+), 15 deletions(-) diff --git a/frontend/components/PlatformSelector/PlatformSelector.tsx b/frontend/components/PlatformSelector/PlatformSelector.tsx index 592193a6d0ab..6f87dd236841 100644 --- a/frontend/components/PlatformSelector/PlatformSelector.tsx +++ b/frontend/components/PlatformSelector/PlatformSelector.tsx @@ -72,8 +72,8 @@ export const PlatformSelector = ({
Your policy will only run on the selected platform(s). Additionally, if - install software automation is enabled, it will run only on hosts - defined in the software scope. + install software automation is enabled, it will only be installed on + hosts defined in the software scope.
); diff --git a/frontend/interfaces/software.ts b/frontend/interfaces/software.ts index 5f8797f27fb3..99470e4585df 100644 --- a/frontend/interfaces/software.ts +++ b/frontend/interfaces/software.ts @@ -82,7 +82,7 @@ export interface ISoftwarePackage { pending_uninstall: number; failed_uninstall: number; }; - automatic_install_policies?: ISoftwarePackagePolicy[]; + automatic_install_policies?: ISoftwarePackagePolicy[] | null; install_during_setup?: boolean; labels_include_any: ILabelSoftwareTitle[] | null; labels_exclude_any: ILabelSoftwareTitle[] | null; diff --git a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/ConfirmSaveChangesModal/ConfirmSaveChangesModal.tsx b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/ConfirmSaveChangesModal/ConfirmSaveChangesModal.tsx index d164f8dd8b89..ecc4bc8f8832 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/ConfirmSaveChangesModal/ConfirmSaveChangesModal.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/ConfirmSaveChangesModal/ConfirmSaveChangesModal.tsx @@ -3,8 +3,6 @@ import React from "react"; import Button from "components/buttons/Button"; import Modal from "components/Modal"; -import { IPackageFormData } from "pages/SoftwarePage/components/PackageForm/PackageForm"; - const baseClass = "save-changes-modal"; export interface IConfirmSaveChangesModalProps { @@ -38,7 +36,7 @@ const ConfirmSaveChangesModal = ({

{warningText}

Installs or uninstalls currently running on a host will still - complete, but results won’t appear in Fleet. + complete, but results won't appear in Fleet.

You cannot undo this action.

diff --git a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx index 98f2ee9bc69e..a7c69196906d 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx @@ -24,6 +24,7 @@ import { IPackageFormData } from "pages/SoftwarePage/components/PackageForm/Pack import { generateSelectedLabels, getCustomTarget, + getInstallType, getTargetType, } from "pages/SoftwarePage/components/PackageForm/helpers"; @@ -70,11 +71,7 @@ const EditSoftwareModal = ({ }); const [uploadProgress, setUploadProgress] = useState(0); - const { - data: labels, - isLoading: isLoadingLabels, - isError: isErrorLabels, - } = useQuery( + const { data: labels } = useQuery( ["custom_labels"], () => labelsAPI.summary().then((res) => getCustomLabels(res.labels)), { @@ -178,6 +175,7 @@ const EditSoftwareModal = ({ postInstallScript: software.post_install_script || "", uninstallScript: software.uninstall_script || "", selfService: software.self_service || false, + installType: getInstallType(software), targetType: getTargetType(software), customTarget: getCustomTarget(software), labelTargets: generateSelectedLabels(software), diff --git a/frontend/pages/SoftwarePage/components/PackageForm/helpers.tsx b/frontend/pages/SoftwarePage/components/PackageForm/helpers.tsx index b1b87262f698..8b18db4308eb 100644 --- a/frontend/pages/SoftwarePage/components/PackageForm/helpers.tsx +++ b/frontend/pages/SoftwarePage/components/PackageForm/helpers.tsx @@ -120,6 +120,10 @@ export const CUSTOM_TARGET_OPTIONS: IDropdownOption[] = [ }, ]; +export const getInstallType = (softwarePackage: ISoftwarePackage) => { + return softwarePackage.automatic_install_policies ? "automatic" : "manual"; +}; + export const getTargetType = (softwarePackage: ISoftwarePackage) => { if (!softwarePackage) return "All hosts"; diff --git a/frontend/pages/hosts/ManageHostsPage/components/DeleteLabelModal/DeleteLabelModal.tsx b/frontend/pages/hosts/ManageHostsPage/components/DeleteLabelModal/DeleteLabelModal.tsx index 8780026f1d1d..7bd4f7753186 100644 --- a/frontend/pages/hosts/ManageHostsPage/components/DeleteLabelModal/DeleteLabelModal.tsx +++ b/frontend/pages/hosts/ManageHostsPage/components/DeleteLabelModal/DeleteLabelModal.tsx @@ -26,11 +26,13 @@ const DeleteLabelModal = ({ <>

If a configuration profile uses this label as a custom target, the - profile will break: it won't be applied to new hosts. + profile will break. After deleting the label, remove broken profiles + and upload new profiles in their place.

- To apply the profile to new hosts, you'll have to delete it and - upload a new profile. + If software uses this label as a custom target, the label will not be + able to be deleted. Please remove the label from the software target + first before deleting.