Skip to content

Commit 1f05269

Browse files
cherry pick more scoped software fixes (#25126)
cherry pick for more scoped software via labels fixes
1 parent 82d9f46 commit 1f05269

File tree

7 files changed

+18
-15
lines changed

7 files changed

+18
-15
lines changed

frontend/components/PlatformSelector/PlatformSelector.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ export const PlatformSelector = ({
7171
</Checkbox>
7272
</span>
7373
<div className="form-field__help-text">
74-
To apply the profile to new hosts, you&apos;ll have to delete it and
75-
upload a new profile.
74+
Your policy will only run on the selected platform(s). Additionally, if
75+
install software automation is enabled, it will only be installed on
76+
hosts defined in the software scope.
7677
</div>
7778
</div>
7879
);

frontend/interfaces/software.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export interface ISoftwarePackage {
8282
pending_uninstall: number;
8383
failed_uninstall: number;
8484
};
85-
automatic_install_policies?: ISoftwarePackagePolicy[];
85+
automatic_install_policies?: ISoftwarePackagePolicy[] | null;
8686
install_during_setup?: boolean;
8787
labels_include_any: ILabelSoftwareTitle[] | null;
8888
labels_exclude_any: ILabelSoftwareTitle[] | null;

frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/ConfirmSaveChangesModal/ConfirmSaveChangesModal.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import React from "react";
33
import Button from "components/buttons/Button";
44
import Modal from "components/Modal";
55

6-
import { IPackageFormData } from "pages/SoftwarePage/components/PackageForm/PackageForm";
7-
86
const baseClass = "save-changes-modal";
97

108
export interface IConfirmSaveChangesModalProps {
@@ -38,7 +36,7 @@ const ConfirmSaveChangesModal = ({
3836
<p>{warningText}</p>
3937
<p>
4038
Installs or uninstalls currently running on a host will still
41-
complete, but results wont appear in Fleet.
39+
complete, but results won&apos;t appear in Fleet.
4240
</p>
4341
<p>You cannot undo this action.</p>
4442
<div className="modal-cta-wrap">

frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/EditSoftwareModal/EditSoftwareModal.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { IPackageFormData } from "pages/SoftwarePage/components/PackageForm/Pack
2424
import {
2525
generateSelectedLabels,
2626
getCustomTarget,
27+
getInstallType,
2728
getTargetType,
2829
} from "pages/SoftwarePage/components/PackageForm/helpers";
2930

@@ -70,11 +71,7 @@ const EditSoftwareModal = ({
7071
});
7172
const [uploadProgress, setUploadProgress] = useState(0);
7273

73-
const {
74-
data: labels,
75-
isLoading: isLoadingLabels,
76-
isError: isErrorLabels,
77-
} = useQuery<ILabelSummary[], Error>(
74+
const { data: labels } = useQuery<ILabelSummary[], Error>(
7875
["custom_labels"],
7976
() => labelsAPI.summary().then((res) => getCustomLabels(res.labels)),
8077
{
@@ -178,6 +175,7 @@ const EditSoftwareModal = ({
178175
postInstallScript: software.post_install_script || "",
179176
uninstallScript: software.uninstall_script || "",
180177
selfService: software.self_service || false,
178+
installType: getInstallType(software),
181179
targetType: getTargetType(software),
182180
customTarget: getCustomTarget(software),
183181
labelTargets: generateSelectedLabels(software),

frontend/pages/SoftwarePage/components/PackageForm/helpers.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ export const CUSTOM_TARGET_OPTIONS: IDropdownOption[] = [
120120
},
121121
];
122122

123+
export const getInstallType = (softwarePackage: ISoftwarePackage) => {
124+
return softwarePackage.automatic_install_policies ? "automatic" : "manual";
125+
};
126+
123127
export const getTargetType = (softwarePackage: ISoftwarePackage) => {
124128
if (!softwarePackage) return "All hosts";
125129

frontend/pages/hosts/ManageHostsPage/components/DeleteLabelModal/DeleteLabelModal.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ const DeleteLabelModal = ({
2626
<>
2727
<p>
2828
If a configuration profile uses this label as a custom target, the
29-
profile will break: it won&apos;t be applied to new hosts.
29+
profile will break. After deleting the label, remove broken profiles
30+
and upload new profiles in their place.
3031
</p>
3132
<p>
32-
To apply the profile to new hosts, you&apos;ll have to delete it and
33-
upload a new profile.
33+
If software uses this label as a custom target, the label will not be
34+
able to be deleted. Please remove the label from the software target
35+
first before deleting.
3436
</p>
3537
<div className="modal-cta-wrap">
3638
<Button

frontend/pages/hosts/ManageHostsPage/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const getDeleteLabelErrorMessages = (error: unknown): string => {
4040
if (hasStatusKey(error) && error.status === 422) {
4141
return getErrorReason(error).includes("built-in")
4242
? "Built-in labels can't be modified or deleted."
43-
: "Couldn't delete. Software uses this label as a custom target. Please delete the software and try again.";
43+
: "Couldn't delete. Software uses this label as a custom target. Remove the label from the software target and try again.";
4444
}
4545

4646
return "Could not delete label. Please try again.";

0 commit comments

Comments
 (0)