fleet/frontend/pages/ManageControlsPage/OSUpdates/components/EndUserOSRequirementPreview/EndUserOSRequirementPreview.tsx
Scott Gress 1915e7122f
Add "update new hosts to latest" to OS Updates form for MacOS (#37103)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #36088

# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [X] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files)
for more information.

## Testing

- [X] Added/updated automated tests
- [X] QA'd all new/changed functionality manually
Saving this value currently results in a 400 response from the server
since it's not a valid key yet. We can keep this in draft until the
backend is merged if we want to e2e test with it.

### Controls -> OS Settings "Target" section

#### All platforms

- [X] Update success banner message to "Successfully updated."

<img width="200" alt="image"
src="https://github.com/user-attachments/assets/bc43ec79-41d1-4dd3-947c-8152051fd209"
/>

#### macOS / iOS / iPadOS

- [X] Update tooltip text for "Minimum version" to `Enrolled hosts are
updated to exactly this version.`

<img width="250" alt="Image"
src="https://github.com/user-attachments/assets/7d870224-395e-4bc9-937e-be599da57a97"
/>

- [X] Make "available from Apple" a link, replacing "Learn more", and
link to https://fleetdm.com/learn-more-about/apple-available-os-updates

<img width="250" height="363" alt="image"
src="https://github.com/user-attachments/assets/8191ec2d-bf0a-4cf6-9b1a-1272c0ff69b0"
/>

> Note - this URL is current a 404

- [X] Remove text referring to platform from "End user experience"
heading, i.e. it should just say "End user experience" for all platforms
where it appears, not e.g. "End user experience on macOS"

#### macOS Only

- [X] Add new "Update new hosts to latest" checkbox
<img width="316" height="406" alt="Image"
src="https://github.com/user-attachments/assets/71aec05a-b809-436d-8bfd-cd3e14b27ea1"
/>

- [X] Reflects the `macos_updates.update_new_hosts` setting for the team
or (for no team) global config (only testable via automated tests right
now)
- [X] Update End user experience text to "When a minimum version is
enforced, end users see a native macOS notification (DDM) once per day."
(see above)

### Global activity feed

- [X] When "Update new hosts to latest" is enabled, activity should say
`[Actor's name] enabled OS updates for all new macOS hosts on the [team
name] team. macOS hosts will upgrade to the lastest version when they
enroll.`
- [X] When "Update new hosts to latest" is disabled, activity should say
`[Actor's name] disabled updates for all new macOS hosts on the [team
name] team.`

(tested via automated tests)
2025-12-12 11:46:07 -06:00

111 lines
3.1 KiB
TypeScript

import React from "react";
import CustomLink from "components/CustomLink";
import { OSUpdatesSupportedPlatform } from "../../OSUpdates";
import MacOSUpdateScreenshot from "../../../../../../assets/images/macos-updates-preview.png";
import WindowsUpdateScreenshot from "../../../../../../assets/images/windows-nudge-screenshot.png";
import IOSUpdateScreenshot from "../../../../../../assets/images/ios-updates-preview.png";
import IPadOSUpdateScreenshot from "../../../../../../assets/images/ipados-updates-preview.png";
const baseClass = "os-requirement-preview";
interface IEndUserOSRequirementPreviewProps {
platform: OSUpdatesSupportedPlatform;
}
const OSRequirementDescription = ({
platform,
}: IEndUserOSRequirementPreviewProps) => {
switch (platform) {
case "darwin":
return (
<>
<h3>End user experience</h3>
<p>
When a minimum version is enforced, end users see a native macOS
notification (DDM) once per day.
</p>
<CustomLink
text="Learn more"
url="https://fleetdm.com/learn-more-about/os-updates"
newTab
/>
</>
);
case "windows":
return (
<>
<h3>End user experience</h3>
<p>
When a Windows host becomes aware of a new update, end users are
able to defer restarts. Automatic restarts happen before 8am and
after 5pm (end user&apos;s local time). After the deadline, restarts
are forced regardless of active hours.
</p>
<CustomLink
text="Learn more about Windows updates in Fleet"
url="https://fleetdm.com/learn-more-about/os-updates"
newTab
/>
</>
);
case "ios":
return (
<>
<h3>End user experience</h3>
</>
);
case "ipados":
return (
<>
<h3>End user experience</h3>
</>
);
default:
return <></>;
}
};
const OSRequirementImage = ({
platform,
}: IEndUserOSRequirementPreviewProps) => {
const getScreenshot = () => {
switch (platform) {
case "darwin":
return MacOSUpdateScreenshot;
case "windows":
return WindowsUpdateScreenshot;
case "ios":
return IOSUpdateScreenshot;
case "ipados":
return IPadOSUpdateScreenshot;
default:
MacOSUpdateScreenshot;
}
};
return (
<img
className={`${baseClass}__preview-img`}
src={getScreenshot()}
alt="OS update preview screenshot"
/>
);
};
const EndUserOSRequirementPreview = ({
platform,
}: IEndUserOSRequirementPreviewProps) => {
// FIXME: on slow connection the image loads after the text which looks weird and can cause a
// mismatch between the text and the image when switching between platforms. We should load the
// image first and then the text.
return (
<div className={baseClass}>
<OSRequirementDescription platform={platform} />
<OSRequirementImage platform={platform} />
</div>
);
};
export default EndUserOSRequirementPreview;