mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
UI: Implement new activity types for macOS profiles (#9894)
# Addresses #9595 # Implements - new Activity types: - CreatedMacOSProfile - DeletedMacOSProfile - EditedMacOSProfile - Activity message depends on isPremium: - true: '...macOS hosts with no team' or '...macOS hosts assigned to the **Team Name** team {?via fleetctl}.' - false: '...{to | from | for} all macOS hosts.' # 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/` - [ ] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
parent
d4463bcb88
commit
ba34351f4b
3 changed files with 68 additions and 0 deletions
1
changes/9595-macOS-profiles-activity-types
Normal file
1
changes/9595-macOS-profiles-activity-types
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Create activity feed types for the creation, update, and deletion of macOS profiles (settings) via MDM
|
||||
|
|
@ -33,6 +33,9 @@ export enum ActivityType {
|
|||
MdmUnenrolled = "mdm_unenrolled",
|
||||
EditedMacosMinVersion = "edited_macos_min_version",
|
||||
ReadHostDiskEncryptionKey = "read_host_disk_encryption_key",
|
||||
CreatedMacOSProfile = "created_macos_profile",
|
||||
DeletedMacOSProfile = "deleted_macos_profile",
|
||||
EditedMacOSProfile = "edited_macos_profile",
|
||||
}
|
||||
export interface IActivity {
|
||||
created_at: string;
|
||||
|
|
@ -67,4 +70,6 @@ export interface IActivityDetails {
|
|||
installed_from_dep?: boolean;
|
||||
minimum_version?: string;
|
||||
deadline?: string;
|
||||
profile_name?: string;
|
||||
profile_identifier?: string;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,27 @@ import Avatar from "components/Avatar";
|
|||
import Button from "components/buttons/Button";
|
||||
import Icon from "components/Icon";
|
||||
import ReactTooltip from "react-tooltip";
|
||||
import { actions } from "react-table";
|
||||
|
||||
const baseClass = "activity-item";
|
||||
|
||||
const getProfileMessageSuffix = (
|
||||
isPremiumTier: boolean,
|
||||
teamName?: string | null
|
||||
) => {
|
||||
let messageSuffix = <>all macOS hosts</>;
|
||||
if (isPremiumTier) {
|
||||
messageSuffix = teamName ? (
|
||||
<>
|
||||
macOS hosts assigned to the <b>{teamName}</b> team
|
||||
</>
|
||||
) : (
|
||||
<>macOS hosts with no team</>
|
||||
);
|
||||
}
|
||||
return messageSuffix;
|
||||
};
|
||||
|
||||
const TAGGED_TEMPLATES = {
|
||||
liveQueryActivityTemplate: (
|
||||
activity: IActivity,
|
||||
|
|
@ -210,6 +228,41 @@ const TAGGED_TEMPLATES = {
|
|||
);
|
||||
},
|
||||
|
||||
createMacOSProfile: (activity: IActivity, isPremiumTier: boolean) => {
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
added configuration profile {activity.details?.profile_name} to{" "}
|
||||
{getProfileMessageSuffix(isPremiumTier, activity.details?.team_name)}.
|
||||
</>
|
||||
);
|
||||
},
|
||||
|
||||
deleteMacOSProfile: (activity: IActivity, isPremiumTier: boolean) => {
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
deleted configuration profile {
|
||||
activity.details?.host_display_name
|
||||
} from{" "}
|
||||
{getProfileMessageSuffix(isPremiumTier, activity.details?.team_name)}.
|
||||
</>
|
||||
);
|
||||
},
|
||||
|
||||
editMacOSProfile: (activity: IActivity, isPremiumTier: boolean) => {
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
edited configuration profiles for{" "}
|
||||
{getProfileMessageSuffix(
|
||||
isPremiumTier,
|
||||
activity.details?.team_name
|
||||
)}{" "}
|
||||
via fleetctl.
|
||||
</>
|
||||
);
|
||||
},
|
||||
defaultActivityTemplate: (activity: IActivity) => {
|
||||
const entityName = find(activity.details, (_, key) =>
|
||||
key.includes("_name")
|
||||
|
|
@ -293,6 +346,15 @@ const getDetail = (
|
|||
case ActivityType.ReadHostDiskEncryptionKey: {
|
||||
return TAGGED_TEMPLATES.readHostDiskEncryptionKey(activity);
|
||||
}
|
||||
case ActivityType.CreatedMacOSProfile: {
|
||||
return TAGGED_TEMPLATES.createMacOSProfile(activity, isPremiumTier);
|
||||
}
|
||||
case ActivityType.DeletedMacOSProfile: {
|
||||
return TAGGED_TEMPLATES.createMacOSProfile(activity, isPremiumTier);
|
||||
}
|
||||
case ActivityType.EditedMacOSProfile: {
|
||||
return TAGGED_TEMPLATES.createMacOSProfile(activity, isPremiumTier);
|
||||
}
|
||||
default: {
|
||||
return TAGGED_TEMPLATES.defaultActivityTemplate(activity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue