Update UI text for disk encryption activities to reflect cross-platform functionality (#16741)

This commit is contained in:
Sarah Gillespie 2024-02-12 12:23:57 -06:00 committed by GitHub
parent 4cb9a48b3b
commit 5d727d46bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 95 additions and 11 deletions

View file

@ -0,0 +1 @@
- Updated UI text for disk encryption activities to reflect cross-platform functionality.

View file

@ -42,7 +42,13 @@ export enum ActivityType {
CreatedWindowsProfile = "created_windows_profile",
DeletedWindowsProfile = "deleted_windows_profile",
EditedWindowsProfile = "edited_windows_profile",
// Note: Both "enabled_disk_encryption" and "enabled_macos_disk_encryption" display the same
// message. The latter is deprecated in the API but it is retained here for backwards compatibility.
EnabledDiskEncryption = "enabled_disk_encryption",
EnabledMacDiskEncryption = "enabled_macos_disk_encryption",
// Note: Both "disabled_disk_encryption" and "disabled_macos_disk_encryption" display the same
// message. The latter is deprecated in the API but it is retained here for backwards compatibility.
DisabledDiskEncryption = "disabled_disk_encryption",
DisabledMacDiskEncryption = "disabled_macos_disk_encryption",
AddedBootstrapPackage = "added_bootstrap_package",
DeletedBootstrapPackage = "deleted_bootstrap_package",

View file

@ -547,16 +547,53 @@ describe("Activity Feed", () => {
expect(forAllTeams).toBeNull();
});
it("renders an 'enabled_disk_encryption' type activity for a team", () => {
const activity = createMockActivity({
type: ActivityType.EnabledDiskEncryption,
details: { team_name: "Alphas" },
});
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText("enforced disk encryption for hosts assigned to the", {
exact: false,
})
).toBeInTheDocument();
expect(screen.getByText("Alphas")).toBeInTheDocument();
expect(screen.getByText(" team.", { exact: false })).toBeInTheDocument();
const withNoTeams = screen.queryByText("with no team");
expect(withNoTeams).toBeNull();
});
it("renders an 'enabled_macos_disk_encryption' type activity for a team", () => {
// Test deprecated activity type
const activity = createMockActivity({
type: ActivityType.EnabledMacDiskEncryption,
details: { team_name: "Alphas" },
});
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText("enforced disk encryption for hosts assigned to the", {
exact: false,
})
).toBeInTheDocument();
expect(screen.getByText("Alphas")).toBeInTheDocument();
expect(screen.getByText(" team.", { exact: false })).toBeInTheDocument();
const withNoTeams = screen.queryByText("with no team");
expect(withNoTeams).toBeNull();
});
it("renders a 'disabled_disk_encryption' type activity for a team", () => {
const activity = createMockActivity({
type: ActivityType.DisabledMacDiskEncryption,
details: { team_name: "Alphas" },
});
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText(
"enforced disk encryption for macOS hosts assigned to the",
"removed disk encryption enforcement for hosts assigned to the",
{
exact: false,
}
@ -569,15 +606,16 @@ describe("Activity Feed", () => {
});
it("renders a 'disabled_macos_disk_encryption' type activity for a team", () => {
// Test deprecated activity type
const activity = createMockActivity({
type: ActivityType.DisabledMacDiskEncryption,
type: ActivityType.DisabledDiskEncryption,
details: { team_name: "Alphas" },
});
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText(
"removed disk encryption enforcement for macOS hosts assigned to the",
"removed disk encryption enforcement for hosts assigned to the",
{
exact: false,
}
@ -589,7 +627,21 @@ describe("Activity Feed", () => {
expect(withNoTeams).toBeNull();
});
it("renders an 'enabled_disk_encryption' type activity for hosts with no team.", () => {
const activity = createMockActivity({
type: ActivityType.EnabledDiskEncryption,
details: {},
});
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText("enforced disk encryption for hosts with no team.")
).toBeInTheDocument();
expect(screen.queryByText("assigned to the")).toBeNull();
});
it("renders an 'enabled_macos_disk_encryption' type activity for hosts with no team.", () => {
// Test deprecated activity type
const activity = createMockActivity({
type: ActivityType.EnabledMacDiskEncryption,
details: {},
@ -597,12 +649,31 @@ describe("Activity Feed", () => {
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText("enforced disk encryption for macOS hosts with no team.")
screen.getByText("enforced disk encryption for hosts with no team.")
).toBeInTheDocument();
expect(screen.queryByText("assigned to the")).toBeNull();
});
it("renders a 'disabled_disk_encryption' type activity for hosts with no team.", () => {
const activity = createMockActivity({
type: ActivityType.DisabledDiskEncryption,
details: {},
});
render(<ActivityItem activity={activity} isPremiumTier />);
expect(
screen.getByText(
"removed disk encryption enforcement for hosts with no team.",
{
exact: false,
}
)
).toBeInTheDocument();
expect(screen.queryByText("assigned to the")).toBeNull();
});
it("renders a 'disabled_macos_disk_encryption' type activity for hosts with no team.", () => {
// Test deprecated activity type
const activity = createMockActivity({
type: ActivityType.DisabledMacDiskEncryption,
details: {},
@ -611,7 +682,7 @@ describe("Activity Feed", () => {
expect(
screen.getByText(
"removed disk encryption enforcement for macOS hosts with no team.",
"removed disk encryption enforcement for hosts with no team.",
{
exact: false,
}

View file

@ -457,13 +457,13 @@ const TAGGED_TEMPLATES = {
</>
);
},
enableMacDiskEncryption: (activity: IActivity) => {
enabledDiskEncryption: (activity: IActivity) => {
const suffix = getDiskEncryptionMessageSuffix(activity.details?.team_name);
return <> enforced disk encryption for macOS hosts {suffix}.</>;
return <> enforced disk encryption for hosts {suffix}.</>;
},
disableMacDiskEncryption: (activity: IActivity) => {
disabledEncryption: (activity: IActivity) => {
const suffix = getDiskEncryptionMessageSuffix(activity.details?.team_name);
return <>removed disk encryption enforcement for macOS hosts {suffix}.</>;
return <>removed disk encryption enforcement for hosts {suffix}.</>;
},
changedMacOSSetupAssistant: (activity: IActivity) => {
return getMacOSSetupAssistantMessage(
@ -819,11 +819,17 @@ const getDetail = (
case ActivityType.EditedWindowsProfile: {
return TAGGED_TEMPLATES.editWindowsProfile(activity, isPremiumTier);
}
// Note: Both "enabled_disk_encryption" and "enabled_macos_disk_encryption" display the same
// message. The latter is deprecated in the API but it is retained here for backwards compatibility.
case ActivityType.EnabledDiskEncryption:
case ActivityType.EnabledMacDiskEncryption: {
return TAGGED_TEMPLATES.enableMacDiskEncryption(activity);
return TAGGED_TEMPLATES.enabledDiskEncryption(activity);
}
// Note: Both "disabled_disk_encryption" and "disabled_macos_disk_encryption" display the same
// message. The latter is deprecated in the API but it is retained here for backwards compatibility.
case ActivityType.DisabledDiskEncryption:
case ActivityType.DisabledMacDiskEncryption: {
return TAGGED_TEMPLATES.disableMacDiskEncryption(activity);
return TAGGED_TEMPLATES.disabledEncryption(activity);
}
case ActivityType.AddedBootstrapPackage: {
return TAGGED_TEMPLATES.addedMDMBootstrapPackage(activity);