@@ -0,0 +1 @@
|
||||
- Fixed reading disk encryption key not showing up in host activities
|
||||
@@ -128,6 +128,7 @@ export type IHostPastActivityType =
|
||||
| ActivityType.RanScript
|
||||
| ActivityType.LockedHost
|
||||
| ActivityType.WipedHost
|
||||
| ActivityType.ReadHostDiskEncryptionKey
|
||||
| ActivityType.UnlockedHost
|
||||
| ActivityType.InstalledSoftware
|
||||
| ActivityType.UninstalledSoftware
|
||||
|
||||
@@ -14,6 +14,7 @@ import RanScriptActivityItem from "./ActivityItems/RanScriptActivityItem";
|
||||
import LockedHostActivityItem from "./ActivityItems/LockedHostActivityItem";
|
||||
import WipedHostActivityItem from "./ActivityItems/WipedHostActivityItem";
|
||||
import UnlockedHostActivityItem from "./ActivityItems/UnlockedHostActivityItem";
|
||||
import ReadHostDiskEncryptionKeyActivityItem from "./ActivityItems/ReadHostDiskEncryptionKey";
|
||||
import InstalledSoftwareActivityItem from "./ActivityItems/InstalledSoftwareActivityItem";
|
||||
import CanceledRunScriptActivityItem from "./ActivityItems/CanceledRunScriptActivityItem";
|
||||
import CanceledInstallSoftwareActivityItem from "./ActivityItems/CanceledInstallSoftwareActivityItem";
|
||||
@@ -48,6 +49,7 @@ export const pastActivityComponentMap: Record<
|
||||
[ActivityType.RanScript]: RanScriptActivityItem,
|
||||
[ActivityType.LockedHost]: LockedHostActivityItem,
|
||||
[ActivityType.WipedHost]: WipedHostActivityItem,
|
||||
[ActivityType.ReadHostDiskEncryptionKey]: ReadHostDiskEncryptionKeyActivityItem,
|
||||
[ActivityType.UnlockedHost]: UnlockedHostActivityItem,
|
||||
[ActivityType.InstalledSoftware]: InstalledSoftwareActivityItem,
|
||||
[ActivityType.UninstalledSoftware]: InstalledSoftwareActivityItem,
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import React from "react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { createMockHostPastActivity } from "__mocks__/activityMock";
|
||||
|
||||
import ReadHostDiskEncryptionKeyActivityItem from "./ReadHostDiskEncryptionKey";
|
||||
|
||||
describe("ReadHostDiskEncryptionKeyActivityItem", () => {
|
||||
it("renders the activity content", () => {
|
||||
render(
|
||||
<ReadHostDiskEncryptionKeyActivityItem
|
||||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })}
|
||||
tab="past"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText("Test User")).toBeVisible();
|
||||
expect(screen.getByText(/viewed the disk encryption key/i)).toBeVisible();
|
||||
});
|
||||
|
||||
it("does not render the cancel icon", () => {
|
||||
render(
|
||||
<ReadHostDiskEncryptionKeyActivityItem
|
||||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })}
|
||||
tab="past"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.queryByTestId("close-icon")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("does not render the show details icon", () => {
|
||||
render(
|
||||
<ReadHostDiskEncryptionKeyActivityItem
|
||||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })}
|
||||
tab="past"
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.queryByTestId("info-outline-icon")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import React from "react";
|
||||
|
||||
import ActivityItem from "components/ActivityItem";
|
||||
|
||||
import { IHostActivityItemComponentProps } from "../../ActivityConfig";
|
||||
|
||||
const baseClass = "locked-host-activity-item";
|
||||
|
||||
const ReadHostDiskEncryptionKeyActivityItem = ({
|
||||
activity,
|
||||
}: IHostActivityItemComponentProps) => {
|
||||
return (
|
||||
<ActivityItem
|
||||
className={baseClass}
|
||||
activity={activity}
|
||||
hideCancel
|
||||
hideShowDetails
|
||||
>
|
||||
<b>{activity.actor_full_name} </b>
|
||||
viewed the disk encryption key for this host.
|
||||
</ActivityItem>
|
||||
);
|
||||
};
|
||||
|
||||
export default ReadHostDiskEncryptionKeyActivityItem;
|
||||
+1
@@ -0,0 +1 @@
|
||||
export { default } from "./ReadHostDiskEncryptionKey";
|
||||
@@ -1043,6 +1043,10 @@ func (a ActivityTypeReadHostDiskEncryptionKey) ActivityName() string {
|
||||
return "read_host_disk_encryption_key"
|
||||
}
|
||||
|
||||
func (a ActivityTypeReadHostDiskEncryptionKey) HostIDs() []uint {
|
||||
return []uint{a.HostID}
|
||||
}
|
||||
|
||||
func (a ActivityTypeReadHostDiskEncryptionKey) Documentation() (activity string, details string, detailsExample string) {
|
||||
return `Generated when a user reads the disk encryption key for a host.`,
|
||||
`This activity contains the following fields:
|
||||
|
||||
@@ -1483,6 +1483,7 @@ func TestHostEncryptionKey(t *testing.T) {
|
||||
) error {
|
||||
act := activity.(fleet.ActivityTypeReadHostDiskEncryptionKey)
|
||||
require.Equal(t, tt.host.ID, act.HostID)
|
||||
require.Equal(t, []uint{tt.host.ID}, act.HostIDs())
|
||||
require.EqualValues(t, act.HostDisplayName, tt.host.DisplayName())
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user