Browse Source

fix(nc-gui): update audit logs query params

pull/8836/head
Ramesh Mane 3 months ago
parent
commit
4e51491fb4
  1. 22
      packages/nc-gui/components/workspace/AuditLogs.vue
  2. 6
      packages/nc-gui/lib/types.ts

22
packages/nc-gui/components/workspace/AuditLogs.vue

@ -40,7 +40,7 @@ const { bases, basesList } = storeToRefs(basesStore)
const baseCollaborators = ref<User[]>([]) const baseCollaborators = ref<User[]>([])
const auditCollaborators = computed(() => { const auditCollaborators = computed(() => {
return (auditLogsQuery.value.base ? baseCollaborators.value : collaborators.value) || [] return (auditLogsQuery.value.baseId ? baseCollaborators.value : collaborators.value) || []
}) })
const collaboratorsMap = computed<Map<string, (WorkspaceUserType & { id: string }) | User>>(() => { const collaboratorsMap = computed<Map<string, (WorkspaceUserType & { id: string }) | User>>(() => {
@ -136,10 +136,10 @@ async function loadAudits(page = currentPage.value, limit = currentLimit.value,
const loadCollaborators = async () => { const loadCollaborators = async () => {
try { try {
if (!auditLogsQuery.value.base) return if (!auditLogsQuery.value.baseId) return
const { users } = await getBaseUsers({ const { users } = await getBaseUsers({
baseId: auditLogsQuery.value.base, baseId: auditLogsQuery.value.baseId,
}) })
baseCollaborators.value = users baseCollaborators.value = users
@ -154,7 +154,7 @@ const handleRowClick = (audit: AuditType) => {
} }
const handleUpdateBaseQuery = (baseId?: string, sourceId?: string) => { const handleUpdateBaseQuery = (baseId?: string, sourceId?: string) => {
auditLogsQuery.value.base = baseId auditLogsQuery.value.baseId = baseId
auditLogsQuery.value.sourceId = sourceId auditLogsQuery.value.sourceId = sourceId
} }
@ -271,9 +271,9 @@ const handleUpdateCustomDateRange = (value: string | null, field: 'startDate' |
} }
watch( watch(
() => auditLogsQuery.value.base, () => auditLogsQuery.value.baseId,
() => { () => {
if (!auditLogsQuery.value.base) return if (!auditLogsQuery.value.baseId) return
loadCollaborators() loadCollaborators()
}, },
@ -284,7 +284,7 @@ watch(
onMounted(async () => { onMounted(async () => {
if (props.baseId) { if (props.baseId) {
auditLogsQuery.value.base = props.baseId auditLogsQuery.value.baseId = props.baseId
} }
if (props.sourceId) { if (props.sourceId) {
@ -435,8 +435,8 @@ onMounted(async () => {
<div class="!w-[106px] flex items-center justify-between gap-2"> <div class="!w-[106px] flex items-center justify-between gap-2">
<div class="max-w-full truncate text-sm !leading-5"> <div class="max-w-full truncate text-sm !leading-5">
Base: Base:
<span :class="{ 'text-brand-500': auditLogsQuery.base }"> <span :class="{ 'text-brand-500': auditLogsQuery.baseId }">
{{ (auditLogsQuery.base && bases.get(auditLogsQuery.base)?.title) || 'All' }} {{ (auditLogsQuery.baseId && bases.get(auditLogsQuery.baseId)?.title) || 'All' }}
</span> </span>
</div> </div>
<GeneralIcon icon="arrowDown" class="flex-none h-4 w-4" /> <GeneralIcon icon="arrowDown" class="flex-none h-4 w-4" />
@ -483,7 +483,7 @@ onMounted(async () => {
> >
<div class="w-full flex items-center justify-between gap-3"> <div class="w-full flex items-center justify-between gap-3">
<span class="flex-1 text-gray-800"> All Bases </span> <span class="flex-1 text-gray-800"> All Bases </span>
<GeneralIcon v-if="!auditLogsQuery.base" icon="check" class="flex-none text-primary w-4 h-4" /> <GeneralIcon v-if="!auditLogsQuery.baseId" icon="check" class="flex-none text-primary w-4 h-4" />
</div> </div>
</NcMenuItem> </NcMenuItem>
<NcDivider /> <NcDivider />
@ -509,7 +509,7 @@ onMounted(async () => {
</NcTooltip> </NcTooltip>
</div> </div>
<GeneralIcon v-if="auditLogsQuery.base === base.id" icon="check" class="flex-none text-primary w-4 h-4" /> <GeneralIcon v-if="auditLogsQuery.baseId === base.id" icon="check" class="flex-none text-primary w-4 h-4" />
</div> </div>
</NcMenuItem> </NcMenuItem>
</template> </template>

6
packages/nc-gui/lib/types.ts

@ -240,11 +240,9 @@ interface ImageCropperConfig {
interface AuditLogsQuery { interface AuditLogsQuery {
type?: AuditOperationTypes type?: AuditOperationTypes
subType?: AuditOperationSubTypes baseId?: string
base?: string
user?: string
search?: string
sourceId?: string sourceId?: string
user?: string
startDate?: string startDate?: string
endDate?: string endDate?: string
dateRange?: AuditLogsDateRange dateRange?: AuditLogsDateRange

Loading…
Cancel
Save