From 4921eccd9e8b71c96f48e56a460dec8cc31f1491 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Mon, 24 Jun 2024 08:28:50 +0000 Subject: [PATCH] feat(nc-gui): add audit logs filters --- .../nc-gui/components/workspace/AuditLogs.vue | 149 ++++++++++++++++-- 1 file changed, 137 insertions(+), 12 deletions(-) diff --git a/packages/nc-gui/components/workspace/AuditLogs.vue b/packages/nc-gui/components/workspace/AuditLogs.vue index 0de3ad88d8..9aa4b8d912 100644 --- a/packages/nc-gui/components/workspace/AuditLogs.vue +++ b/packages/nc-gui/components/workspace/AuditLogs.vue @@ -9,13 +9,9 @@ interface Props { const props = defineProps() -const { workspaceRoles } = useRoles() - const workspaceStore = useWorkspace() -const { removeCollaborator, updateCollaborator: _updateCollaborator, loadWorkspace } = workspaceStore - -const { collaborators, activeWorkspace, workspacesList } = storeToRefs(workspaceStore) +const { collaborators } = storeToRefs(workspaceStore) const collaboratorsMap = computed>(() => { const map = new Map() @@ -35,6 +31,8 @@ const { $api } = useNuxtApp() const { t } = useI18n() +const { appInfo } = useGlobal() + const isLoading = ref(false) const audits = ref>(null) @@ -49,10 +47,23 @@ const isRowExpanded = ref(false) const selectedAudit = ref(null) -const { appInfo } = useGlobal() +const auditDropdowns = ref({ + type: false, + subType: false, + base: false, + user: false, +}) -watchEffect(() => { - console.log('bases', bases.value, collaborators.value, collaboratorsMap.value) +const auditLogsQuery = ref<{ + type?: string + subType?: string + base?: string + user?: string +}>({ + type: undefined, + subType: undefined, + base: undefined, + user: undefined, }) async function loadAudits(page = currentPage.value, limit = currentLimit.value) { @@ -69,7 +80,9 @@ async function loadAudits(page = currentPage.value, limit = currentLimit.value) const { list, pageInfo } = await $api.workspace.auditList(props.workspaceId, { offset: limit * (page - 1), limit, + ...auditLogsQuery.value, }) + audits.value = list totalRows.value = pageInfo.totalRows ?? 0 @@ -108,9 +121,118 @@ onMounted(async () => {
Track and monitor any changes made to any base in your workspace.
-
+
+ + +
+
+ Base: {{ (auditLogsQuery.base && bases.get(auditLogsQuery.base)?.title) || 'All' }} +
+ +
+
+ + +
+ + +
+
+ User: + {{ + (auditLogsQuery.user && + (collaboratorsMap.get(auditLogsQuery.user)?.display_name || + collaboratorsMap + .get(auditLogsQuery.user) + ?.email?.slice(0, collaboratorsMap.get(auditLogsQuery.user)?.email.indexOf('@')))) || + 'All' + }} +
+ +
+
+ + +
+
-
+
@@ -155,7 +277,6 @@ onMounted(async () => { .get(audit.user) ?.email?.slice(0, collaboratorsMap.get(audit.user)?.email.indexOf('@')) }} - some of the things that i wanted to ask
@@ -283,7 +404,7 @@ onMounted(async () => { />
-
{{ bases.get(selectedAudit?.base_id)?.title }}
+
{{ bases.get(selectedAudit?.base_id)?.title }}
{{ selectedAudit?.base_id }}
@@ -321,6 +442,10 @@ onMounted(async () => { font-family: unset; } +:deep(.nc-menu-item-inner) { + @apply !w-full; +} + .nc-audit-logs-table { .thead { .th {