Browse Source

fix: update audit logs oss api

pull/8836/head
Ramesh Mane 1 week 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>
{{ bases.get(baseId)?.title }}
</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>
</h6>
</div>
@ -231,7 +231,7 @@ useEventListener(tableWrapper, 'scroll', () => {
<div
class="table-container relative"
:class="{
'h-[calc(100%_-_92px)] ': baseId,
'h-[calc(100%_-_48px)] ': baseId,
'h-[calc(100%_-_56px)]': !baseId,
'bordered': bordered,
}"

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

@ -70,9 +70,8 @@ onMounted(() => {
<template>
<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">
<GeneralWorkspaceIcon :workspace="currentWorkspace" />
<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>
</div>
<div v-else>

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

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

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

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

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

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

Loading…
Cancel
Save