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
This commit is contained in:
@@ -72,8 +72,8 @@ export const PlatformSelector = ({
|
||||
</span>
|
||||
<div className="form-field__help-text">
|
||||
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.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-3
@@ -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 = ({
|
||||
<p>{warningText}</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>You cannot undo this action.</p>
|
||||
<div className="modal-cta-wrap">
|
||||
|
||||
+3
-5
@@ -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<ILabelSummary[], Error>(
|
||||
const { data: labels } = useQuery<ILabelSummary[], Error>(
|
||||
["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),
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
+5
-3
@@ -26,11 +26,13 @@ const DeleteLabelModal = ({
|
||||
<>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<div className="modal-cta-wrap">
|
||||
<Button
|
||||
|
||||
@@ -40,7 +40,7 @@ export const getDeleteLabelErrorMessages = (error: unknown): string => {
|
||||
if (hasStatusKey(error) && error.status === 422) {
|
||||
return getErrorReason(error).includes("built-in")
|
||||
? "Built-in labels can't be modified or deleted."
|
||||
: "Couldn't delete. Software uses this label as a custom target. Please delete the software and try again.";
|
||||
: "Couldn't delete. Software uses this label as a custom target. Remove the label from the software target and try again.";
|
||||
}
|
||||
|
||||
return "Could not delete label. Please try again.";
|
||||
|
||||
Reference in New Issue
Block a user