From 5abc755ac9aa06675f55305fcb3b7a9c1dc91963 Mon Sep 17 00:00:00 2001 From: WK Wong Date: Mon, 7 Oct 2024 23:46:27 +0800 Subject: [PATCH 01/13] fix(docs): broken fenced code blocks and indentation --- packages/nocodb/README.md | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/nocodb/README.md b/packages/nocodb/README.md index e10ecc0d13..4bea8edb47 100644 --- a/packages/nocodb/README.md +++ b/packages/nocodb/README.md @@ -63,7 +63,6 @@ NocoDB is the fastest and easiest way to build databases online. # Quick try - ## Docker ```bash @@ -81,7 +80,7 @@ docker run -d --name nocodb-postgres \ -e NC_DB="pg://host.docker.internal:5432?u=root&p=password&d=d1" \ -e NC_AUTH_JWT_SECRET="569a1821-0a93-45e8-87ab-eb857f20a010" \ nocodb/nocodb:latest - +``` > To persist data in docker you can mount volume at `/usr/app/data/` since 0.10.6. Otherwise your data will be lost after recreating the container. @@ -164,22 +163,22 @@ Access Dashboard using: [http://localhost:8080/dashboard](http://localhost:8080/ # Table of Contents - [Quick try](#quick-try) - - [NPX](#npx) - - [Node Application](#node-application) - - [Docker](#docker) - - [Docker Compose](#docker-compose) + - [NPX](#npx) + - [Node Application](#node-application) + - [Docker](#docker) + - [Docker Compose](#docker-compose) - [GUI](#gui) - [Join Our Community](#join-our-community) - [Screenshots](#screenshots) - [Table of Contents](#table-of-contents) - [Features](#features) - - [Rich Spreadsheet Interface](#rich-spreadsheet-interface) - - [App Store for Workflow Automations](#app-store-for-workflow-automations) - - [Programmatic Access](#programmatic-access) - - [Sync Schema](#sync-schema) - - [Audit](#audit) + - [Rich Spreadsheet Interface](#rich-spreadsheet-interface) + - [App Store for Workflow Automations](#app-store-for-workflow-automations) + - [Programmatic Access](#programmatic-access) + - [Sync Schema](#sync-schema) + - [Audit](#audit) - [Production Setup](#production-setup) - - [Environment variables](#environment-variables) + - [Environment variables](#environment-variables) - [Development Setup](#development-setup) - [Contributing](#contributing) - [Why are we building this?](#why-are-we-building-this) From 288cfa8b75ec3856fbf5cb5ac779d61ca831c014 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Tue, 8 Oct 2024 11:06:55 +0530 Subject: [PATCH 02/13] fix(nc-gui): Prevent keyboard shortcuts if user is in cell edit mode or any other active input element (#9600) * fix(nc-gui): stop event propogation is active element is input * fix(nc-gui): disable expanded form keyboard shortcuts navigation if it is first row or last row * fix(nc-gui): oss test fail issue --- packages/nc-gui/components/cell/Currency.vue | 1 + packages/nc-gui/components/cell/Decimal.vue | 1 + packages/nc-gui/components/cell/Duration.vue | 1 + packages/nc-gui/components/cell/Email.vue | 1 + packages/nc-gui/components/cell/Float.vue | 1 + packages/nc-gui/components/cell/Integer.vue | 1 + packages/nc-gui/components/cell/Json.vue | 1 + packages/nc-gui/components/cell/Percent.vue | 1 + packages/nc-gui/components/cell/PhoneNumber.vue | 1 + packages/nc-gui/components/cell/RichText.vue | 1 + packages/nc-gui/components/cell/Text.vue | 1 + packages/nc-gui/components/cell/TextArea.vue | 2 ++ packages/nc-gui/components/cell/Url.vue | 1 + .../nc-gui/components/dashboard/TreeView/index.vue | 5 +++++ packages/nc-gui/components/general/FullScreen.vue | 2 +- .../components/smartsheet/details/Fields.vue | 14 ++------------ .../components/smartsheet/expanded-form/index.vue | 4 ++++ packages/nc-gui/store/projectsShortcuts.ts | 4 ++-- packages/nc-gui/utils/browserUtils.ts | 9 ++++++++- 19 files changed, 36 insertions(+), 16 deletions(-) diff --git a/packages/nc-gui/components/cell/Currency.vue b/packages/nc-gui/components/cell/Currency.vue index cfd2f0bbea..615e8e9ffb 100644 --- a/packages/nc-gui/components/cell/Currency.vue +++ b/packages/nc-gui/components/cell/Currency.vue @@ -117,6 +117,7 @@ onMounted(() => { @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop @contextmenu.stop diff --git a/packages/nc-gui/components/cell/Decimal.vue b/packages/nc-gui/components/cell/Decimal.vue index 3dd6cd6e72..3ad720541d 100644 --- a/packages/nc-gui/components/cell/Decimal.vue +++ b/packages/nc-gui/components/cell/Decimal.vue @@ -113,6 +113,7 @@ watch(isExpandedFormOpen, () => { @keydown.right.stop @keydown.up.stop="onKeyDown" @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Duration.vue b/packages/nc-gui/components/cell/Duration.vue index 3439a6b414..c4875a39aa 100644 --- a/packages/nc-gui/components/cell/Duration.vue +++ b/packages/nc-gui/components/cell/Duration.vue @@ -90,6 +90,7 @@ const focus: VNodeRef = (el) => @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Email.vue b/packages/nc-gui/components/cell/Email.vue index 6af36304fa..b859699fb8 100644 --- a/packages/nc-gui/components/cell/Email.vue +++ b/packages/nc-gui/components/cell/Email.vue @@ -87,6 +87,7 @@ watch( @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop @paste.prevent="onPaste" diff --git a/packages/nc-gui/components/cell/Float.vue b/packages/nc-gui/components/cell/Float.vue index f8008eebf3..d8507f05f7 100644 --- a/packages/nc-gui/components/cell/Float.vue +++ b/packages/nc-gui/components/cell/Float.vue @@ -59,6 +59,7 @@ const focus: VNodeRef = (el) => @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Integer.vue b/packages/nc-gui/components/cell/Integer.vue index 5f84ab02b3..a4232fa128 100644 --- a/packages/nc-gui/components/cell/Integer.vue +++ b/packages/nc-gui/components/cell/Integer.vue @@ -107,6 +107,7 @@ function onKeyDown(e: any) { @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/Json.vue b/packages/nc-gui/components/cell/Json.vue index b828243543..277d656e4b 100644 --- a/packages/nc-gui/components/cell/Json.vue +++ b/packages/nc-gui/components/cell/Json.vue @@ -214,6 +214,7 @@ watch(inputWrapperRef, () => { :auto-focus="!isForm && !isEditColumn" @update:model-value="localValue = $event" @keydown.enter.stop + @keydown.alt.stop /> diff --git a/packages/nc-gui/components/cell/Percent.vue b/packages/nc-gui/components/cell/Percent.vue index 76dabe449f..797211a09e 100644 --- a/packages/nc-gui/components/cell/Percent.vue +++ b/packages/nc-gui/components/cell/Percent.vue @@ -154,6 +154,7 @@ const onTabPress = (e: KeyboardEvent) => { @keydown.up.stop @keydown.delete.stop @keydown.tab="onTabPress" + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/PhoneNumber.vue b/packages/nc-gui/components/cell/PhoneNumber.vue index b249487190..83c2c7a5ca 100644 --- a/packages/nc-gui/components/cell/PhoneNumber.vue +++ b/packages/nc-gui/components/cell/PhoneNumber.vue @@ -71,6 +71,7 @@ watch( @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/RichText.vue b/packages/nc-gui/components/cell/RichText.vue index 27ec64ad08..de50543f0d 100644 --- a/packages/nc-gui/components/cell/RichText.vue +++ b/packages/nc-gui/components/cell/RichText.vue @@ -335,6 +335,7 @@ onClickOutside(editorDom, (e) => { [`!overflow-hidden nc-truncate nc-line-clamp-${rowHeightTruncateLines(localRowHeight)}`]: !fullMode && readOnly && localRowHeight && !isExpandedFormOpen && !isForm, }" + @keydown.alt.stop @keydown.alt.enter.stop @keydown.shift.enter.stop /> diff --git a/packages/nc-gui/components/cell/Text.vue b/packages/nc-gui/components/cell/Text.vue index 235b25689a..3d8bfbf5c1 100644 --- a/packages/nc-gui/components/cell/Text.vue +++ b/packages/nc-gui/components/cell/Text.vue @@ -41,6 +41,7 @@ const focus: VNodeRef = (el) => @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/cell/TextArea.vue b/packages/nc-gui/components/cell/TextArea.vue index ed45452691..a856b3aaa9 100644 --- a/packages/nc-gui/components/cell/TextArea.vue +++ b/packages/nc-gui/components/cell/TextArea.vue @@ -259,6 +259,7 @@ watch(inputWrapperRef, () => { }" :disabled="readOnly" @blur="editEnabled = false" + @keydown.alt.stop @keydown.alt.enter.stop @keydown.shift.enter.stop @keydown.down.stop @@ -359,6 +360,7 @@ watch(inputWrapperRef, () => { :style="{ resize: 'both' }" :disabled="readOnly" @keydown.escape="isVisible = false" + @keydown.alt.stop /> diff --git a/packages/nc-gui/components/cell/Url.vue b/packages/nc-gui/components/cell/Url.vue index 11a31d96cd..e860ed5a3d 100644 --- a/packages/nc-gui/components/cell/Url.vue +++ b/packages/nc-gui/components/cell/Url.vue @@ -92,6 +92,7 @@ watch( @keydown.right.stop @keydown.up.stop @keydown.delete.stop + @keydown.alt.stop @selectstart.capture.stop @mousedown.stop /> diff --git a/packages/nc-gui/components/dashboard/TreeView/index.vue b/packages/nc-gui/components/dashboard/TreeView/index.vue index fc22eeb885..75c16ef46b 100644 --- a/packages/nc-gui/components/dashboard/TreeView/index.vue +++ b/packages/nc-gui/components/dashboard/TreeView/index.vue @@ -151,6 +151,11 @@ const isCreateTableAllowed = computed( useEventListener(document, 'keydown', async (e: KeyboardEvent) => { const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey + + if (isActiveInputElementExist()) { + return + } + if (e.altKey && !e.shiftKey && !cmdOrCtrl) { switch (e.keyCode) { case 84: { diff --git a/packages/nc-gui/components/general/FullScreen.vue b/packages/nc-gui/components/general/FullScreen.vue index e0d550763f..8c10b968a7 100644 --- a/packages/nc-gui/components/general/FullScreen.vue +++ b/packages/nc-gui/components/general/FullScreen.vue @@ -19,7 +19,7 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => { switch (e.keyCode) { case 70: { // ALT + F - if (!isDrawerOrModalExist()) { + if (!isDrawerOrModalExist() && !isActiveInputElementExist()) { $e('c:shortcut', { key: 'ALT + F' }) isSidebarsOpen.value = !isSidebarsOpen.value } diff --git a/packages/nc-gui/components/smartsheet/details/Fields.vue b/packages/nc-gui/components/smartsheet/details/Fields.vue index 9ed51b01c8..46e5938793 100644 --- a/packages/nc-gui/components/smartsheet/details/Fields.vue +++ b/packages/nc-gui/components/smartsheet/details/Fields.vue @@ -895,12 +895,7 @@ onKeyDown('ArrowUp', () => { onKeyDown('Delete', () => { if (isLocked.value) return - if ( - document.activeElement?.tagName === 'INPUT' || - document.activeElement?.tagName === 'TEXTAREA' || - // A rich text editor is a div with the contenteditable attribute set to true. - document.activeElement?.getAttribute('contenteditable') - ) { + if (isActiveInputElementExist()) { return } @@ -913,12 +908,7 @@ onKeyDown('Delete', () => { onKeyDown('Backspace', () => { if (isLocked.value) return - if ( - document.activeElement?.tagName === 'INPUT' || - document.activeElement?.tagName === 'TEXTAREA' || - // A rich text editor is a div with the contenteditable attribute set to true. - document.activeElement?.getAttribute('contenteditable') - ) { + if (isActiveInputElementExist()) { return } diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index 5c474f2d48..06076a01ba 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -404,9 +404,13 @@ useActiveKeyupListener( if (!e.altKey) return if (e.key === 'ArrowLeft') { e.stopPropagation() + if (isFirstRow.value) return + loadingEmit('prev') } else if (e.key === 'ArrowRight') { e.stopPropagation() + if (islastRow.value) return + onNext() } // on alt + s save record diff --git a/packages/nc-gui/store/projectsShortcuts.ts b/packages/nc-gui/store/projectsShortcuts.ts index 14035f4faa..1acda2bfd6 100644 --- a/packages/nc-gui/store/projectsShortcuts.ts +++ b/packages/nc-gui/store/projectsShortcuts.ts @@ -24,7 +24,7 @@ export const useProjectsShortcuts = defineStore('projectsShortcutsStore', () => switch (e.keyCode) { case 70: { // ALT + F - if (!isDrawerOrModalExist()) { + if (!isDrawerOrModalExist() && !isActiveInputElementExist()) { $e('c:shortcut', { key: 'ALT + F' }) const sidebarStore = useSidebarStore() @@ -37,7 +37,7 @@ export const useProjectsShortcuts = defineStore('projectsShortcutsStore', () => } // 'ALT + ,' case 188: { - if (isUIAllowed('settingsPage') && !isDrawerOrModalExist()) { + if (isUIAllowed('settingsPage') && !isDrawerOrModalExist() && !isActiveInputElementExist()) { $e('c:shortcut', { key: 'ALT + ,' }) const basesStore = useBases() diff --git a/packages/nc-gui/utils/browserUtils.ts b/packages/nc-gui/utils/browserUtils.ts index 750a8ca830..718d35aa09 100644 --- a/packages/nc-gui/utils/browserUtils.ts +++ b/packages/nc-gui/utils/browserUtils.ts @@ -5,7 +5,14 @@ export const isDrawerOrModalExist = () => document.querySelector('.ant-modal.act export const isExpandedFormOpenExist = () => document.querySelector('.nc-drawer-expanded-form.active') export const isExpandedCellInputExist = () => document.querySelector('.expanded-cell-input') export const cmdKActive = () => document.querySelector('.cmdk-modal-active') - +export const isActiveInputElementExist = () => { + return ( + document.activeElement?.tagName === 'INPUT' || + document.activeElement?.tagName === 'TEXTAREA' || + // A rich text editor is a div with the contenteditable attribute set to true. + !!document.activeElement?.getAttribute('contenteditable') + ) +} export const getScrollbarWidth = () => { const outer = document.createElement('div') outer.style.visibility = 'hidden' From 21e1f2a9fadd12d5b6c34ba8aec92be6d0d1e9d3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 8 Oct 2024 11:49:53 +0530 Subject: [PATCH 03/13] refactor: GUI error handling (#9528) * refactor: error reporting Signed-off-by: Pranav C * refactor: handle ee part Signed-off-by: Pranav C * refactor: coderabbit review comments Signed-off-by: Pranav C * refactor: linting Signed-off-by: Pranav C * refactor: remove duplicate error log Signed-off-by: Pranav C * refactor: request type correction Signed-off-by: Pranav C --------- Signed-off-by: Pranav C --- .../nc-gui/components/nc/ErrorBoundary.vue | 3 +- .../nc-gui/composables/useGlobal/types.ts | 1 + packages/nc-gui/nuxt-shim.d.ts | 2 + packages/nc-gui/plugins/error-reporting.ts | 92 +++++++++++++++++++ packages/nc-gui/plugins/sentry.ts | 15 +-- packages/nocodb-sdk/src/lib/Api.ts | 25 +++++ .../src/controllers/utils.controller.ts | 20 +++- packages/nocodb/src/schema/swagger.json | 42 +++++++++ packages/nocodb/src/services/utils.service.ts | 20 +++- 9 files changed, 210 insertions(+), 10 deletions(-) create mode 100644 packages/nc-gui/plugins/error-reporting.ts diff --git a/packages/nc-gui/components/nc/ErrorBoundary.vue b/packages/nc-gui/components/nc/ErrorBoundary.vue index a80aec396c..c36321dc64 100644 --- a/packages/nc-gui/components/nc/ErrorBoundary.vue +++ b/packages/nc-gui/components/nc/ErrorBoundary.vue @@ -1,7 +1,6 @@ - + diff --git a/packages/nc-gui/components/smartsheet/form/field-settings/visibility.vue b/packages/nc-gui/components/smartsheet/form/field-settings/visibility.vue index 41d0bd451a..c162f83e93 100644 --- a/packages/nc-gui/components/smartsheet/form/field-settings/visibility.vue +++ b/packages/nc-gui/components/smartsheet/form/field-settings/visibility.vue @@ -1,7 +1,46 @@