Browse Source

Merge pull request #8901 from nocodb/nc-fix/audit-related-fixes

Nc fix: Audit related fixes
pull/8950/head
Ramesh Mane 5 months ago committed by GitHub
parent
commit
bfbe3ff915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 25
      packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
  2. 4
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  3. 13
      packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue
  4. 16
      packages/nc-gui/components/workspace/AuditLogs.vue
  5. 6
      packages/nc-gui/composables/useExpandedFormStore.ts
  6. 2
      packages/nc-gui/composables/useMultiSelect/index.ts
  7. 921
      packages/nocodb/src/db/BaseModelSqlv2.ts
  8. 2
      packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts
  9. 2
      packages/nocodb/src/strategies/jwt.strategy.ts

25
packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

@ -186,6 +186,18 @@ function scrollToComment(commentId: string) {
}
}
function scrollToAudit(auditId?: string) {
if (!auditId) return
const auditEl = commentsWrapperEl.value?.querySelector(`.nc-audit-item.${auditId}`)
if (auditEl) {
auditEl.scrollIntoView({
behavior: 'smooth',
block: 'center',
})
}
}
watch(commentsWrapperEl, () => {
setTimeout(() => {
nextTick(() => {
@ -261,6 +273,17 @@ function handleResetHoverEffect() {
hoveredCommentId.value = null
}
watch(
() => audits.value.length,
(auditCount) => {
nextTick(() => {
setTimeout(() => {
scrollToAudit(audits.value[auditCount - 1]?.id)
}, 100)
})
},
)
</script>
<template>
@ -530,7 +553,7 @@ function handleResetHoverEffect() {
</div>
</template>
<div v-for="audit of audits" :key="audit.id" class="nc-audit-item">
<div v-for="audit of audits" :key="audit.id" :class="`${audit.id}`" class="nc-audit-item">
<div class="group gap-3 overflow-hidden px-3 py-2 hover:bg-gray-100">
<div class="flex items-start justify-between">
<div class="flex items-start gap-3 flex-1 w-full">

4
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -315,7 +315,9 @@ const reloadHook = createEventHook()
reloadHook.on(() => {
reloadParentRowHook?.trigger({ shouldShowLoading: false })
if (isNew.value) return
_loadRow(null, true)
_loadRow(undefined, true)
loadAudits(rowId.value, false)
})
provide(ReloadRowDataHookInj, reloadHook)

13
packages/nc-gui/components/smartsheet/toolbar/FieldListWithSearch.vue

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { isSystemColumn, type ColumnType } from 'nocodb-sdk'
import { type ColumnType, isSystemColumn } from 'nocodb-sdk'
const props = defineProps<{
// As we need to focus search box when the parent is opened
@ -13,21 +13,14 @@ const props = defineProps<{
const emits = defineEmits<{ selected: [ColumnType] }>()
const {
isParentOpen,
toolbarMenu,
searchInputPlaceholder,
selectedOptionId,
options: _options,
showSelectedOption,
} = toRefs(props)
const { isParentOpen, toolbarMenu, searchInputPlaceholder, selectedOptionId, showSelectedOption } = toRefs(props)
const { fieldsMap } = useViewColumnsOrThrow()
const searchQuery = ref('')
const options = computed(() =>
(_options.value || [])
(props.options || [])
.map((c) => c)
.sort((field1, field2) => {
// sort by view column order and keep system columns at the end

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

@ -476,7 +476,7 @@ useEventListener(tableWrapper, 'scroll', () => {
</div>
</div>
</template>
<div v-if="selectedAudit" class="flex flex-col gap-4">
<div v-if="selectedAudit" class="nc-expanded-audit flex flex-col gap-4">
<div class="bg-gray-50 rounded-lg border-1 border-gray-200">
<div class="flex">
<div class="w-1/2 border-r border-gray-200 flex flex-col gap-2 px-4 py-3">
@ -548,7 +548,9 @@ useEventListener(tableWrapper, 'scroll', () => {
</div>
<div class="flex flex-col gap-2">
<div class="cell-header">{{ $t('labels.description') }}</div>
<div class="text-small leading-[18px] text-gray-600">{{ selectedAudit?.description }}</div>
<div>
<pre class="!text-small !leading-[18px] !text-gray-600 mb-0">{{ selectedAudit?.description }}</pre>
</div>
</div>
</div>
</NcModal>
@ -557,13 +559,9 @@ useEventListener(tableWrapper, 'scroll', () => {
</template>
<style lang="scss" scoped>
.nc-audit-table pre {
display: table;
table-layout: fixed;
width: 100%;
white-space: break-spaces;
font-size: unset;
font-family: unset;
.nc-expanded-audit pre {
font-family: Manrope, 'Inter', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
sans-serif;
}
:deep(.nc-menu-item-inner) {

6
packages/nc-gui/composables/useExpandedFormStore.ts

@ -173,7 +173,7 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
}
}
const loadAudits = async (_rowId?: string) => {
const loadAudits = async (_rowId?: string, showLoading: boolean = true) => {
if (!isUIAllowed('auditListRow') || isEeUI || (!row.value && !_rowId)) return
const rowId = _rowId ?? extractPkFromRow(row.value.row, meta.value.columns as ColumnType[])
@ -181,7 +181,9 @@ const [useProvideExpandedFormStore, useExpandedFormStore] = useInjectionState((m
if (!rowId) return
try {
isAuditLoading.value = true
if (showLoading) {
isAuditLoading.value = true
}
const res =
(
await $api.utils.auditList({

2
packages/nc-gui/composables/useMultiSelect/index.ts

@ -1172,7 +1172,7 @@ export function useMultiSelect(
for (const col of cols) {
if (!col.title || !isPasteable(row, col)) {
if ((isBt(col) || isOo(pasteCol) || isMm(col)) && !isInfoShown) {
if ((isBt(col) || isOo(col) || isMm(col)) && !isInfoShown) {
message.info(t('msg.info.groupPasteIsNotSupportedOnLinksColumn'))
isInfoShown = true
}

921
packages/nocodb/src/db/BaseModelSqlv2.ts

File diff suppressed because it is too large Load Diff

2
packages/nocodb/src/strategies/authtoken.strategy/authtoken.strategy.ts

@ -44,6 +44,8 @@ export class AuthTokenStrategy extends PassportStrategy(Strategy, 'authtoken') {
Object.assign(user, {
id: dbUser.id,
email: dbUser.email,
display_name: dbUser.display_name,
roles: extractRolesObj(dbUser.roles),
base_roles: extractRolesObj(dbUser.base_roles),
...(dbUser.workspace_roles

2
packages/nocodb/src/strategies/jwt.strategy.ts

@ -14,7 +14,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
}
async validate(req, jwtPayload) {
if (!jwtPayload?.email) {
if (!jwtPayload?.email || jwtPayload?.is_api_token) {
return jwtPayload;
}

Loading…
Cancel
Save