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