From db191a353e57c1ebb41cb31c4ee1f7176c855dde Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:57:39 +0530 Subject: [PATCH] revert(nc-gui): audit related team & settings page changes --- .../nc-gui/components/workspace/AuditLogs.vue | 729 +++++++++++++++++- packages/nc-gui/pages/account/index.vue | 13 + .../nc-gui/pages/account/index/[page].vue | 1 + packages/nc-gui/store/workspace.ts | 35 +- 4 files changed, 772 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui/components/workspace/AuditLogs.vue b/packages/nc-gui/components/workspace/AuditLogs.vue index 732f342a07..2a1ac62741 100644 --- a/packages/nc-gui/components/workspace/AuditLogs.vue +++ b/packages/nc-gui/components/workspace/AuditLogs.vue @@ -1,4 +1,8 @@ - + diff --git a/packages/nc-gui/pages/account/index.vue b/packages/nc-gui/pages/account/index.vue index c6e6abac62..1c3b1e289d 100644 --- a/packages/nc-gui/pages/account/index.vue +++ b/packages/nc-gui/pages/account/index.vue @@ -128,7 +128,20 @@ const isPending = computed(() => !emailConfigured.value || !storageConfigured.va
{{ $t('title.tokens') }}
+ +
+ +
{{ $t('title.auditLogs') }}
+
+
+ diff --git a/packages/nc-gui/store/workspace.ts b/packages/nc-gui/store/workspace.ts index dd52bfefc9..333d2655f4 100644 --- a/packages/nc-gui/store/workspace.ts +++ b/packages/nc-gui/store/workspace.ts @@ -16,6 +16,8 @@ const defaultAuditLogsQuery = { export const useWorkspace = defineStore('workspaceStore', () => { const basesStore = useBases() + const { isUIAllowed } = useRoles() + const collaborators = ref() const allCollaborators = ref() @@ -259,9 +261,36 @@ export const useWorkspace = defineStore('workspaceStore', () => { const loadAudits = async ( _workspaceId?: string, - _page: number = auditPaginationData.value.page!, - _limit: number = auditPaginationData.value.pageSize!, - ) => {} + page: number = auditPaginationData.value.page!, + limit: number = auditPaginationData.value.pageSize!, + ) => { + try { + if (limit * (page - 1) > auditPaginationData.value.totalRows!) { + auditPaginationData.value.page = 1 + page = 1 + } + + const { list, pageInfo } = isUIAllowed('workspaceAuditList') + ? await $api.utils.projectAuditList({ + offset: limit * (page - 1), + limit, + ...auditLogsQuery.value, + }) + : await $api.base.auditList(auditLogsQuery.value.baseId, { + offset: limit * (page - 1), + limit, + ...auditLogsQuery.value, + }) + + audits.value = list + auditPaginationData.value.totalRows = pageInfo.totalRows ?? 0 + } catch (e) { + message.error(await extractSdkResponseErrorMsg(e)) + audits.value = [] + auditPaginationData.value.totalRows = 0 + auditPaginationData.value.page = 1 + } + } function setLoadingState(isLoading = false) { isWorkspaceLoading.value = isLoading