mirror of
https://github.com/nocodb/nocodb.git
synced 2026-06-02 00:22:02 +00:00
fix: review corrections
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import {
|
||||
type AttachmentType,
|
||||
type AuditType,
|
||||
type TableType,
|
||||
checkboxIconListMap,
|
||||
isAIPromptCol,
|
||||
parseHelper,
|
||||
@@ -12,6 +13,10 @@ const props = defineProps<{
|
||||
audit: AuditType
|
||||
}>()
|
||||
|
||||
const tableMeta = inject(MetaInj, ref())
|
||||
|
||||
const isSyncedTable = computed(() => !!(tableMeta.value as TableType | undefined)?.synced)
|
||||
|
||||
const details = computed(() => {
|
||||
try {
|
||||
return JSON.parse(props.audit.details || '')
|
||||
@@ -33,7 +38,11 @@ const meta = computed(() => {
|
||||
})
|
||||
|
||||
const columnKeys = computed(() => {
|
||||
return Object.keys(newData.value)
|
||||
const keys = Object.keys(newData.value)
|
||||
// On synced tables, sync bookkeeping fields (RemoteSyncedAt, SyncRunId, …)
|
||||
// change on every sync and drown out the real edit — hide their rows.
|
||||
if (!isSyncedTable.value) return keys
|
||||
return keys.filter((key) => !isSyncSystemColumnTitle(key))
|
||||
})
|
||||
|
||||
/* provides */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { type AuditType, PlanLimitTypes } from 'nocodb-sdk'
|
||||
import { type AuditType, PlanLimitTypes, type TableType } from 'nocodb-sdk'
|
||||
|
||||
const { user } = useGlobal()
|
||||
|
||||
@@ -93,6 +93,8 @@ watch(
|
||||
|
||||
const meta = inject(MetaInj, ref())
|
||||
|
||||
const isSyncedTable = computed(() => !!(meta.value as TableType | undefined)?.synced)
|
||||
|
||||
function safeJsonParse(json: string) {
|
||||
try {
|
||||
return JSON.parse(json)
|
||||
@@ -101,6 +103,26 @@ function safeJsonParse(json: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Op types whose audit detail is a per-field change set (DATA_UPDATE family).
|
||||
const UPDATE_OP_TYPES = ['DATA_UPDATE', 'DATA_BULK_UPDATE', 'DATA_BULK_ALL_UPDATE', 'DATA_CASCADE_UPDATE']
|
||||
|
||||
// On synced tables, an update that touched ONLY sync bookkeeping fields
|
||||
// (RemoteSyncedAt, SyncRunId, …) is pure sync noise — drop the whole entry so
|
||||
// the revision history only surfaces real data changes. Mixed entries still
|
||||
// render; AuditMiniItem hides their sync-system rows individually.
|
||||
const visibleAudits = computed(() => {
|
||||
if (!isSyncedTable.value) return consolidatedAudits.value
|
||||
|
||||
return consolidatedAudits.value.filter((audit) => {
|
||||
if (!UPDATE_OP_TYPES.includes(audit?.op_type)) return true
|
||||
|
||||
const changedKeys = Object.keys(safeJsonParse(audit.details as string)?.data ?? {})
|
||||
if (!changedKeys.length) return true
|
||||
|
||||
return changedKeys.some((key) => !isSyncSystemColumnTitle(key))
|
||||
})
|
||||
})
|
||||
|
||||
function getLinkColumnType(audit: AuditType) {
|
||||
const details = safeJsonParse(audit.details as string)
|
||||
const col = meta.value?.columns?.find((c: any) => c.id === details.link_field_id)
|
||||
@@ -127,7 +149,7 @@ function isV0Audit(audit: AuditType) {
|
||||
</div>
|
||||
|
||||
<div v-else ref="auditsWrapperEl" class="flex flex-col h-full nc-scrollbar-thin pb-1">
|
||||
<template v-if="consolidatedAudits.length === 0">
|
||||
<template v-if="visibleAudits.length === 0">
|
||||
<div class="flex flex-col text-center justify-center h-full">
|
||||
<div class="text-center text-3xl text-nc-content-gray-subtle2">
|
||||
<MdiHistory />
|
||||
@@ -161,7 +183,7 @@ function isV0Audit(audit: AuditType) {
|
||||
<div v-if="hasMoreAudits" class="p-3 text-center">
|
||||
<NcButton size="small" type="secondary" @click="initLoadMoreAudits()"> Load earlier </NcButton>
|
||||
</div>
|
||||
<div v-for="audit of consolidatedAudits" :key="audit.id" :class="`${audit.id}`" class="nc-audit-item">
|
||||
<div v-for="audit of visibleAudits" :key="audit.id" :class="`${audit.id}`" class="nc-audit-item">
|
||||
<div class="group gap-3 overflow-hidden px-3 py-2 transition hover:bg-nc-bg-gray-light">
|
||||
<div class="flex items-start justify-between">
|
||||
<div class="flex items-start gap-3 flex-1 w-full">
|
||||
|
||||
@@ -11,6 +11,35 @@ import {
|
||||
generateUniqueCopyName,
|
||||
} from 'nocodb-sdk'
|
||||
|
||||
/**
|
||||
* Titles of the system columns that table-sync (and legacy SaaS/Airtable sync)
|
||||
* adds to every synced destination table — they hold sync bookkeeping (remote
|
||||
* id, remote timestamps, run/config ids, raw payload). They're noise in a
|
||||
* record's revision history, so the audit sidebar hides their changes on
|
||||
* synced tables.
|
||||
*
|
||||
* Mirrors the backend source of truth: `syncSystemFields` /
|
||||
* `SYSTEM_REMOTE_TITLES` in
|
||||
* `@noco-local-integrations/core/src/sync/common.ts`. Keep in sync if a new
|
||||
* system field is added there.
|
||||
*/
|
||||
const SYNC_SYSTEM_COLUMN_TITLES = new Set<string>([
|
||||
'RemoteId',
|
||||
'RemoteCreatedAt',
|
||||
'RemoteUpdatedAt',
|
||||
'RemoteDeletedTime',
|
||||
'RemoteDeleted',
|
||||
'RemoteRaw',
|
||||
'RemoteSyncedAt',
|
||||
'RemoteNamespace',
|
||||
'SyncConfigId',
|
||||
'SyncRunId',
|
||||
'SyncProvider',
|
||||
])
|
||||
|
||||
const isSyncSystemColumnTitle = (title?: string | null): boolean =>
|
||||
!!title && SYNC_SYSTEM_COLUMN_TITLES.has(title)
|
||||
|
||||
const getSyncFrequency = (trigger: SyncTrigger, cron?: string) => {
|
||||
if (trigger === SyncTrigger.Manual) return 'Manual'
|
||||
if (trigger === SyncTrigger.Schedule && cron) {
|
||||
@@ -112,6 +141,8 @@ export {
|
||||
defaultIntegrationConfig,
|
||||
syncEntityToReadableMap,
|
||||
getDefaultSyncConfig,
|
||||
SYNC_SYSTEM_COLUMN_TITLES,
|
||||
isSyncSystemColumnTitle,
|
||||
}
|
||||
|
||||
export type { IntegrationConfig, CustomSyncSchema }
|
||||
|
||||
Reference in New Issue
Block a user