add min macos version edited activitiy (#9607)

relates to https://github.com/fleetdm/fleet/issues/9352

adds an edited minimum mac os version activity to the UI

**with team:**

![image](https://user-images.githubusercontent.com/1153709/216044501-3dc34a24-5a49-4fb5-8a83-6808eb79d9ce.png)

**without team:**

![image](https://user-images.githubusercontent.com/1153709/216044543-aa0891c1-6bd4-4453-b646-dcd254fa418b.png)

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Manual QA for all new/changed functionality
This commit is contained in:
Gabriel Hernandez 2023-02-01 15:58:24 +00:00 committed by GitHub
parent ffed7f8ebe
commit 68c4e69a57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 2 deletions

View file

@ -0,0 +1 @@
- add edited min macos version activity

View file

@ -31,6 +31,7 @@ export enum ActivityType {
UserDeletedTeamRole = "deleted_user_team_role",
MdmEnrolled = "mdm_enrolled",
MdmUnenrolled = "mdm_unenrolled",
EditedMacosMinVersion = "edited_macos_min_version",
}
export interface IActivity {
created_at: string;
@ -50,8 +51,8 @@ export interface IActivityDetails {
query_id?: number;
query_name?: string;
query_sql?: string;
team_id?: number;
team_name?: string;
team_id?: number | null;
team_name?: string | null;
teams?: ITeamSummary[];
targets_count?: number;
specs?: IQuery[] | IPolicy[];
@ -63,4 +64,6 @@ export interface IActivityDetails {
host_serial?: string;
host_display_name?: string;
installed_from_dep?: boolean;
minimum_version?: string;
deadline?: string;
}

View file

@ -170,6 +170,35 @@ const TAGGED_TEMPLATES = {
</>
);
},
editedMacosMinVersion: (activity: IActivity) => {
const editedActivity =
activity.details?.minimum_version === "" ? "removed" : "updated";
const versionSection = activity.details?.minimum_version ? (
<>
to <b>{activity.details.minimum_version}</b>
</>
) : null;
const deadlineSection = activity.details?.deadline ? (
<>(deadline: {activity.details.deadline})</>
) : null;
const teamSection = activity.details?.team_id ? (
<>
the <b>{activity.details.team_name}</b> team
</>
) : (
<>no team</>
);
return (
<>
{editedActivity} the minimum macOS version {versionSection}{" "}
{deadlineSection} on hosts assigned to {teamSection}.
</>
);
},
defaultActivityTemplate: (activity: IActivity) => {
const entityName = find(activity.details, (_, key) =>
@ -248,6 +277,9 @@ const getDetail = (
case ActivityType.MdmUnenrolled: {
return TAGGED_TEMPLATES.mdmUnenrolled(activity);
}
case ActivityType.EditedMacosMinVersion: {
return TAGGED_TEMPLATES.editedMacosMinVersion(activity);
}
default: {
return TAGGED_TEMPLATES.defaultActivityTemplate(activity);
}