add activities for windows profiles (#15246)

relates to #14359

Add activities to fleet UI for windows profiles create, delete, and
edit.

- [x] Manual QA for all new/changed functionality
This commit is contained in:
Gabriel Hernandez 2023-11-21 17:11:32 +00:00 committed by GitHub
parent 29671f4249
commit fd40f3ddf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 86 additions and 8 deletions

View File

@ -38,6 +38,9 @@ export enum ActivityType {
CreatedMacOSProfile = "created_macos_profile",
DeletedMacOSProfile = "deleted_macos_profile",
EditedMacOSProfile = "edited_macos_profile",
CreatedWindowsProfile = "created_windows_profile",
DeletedWindowsProfile = "deleted_windows_profile",
EditedWindowsProfile = "edited_windows_profile",
EnabledMacDiskEncryption = "enabled_macos_disk_encryption",
DisabledMacDiskEncryption = "disabled_macos_disk_encryption",
AddedBootstrapPackage = "added_bootstrap_package",

View File

@ -32,16 +32,18 @@ const PREMIUM_ACTIVITIES = new Set([
const getProfileMessageSuffix = (
isPremiumTier: boolean,
platform: "darwin" | "windows",
teamName?: string | null
) => {
let messageSuffix = <>all macOS hosts</>;
const platformDisplayName = platform === "darwin" ? "macOS" : "Windows";
let messageSuffix = <>all {platformDisplayName} hosts</>;
if (isPremiumTier) {
messageSuffix = teamName ? (
<>
macOS hosts assigned to the <b>{teamName}</b> team
{platformDisplayName} hosts assigned to the <b>{teamName}</b> team
</>
) : (
<>macOS hosts with no team</>
<>{platformDisplayName} hosts with no team</>
);
}
return messageSuffix;
@ -318,7 +320,6 @@ const TAGGED_TEMPLATES = {
</>
);
},
createMacOSProfile: (activity: IActivity, isPremiumTier: boolean) => {
const profileName = activity.details?.profile_name;
return (
@ -330,12 +331,16 @@ const TAGGED_TEMPLATES = {
) : (
<>a configuration profile</>
)}{" "}
to {getProfileMessageSuffix(isPremiumTier, activity.details?.team_name)}
to{" "}
{getProfileMessageSuffix(
isPremiumTier,
"darwin",
activity.details?.team_name
)}
.
</>
);
},
deleteMacOSProfile: (activity: IActivity, isPremiumTier: boolean) => {
const profileName = activity.details?.profile_name;
return (
@ -348,11 +353,15 @@ const TAGGED_TEMPLATES = {
<>a configuration profile</>
)}{" "}
from{" "}
{getProfileMessageSuffix(isPremiumTier, activity.details?.team_name)}.
{getProfileMessageSuffix(
isPremiumTier,
"darwin",
activity.details?.team_name
)}
.
</>
);
},
editMacOSProfile: (activity: IActivity, isPremiumTier: boolean) => {
return (
<>
@ -360,6 +369,63 @@ const TAGGED_TEMPLATES = {
edited configuration profiles for{" "}
{getProfileMessageSuffix(
isPremiumTier,
"darwin",
activity.details?.team_name
)}{" "}
via fleetctl.
</>
);
},
createWindowsProfile: (activity: IActivity, isPremiumTier: boolean) => {
const profileName = activity.details?.profile_name;
return (
<>
{" "}
added{" "}
{profileName ? (
<>configuration profile {profileName}</>
) : (
<>a configuration profile</>
)}{" "}
to{" "}
{getProfileMessageSuffix(
isPremiumTier,
"windows",
activity.details?.team_name
)}
.
</>
);
},
deleteWindowsProfile: (activity: IActivity, isPremiumTier: boolean) => {
const profileName = activity.details?.profile_name;
return (
<>
{" "}
deleted{" "}
{profileName ? (
<>configuration profile {profileName}</>
) : (
<>a configuration profile</>
)}{" "}
from{" "}
{getProfileMessageSuffix(
isPremiumTier,
"windows",
activity.details?.team_name
)}
.
</>
);
},
editWindowsProfile: (activity: IActivity, isPremiumTier: boolean) => {
return (
<>
{" "}
edited configuration profiles for{" "}
{getProfileMessageSuffix(
isPremiumTier,
"windows",
activity.details?.team_name
)}{" "}
via fleetctl.
@ -692,6 +758,15 @@ const getDetail = (
case ActivityType.EditedMacOSProfile: {
return TAGGED_TEMPLATES.editMacOSProfile(activity, isPremiumTier);
}
case ActivityType.CreatedWindowsProfile: {
return TAGGED_TEMPLATES.createWindowsProfile(activity, isPremiumTier);
}
case ActivityType.DeletedWindowsProfile: {
return TAGGED_TEMPLATES.deleteWindowsProfile(activity, isPremiumTier);
}
case ActivityType.EditedWindowsProfile: {
return TAGGED_TEMPLATES.editWindowsProfile(activity, isPremiumTier);
}
case ActivityType.EnabledMacDiskEncryption: {
return TAGGED_TEMPLATES.enableMacDiskEncryption(activity);
}