Browse Source

fix: update audit logs oss api

pull/8836/head
Ramesh Mane 2 weeks ago
parent
commit
25491edde2
  1. 4
      packages/nc-gui/components/workspace/AuditLogs.vue
  2. 3
      packages/nc-gui/components/workspace/View.vue
  3. 4
      packages/nocodb/src/controllers/audits.controller.ts
  4. 87
      packages/nocodb/src/models/Audit.ts
  5. 70
      packages/nocodb/src/schema/swagger.json
  6. 4
      packages/nocodb/src/services/audits.service.ts

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

@ -196,7 +196,7 @@ useEventListener(tableWrapper, 'scroll', () => {
<template #title> <template #title>
{{ bases.get(baseId)?.title }} {{ bases.get(baseId)?.title }}
</template> </template>
{{ bases.get(baseId)?.title }} Record with ID 12 has been updated in Table Features. Column "Title" got changed from {{ bases.get(baseId)?.title }}
</NcTooltip> </NcTooltip>
</h6> </h6>
</div> </div>
@ -231,7 +231,7 @@ useEventListener(tableWrapper, 'scroll', () => {
<div <div
class="table-container relative" class="table-container relative"
:class="{ :class="{
'h-[calc(100%_-_92px)] ': baseId, 'h-[calc(100%_-_48px)] ': baseId,
'h-[calc(100%_-_56px)]': !baseId, 'h-[calc(100%_-_56px)]': !baseId,
'bordered': bordered, 'bordered': bordered,
}" }"

3
packages/nc-gui/components/workspace/View.vue

@ -70,9 +70,8 @@ onMounted(() => {
<template> <template>
<div v-if="currentWorkspace" class="flex w-full px-6 max-w-[97.5rem] flex-col nc-workspace-settings"> <div v-if="currentWorkspace" class="flex w-full px-6 max-w-[97.5rem] flex-col nc-workspace-settings">
<div v-if="!props.workspaceId" class="flex gap-2 items-center min-w-0 py-4"> <div v-if="!props.workspaceId" class="flex gap-2 items-center min-w-0 py-4">
<GeneralWorkspaceIcon :workspace="currentWorkspace" />
<h1 class="text-base capitalize font-weight-bold tracking-[0.5px] mb-0 nc-workspace-title truncate min-w-10 capitalize"> <h1 class="text-base capitalize font-weight-bold tracking-[0.5px] mb-0 nc-workspace-title truncate min-w-10 capitalize">
{{ currentWorkspace?.title }} {{ currentWorkspace?.title }} > {{ $t('title.teamAndSettings') }}
</h1> </h1>
</div> </div>
<div v-else> <div v-else>

4
packages/nocodb/src/controllers/audits.controller.ts

@ -74,9 +74,7 @@ export class AuditsController {
query: req.query, query: req.query,
}), }),
{ {
count: await this.auditsService.projectAuditCount({ count: await this.auditsService.projectAuditCount(),
query: req.query,
}),
...req.query, ...req.query,
}, },
); );

87
packages/nocodb/src/models/Audit.ts

@ -141,19 +141,11 @@ export default class Audit implements AuditType {
limit = 25, limit = 25,
offset = 0, offset = 0,
sourceId, sourceId,
user,
type,
startDate,
endDate,
orderBy, orderBy,
}: { }: {
limit?: number; limit?: number;
offset?: number; offset?: number;
sourceId?: string; sourceId?: string;
user?: string;
type?: string;
startDate?: string;
endDate?: string;
orderBy?: { orderBy?: {
created_at?: 'asc' | 'desc'; created_at?: 'asc' | 'desc';
user?: 'asc' | 'desc'; user?: 'asc' | 'desc';
@ -168,8 +160,6 @@ export default class Audit implements AuditType {
condition: { condition: {
base_id: baseId, base_id: baseId,
...(sourceId ? { source_id: sourceId } : {}), ...(sourceId ? { source_id: sourceId } : {}),
...(user ? { user: user } : {}),
...(type ? { op_type: type } : {}),
}, },
orderBy: { orderBy: {
...(orderBy?.created_at ...(orderBy?.created_at
@ -179,12 +169,6 @@ export default class Audit implements AuditType {
: {}), : {}),
...(orderBy?.user ? { user: orderBy?.user } : {}), ...(orderBy?.user ? { user: orderBy?.user } : {}),
}, },
xcCondition: {
_and: [
...(startDate ? [{ created_at: { ge: startDate } }] : []),
...(endDate ? [{ created_at: { le: endDate } }] : []),
],
},
limit, limit,
offset, offset,
}, },
@ -195,16 +179,8 @@ export default class Audit implements AuditType {
baseId: string, baseId: string,
{ {
sourceId, sourceId,
user,
type,
startDate,
endDate,
}: { }: {
sourceId?: string; sourceId?: string;
user?: string;
type?: string;
startDate?: string;
endDate?: string;
}, },
): Promise<number> { ): Promise<number> {
return await Noco.ncMeta.metaCount( return await Noco.ncMeta.metaCount(
@ -214,15 +190,7 @@ export default class Audit implements AuditType {
{ {
condition: { condition: {
base_id: baseId, base_id: baseId,
...(user ? { user: user } : {}),
...(sourceId ? { source_id: sourceId } : {}), ...(sourceId ? { source_id: sourceId } : {}),
...(type ? { op_type: type } : {}),
},
xcCondition: {
_and: [
...(startDate ? [{ created_at: { ge: startDate } }] : []),
...(endDate ? [{ created_at: { le: endDate } }] : []),
],
}, },
}, },
); );
@ -257,22 +225,10 @@ export default class Audit implements AuditType {
static async projectAuditList({ static async projectAuditList({
limit = 25, limit = 25,
offset = 0, offset = 0,
sourceId,
user,
baseId,
type,
startDate,
endDate,
orderBy, orderBy,
}: { }: {
limit?: number; limit?: number;
offset?: number; offset?: number;
sourceId?: string;
user?: string;
baseId?: string;
type?: string;
startDate?: string;
endDate?: string;
orderBy?: { orderBy?: {
created_at?: 'asc' | 'desc'; created_at?: 'asc' | 'desc';
user?: 'asc' | 'desc'; user?: 'asc' | 'desc';
@ -285,12 +241,6 @@ export default class Audit implements AuditType {
{ {
limit, limit,
offset, offset,
condition: {
...(user ? { user: user } : {}),
...(baseId ? { base_id: baseId } : {}),
...(sourceId ? { source_id: sourceId } : {}),
...(type ? { op_type: type } : {}),
},
orderBy: { orderBy: {
...(orderBy?.created_at ...(orderBy?.created_at
? { created_at: orderBy?.created_at } ? { created_at: orderBy?.created_at }
@ -299,49 +249,16 @@ export default class Audit implements AuditType {
: {}), : {}),
...(orderBy?.user ? { user: orderBy?.user } : {}), ...(orderBy?.user ? { user: orderBy?.user } : {}),
}, },
xcCondition: {
_and: [
...(startDate ? [{ created_at: { ge: startDate } }] : []),
...(endDate ? [{ created_at: { le: endDate } }] : []),
],
},
}, },
); );
} }
static async projectAuditCount({ static async projectAuditCount(): Promise<number> {
user,
baseId,
sourceId,
type,
startDate,
endDate,
}: {
user?: string;
baseId?: string;
sourceId?: string;
type?: string;
startDate?: string;
endDate?: string;
}): Promise<number> {
return await Noco.ncMeta.metaCount( return await Noco.ncMeta.metaCount(
RootScopes.ROOT, RootScopes.ROOT,
RootScopes.ROOT, RootScopes.ROOT,
MetaTable.AUDIT, MetaTable.AUDIT,
{ {},
condition: {
...(user ? { user: user } : {}),
...(baseId ? { base_id: baseId } : {}),
...(sourceId ? { source_id: sourceId } : {}),
...(type ? { op_type: type } : {}),
},
xcCondition: {
_and: [
...(startDate ? [{ created_at: { ge: startDate } }] : []),
...(endDate ? [{ created_at: { le: endDate } }] : []),
],
},
},
); );
} }
} }

70
packages/nocodb/src/schema/swagger.json

@ -14140,48 +14140,6 @@
"in": "query", "in": "query",
"name": "limit" "name": "limit"
}, },
{
"schema": {
"type": "string"
},
"in": "query",
"name": "user"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "type"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "baseId"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "sourceId"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "startDate"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "endDate"
},
{ {
"schema": { "schema": {
"properties": { "properties": {
@ -14291,34 +14249,6 @@
"in": "query", "in": "query",
"name": "sourceId" "name": "sourceId"
}, },
{
"schema": {
"type": "string"
},
"in": "query",
"name": "user"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "type"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "startDate"
},
{
"schema": {
"type": "string"
},
"in": "query",
"name": "endDate"
},
{ {
"schema": { "schema": {
"properties": { "properties": {

4
packages/nocodb/src/services/audits.service.ts

@ -89,7 +89,7 @@ export class AuditsService {
return await Audit.projectAuditList(param.query); return await Audit.projectAuditList(param.query);
} }
async projectAuditCount(param: { query?: any }) { async projectAuditCount() {
return await Audit.projectAuditCount(param.query); return await Audit.projectAuditCount();
} }
} }

Loading…
Cancel
Save