mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 08:58:41 +00:00
Add UI activity templates for enable/disable end user authentication (#11634)
This commit is contained in:
parent
70f5b2e444
commit
69f79a99f3
3 changed files with 108 additions and 0 deletions
|
|
@ -43,6 +43,8 @@ export enum ActivityType {
|
|||
DeletedBootstrapPackage = "deleted_bootstrap_package",
|
||||
ChangedMacOSSetupAssistant = "changed_macos_setup_assistant",
|
||||
DeletedMacOSSetupAssistant = "deleted_macos_setup_assistant",
|
||||
EnabledMacOSSetupEndUserAuth = "enabled_macos_setup_end_user_auth",
|
||||
DisabledMacOSSetupEndUserAuth = "disabled_macos_setup_end_user_auth",
|
||||
}
|
||||
export interface IActivity {
|
||||
created_at: string;
|
||||
|
|
|
|||
|
|
@ -570,4 +570,68 @@ describe("Activity Feed", () => {
|
|||
)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a 'enabled_macos_setup_end_user_auth' type activity for a team", () => {
|
||||
const activity = createMockActivity({
|
||||
type: ActivityType.EnabledMacOSSetupEndUserAuth,
|
||||
details: { team_name: "Alphas" },
|
||||
});
|
||||
render(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
expect(
|
||||
screen.getByText(
|
||||
"required end user authentication for macOS hosts that automatically enroll to",
|
||||
{ exact: false }
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("Alphas")).toBeInTheDocument();
|
||||
const withNoTeams = screen.queryByText("no team");
|
||||
expect(withNoTeams).toBeNull();
|
||||
});
|
||||
|
||||
it("renders a 'enabled_macos_setup_end_user_auth' type activity for hosts with no team.", () => {
|
||||
const activity = createMockActivity({
|
||||
type: ActivityType.EnabledMacOSSetupEndUserAuth,
|
||||
});
|
||||
render(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
expect(
|
||||
screen.getByText(
|
||||
"required end user authentication for macOS hosts that automatically enroll to no team.",
|
||||
{ exact: false }
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a 'disabled_macos_setup_end_user_auth' type activity for a team", () => {
|
||||
const activity = createMockActivity({
|
||||
type: ActivityType.DisabledMacOSSetupEndUserAuth,
|
||||
details: { team_name: "Alphas" },
|
||||
});
|
||||
render(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
expect(
|
||||
screen.getByText(
|
||||
"removed end user authentication requirement for macOS hosts that automatically enroll to",
|
||||
{ exact: false }
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
expect(screen.getByText("Alphas")).toBeInTheDocument();
|
||||
const withNoTeams = screen.queryByText("no team");
|
||||
expect(withNoTeams).toBeNull();
|
||||
});
|
||||
|
||||
it("renders a 'disabled_macos_setup_end_user_auth' type activity for hosts with no team.", () => {
|
||||
const activity = createMockActivity({
|
||||
type: ActivityType.DisabledMacOSSetupEndUserAuth,
|
||||
});
|
||||
render(<ActivityItem activity={activity} isPremiumTier />);
|
||||
|
||||
expect(
|
||||
screen.getByText(
|
||||
"removed end user authentication requirement for macOS hosts that automatically enroll to no team.",
|
||||
{ exact: false }
|
||||
)
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ const PREMIUM_ACTIVITIES = new Set([
|
|||
"read_host_disk_encryption_key",
|
||||
"enabled_macos_disk_encryption",
|
||||
"disabled_macos_disk_encryption",
|
||||
"enabled_macos_setup_end_user_auth",
|
||||
"disabled_macos_setup_end_user_auth",
|
||||
]);
|
||||
|
||||
const getProfileMessageSuffix = (
|
||||
|
|
@ -407,6 +409,40 @@ const TAGGED_TEMPLATES = {
|
|||
</>
|
||||
);
|
||||
},
|
||||
enabledMacOSSetupEndUserAuth: (activity: IActivity) => {
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
required end user authentication for macOS hosts that automatically
|
||||
enroll to{" "}
|
||||
{activity.details?.team_name ? (
|
||||
<>
|
||||
the <b>{activity.details.team_name}</b> team
|
||||
</>
|
||||
) : (
|
||||
"no team"
|
||||
)}
|
||||
.
|
||||
</>
|
||||
);
|
||||
},
|
||||
disabledMacOSSetupEndUserAuth: (activity: IActivity) => {
|
||||
return (
|
||||
<>
|
||||
{" "}
|
||||
removed end user authentication requirement for macOS hosts that
|
||||
automatically enroll to{" "}
|
||||
{activity.details?.team_name ? (
|
||||
<>
|
||||
the <b>{activity.details.team_name}</b> team
|
||||
</>
|
||||
) : (
|
||||
"no team"
|
||||
)}
|
||||
.
|
||||
</>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
const getDetail = (
|
||||
|
|
@ -502,6 +538,12 @@ const getDetail = (
|
|||
case ActivityType.DeletedMacOSSetupAssistant: {
|
||||
return TAGGED_TEMPLATES.deletedMacOSSetupAssistant(activity);
|
||||
}
|
||||
case ActivityType.EnabledMacOSSetupEndUserAuth: {
|
||||
return TAGGED_TEMPLATES.enabledMacOSSetupEndUserAuth(activity);
|
||||
}
|
||||
case ActivityType.DisabledMacOSSetupEndUserAuth: {
|
||||
return TAGGED_TEMPLATES.disabledMacOSSetupEndUserAuth(activity);
|
||||
}
|
||||
default: {
|
||||
return TAGGED_TEMPLATES.defaultActivityTemplate(activity);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue