From 0f70c3ea9a905ee7d93e82f39a07766f73572aa5 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Wed, 18 Sep 2024 16:52:54 +0400 Subject: [PATCH] Moved audit logs to org-level entirely --- .../views/Org/AuditLogsPage/AuditLogsPage.tsx | 5 +++-- .../AuditLogsPage/components/LogsFilter.tsx | 16 +++++++------- .../AuditLogsPage/components/LogsSection.tsx | 1 + .../AuditLogsPage/components/LogsTable.tsx | 0 .../AuditLogsPage/components/LogsTableRow.tsx | 0 .../AuditLogsPage/components/index.tsx | 0 .../AuditLogsPage/components/types.tsx | 0 .../Project/AuditLogsPage/AuditLogsPage.tsx | 21 ------------------- .../src/views/Project/AuditLogsPage/index.tsx | 1 - 9 files changed, 12 insertions(+), 32 deletions(-) rename frontend/src/views/{Project => Org}/AuditLogsPage/components/LogsFilter.tsx (94%) rename frontend/src/views/{Project => Org}/AuditLogsPage/components/LogsSection.tsx (99%) rename frontend/src/views/{Project => Org}/AuditLogsPage/components/LogsTable.tsx (100%) rename frontend/src/views/{Project => Org}/AuditLogsPage/components/LogsTableRow.tsx (100%) rename frontend/src/views/{Project => Org}/AuditLogsPage/components/index.tsx (100%) rename frontend/src/views/{Project => Org}/AuditLogsPage/components/types.tsx (100%) delete mode 100644 frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx delete mode 100644 frontend/src/views/Project/AuditLogsPage/index.tsx diff --git a/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx b/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx index 239ec7ff7..2b6ec6744 100644 --- a/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx +++ b/frontend/src/views/Org/AuditLogsPage/AuditLogsPage.tsx @@ -1,6 +1,7 @@ import { OrgPermissionActions, OrgPermissionSubjects } from "@app/context"; import { withPermission } from "@app/hoc"; -import { LogsSection } from "@app/views/Project/AuditLogsPage/components"; + +import { LogsSection } from "./components"; export const AuditLogsPage = withPermission( () => { @@ -16,5 +17,5 @@ export const AuditLogsPage = withPermission( ); }, - { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.Member } // TODO(Daniel): Create a permission for org audit logs + { action: OrgPermissionActions.Read, subject: OrgPermissionSubjects.AuditLogs } ); diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsFilter.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx similarity index 94% rename from frontend/src/views/Project/AuditLogsPage/components/LogsFilter.tsx rename to frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx index ba1b91a85..cf00c9b0a 100644 --- a/frontend/src/views/Project/AuditLogsPage/components/LogsFilter.tsx +++ b/frontend/src/views/Org/AuditLogsPage/components/LogsFilter.tsx @@ -199,7 +199,7 @@ export const LogsFilter = ({ ( + render={({ field: { onChange, value, ...field }, fieldState: { error } }) => ( { if (e === "all") onChange(undefined); @@ -251,7 +251,7 @@ export const LogsFilter = ({ }} className={twMerge( "w-full border border-mineshaft-500 bg-mineshaft-700 text-mineshaft-100", - (field.value === "all" || field.value === undefined) && "text-mineshaft-400" + value === undefined && "text-mineshaft-400" )} > diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsSection.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx similarity index 99% rename from frontend/src/views/Project/AuditLogsPage/components/LogsSection.tsx rename to frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx index 83ae4d1df..a184b0f5c 100644 --- a/frontend/src/views/Project/AuditLogsPage/components/LogsSection.tsx +++ b/frontend/src/views/Org/AuditLogsPage/components/LogsSection.tsx @@ -47,6 +47,7 @@ export const LogsSection = ({ const { control, reset, watch } = useForm({ resolver: yupResolver(auditLogFilterFormSchema), defaultValues: { + projectId: undefined, actor: presets?.actorId, eventType: presets?.eventType || [], page: 1, diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTable.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsTable.tsx similarity index 100% rename from frontend/src/views/Project/AuditLogsPage/components/LogsTable.tsx rename to frontend/src/views/Org/AuditLogsPage/components/LogsTable.tsx diff --git a/frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx b/frontend/src/views/Org/AuditLogsPage/components/LogsTableRow.tsx similarity index 100% rename from frontend/src/views/Project/AuditLogsPage/components/LogsTableRow.tsx rename to frontend/src/views/Org/AuditLogsPage/components/LogsTableRow.tsx diff --git a/frontend/src/views/Project/AuditLogsPage/components/index.tsx b/frontend/src/views/Org/AuditLogsPage/components/index.tsx similarity index 100% rename from frontend/src/views/Project/AuditLogsPage/components/index.tsx rename to frontend/src/views/Org/AuditLogsPage/components/index.tsx diff --git a/frontend/src/views/Project/AuditLogsPage/components/types.tsx b/frontend/src/views/Org/AuditLogsPage/components/types.tsx similarity index 100% rename from frontend/src/views/Project/AuditLogsPage/components/types.tsx rename to frontend/src/views/Org/AuditLogsPage/components/types.tsx diff --git a/frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx b/frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx deleted file mode 100644 index e9b8504a2..000000000 --- a/frontend/src/views/Project/AuditLogsPage/AuditLogsPage.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context"; -import { withProjectPermission } from "@app/hoc"; - -import { LogsSection } from "./components"; - -export const AuditLogsPage = withProjectPermission( - () => { - return ( -
-
-
-

Audit Logs

-
-
- -
-
- ); - }, - { action: ProjectPermissionActions.Read, subject: ProjectPermissionSub.AuditLogs } -); diff --git a/frontend/src/views/Project/AuditLogsPage/index.tsx b/frontend/src/views/Project/AuditLogsPage/index.tsx deleted file mode 100644 index 3864b1435..000000000 --- a/frontend/src/views/Project/AuditLogsPage/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export { AuditLogsPage } from "./AuditLogsPage";