From 88e648c5a97213b9ef08e6f4fbb8ac1f36126598 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 16 Jan 2023 15:14:41 +0530 Subject: [PATCH 01/18] fix(gui): avoid opening expanded form in shared view re #4580 Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 304daa4b8e..1d93d9eeca 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -201,7 +201,7 @@ const { isCellSelected, activeCell, handleMouseDown, handleMouseOver, handleCell const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey const altOrOptionKey = e.altKey if (e.key === ' ') { - if (activeCell.row != null && !editEnabled) { + if (activeCell.row != null && !editEnabled && hasEditPermission?.value) { e.preventDefault() clearSelectedRange() const row = data.value[activeCell.row] From 96040220a3b07e40f44ed3005bc88656af3c2f77 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Mon, 16 Jan 2023 15:56:48 +0530 Subject: [PATCH 02/18] fix(gui): make add icon visible in dark mode and show it all the time in shared form view Signed-off-by: Pranav C --- .../pages/[projectType]/form/[viewId]/index/index.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue b/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue index 3902c279a5..9cfca9bab8 100644 --- a/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue +++ b/packages/nc-gui/pages/[projectType]/form/[viewId]/index/index.vue @@ -85,7 +85,7 @@ function isRequired(_columnObj: Record, required = false) { , required = false) { + + From ee8621b82cc85bf3e84312ce913a1a3014276e65 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 17 Jan 2023 11:08:39 +0530 Subject: [PATCH 03/18] fix(gui): update refresh-token api url Signed-off-by: Pranav C --- packages/nc-gui/composables/useApi/interceptors.ts | 4 ++-- packages/nc-gui/composables/useGlobal/actions.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/composables/useApi/interceptors.ts b/packages/nc-gui/composables/useApi/interceptors.ts index e65cb25edb..22e2c139ff 100644 --- a/packages/nc-gui/composables/useApi/interceptors.ts +++ b/packages/nc-gui/composables/useApi/interceptors.ts @@ -38,7 +38,7 @@ export function addAxiosInterceptors(api: Api) { } // Logout user if token refresh didn't work or user is disabled - if (error.config.url === '/auth/refresh-token') { + if (error.config.url === '/auth/token/refresh') { state.signOut() return Promise.reject(error) @@ -46,7 +46,7 @@ export function addAxiosInterceptors(api: Api) { // Try request again with new token return api.instance - .post('/auth/refresh-token', null, { + .post('/auth/token/refresh', null, { withCredentials: true, }) .then((token) => { diff --git a/packages/nc-gui/composables/useGlobal/actions.ts b/packages/nc-gui/composables/useGlobal/actions.ts index 0e1e265de2..09a1803f68 100644 --- a/packages/nc-gui/composables/useGlobal/actions.ts +++ b/packages/nc-gui/composables/useGlobal/actions.ts @@ -29,7 +29,7 @@ export function useGlobalActions(state: State): Actions { const t = nuxtApp.vueApp.i18n.global.t nuxtApp.$api.instance - .post('/auth/refresh-token', null, { + .post('/auth/token/refresh', null, { withCredentials: true, }) .then((response) => { From ab1e60a97c6d5c688dacbd23bca40cb8f20c4ac3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 17 Jan 2023 14:50:24 +0530 Subject: [PATCH 04/18] fix(gui): skip if related view/hook/column of a filter is not found Signed-off-by: Pranav C --- .../nocodb/src/lib/version-upgrader/ncFilterUpgrader.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader.ts b/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader.ts index 1515f88b8b..6c250bd04c 100644 --- a/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader.ts +++ b/packages/nocodb/src/lib/version-upgrader/ncFilterUpgrader.ts @@ -21,7 +21,13 @@ export default async function ({ ncMeta }: NcUpgraderCtx) { } else { continue; } - if (filter.project_id != model.project_id) { + + // skip if related model is not found + if (!model) { + continue; + } + + if (filter.project_id !== model.project_id) { await ncMeta.metaUpdate( null, null, From cc95ca634f3ddfd5ce45beb51f077c429fb86f04 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 17 Jan 2023 14:51:33 +0530 Subject: [PATCH 05/18] fix(gui): typo correction Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 1d93d9eeca..92b0092225 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -201,7 +201,7 @@ const { isCellSelected, activeCell, handleMouseDown, handleMouseOver, handleCell const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey const altOrOptionKey = e.altKey if (e.key === ' ') { - if (activeCell.row != null && !editEnabled && hasEditPermission?.value) { + if (activeCell.row != null && !editEnabled && hasEditPermission) { e.preventDefault() clearSelectedRange() const row = data.value[activeCell.row] From c2c6bf5c1cce3e3e01898ee410b1056bbeaee20a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 17 Jan 2023 15:17:09 +0530 Subject: [PATCH 06/18] refactor(gui): hide appstore from project settings modal re #4852 Signed-off-by: Pranav C --- .../components/dashboard/settings/Modal.vue | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/packages/nc-gui/components/dashboard/settings/Modal.vue b/packages/nc-gui/components/dashboard/settings/Modal.vue index 5f563dc0b9..a67233cabd 100644 --- a/packages/nc-gui/components/dashboard/settings/Modal.vue +++ b/packages/nc-gui/components/dashboard/settings/Modal.vue @@ -1,10 +1,8 @@ - - diff --git a/packages/nc-gui/components/smartsheet/expanded-form/index.vue b/packages/nc-gui/components/smartsheet/expanded-form/index.vue index 2f1b27ac46..266cc0e183 100644 --- a/packages/nc-gui/components/smartsheet/expanded-form/index.vue +++ b/packages/nc-gui/components/smartsheet/expanded-form/index.vue @@ -149,7 +149,10 @@ export default { > -
+
+ + +
@@ -216,4 +219,15 @@ export default { max-height: max(calc(100vh - 65px), 600px); height: max-content !important; } + +.nc-prev-arrow, +.nc-next-arrow { + @apply absolute opacity-70 rounded-full transition-transform transition-background transition-opacity transform bg-white hover:(bg-gray-200) active:(scale-125 opacity-100) text-xl; +} +.nc-prev-arrow { + @apply left-4 top-4; +} +.nc-next-arrow { + @apply right-4 top-4; +} From 928346e619bd155e09b3a77c04f9ab07b7f3feca Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 18 Jan 2023 20:09:10 +0530 Subject: [PATCH 13/18] fix(api): include null values in `neq` filter Signed-off-by: Pranav C --- .../src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts index 8c44151310..2d53cbc80d 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts @@ -277,7 +277,11 @@ const parseConditionV2 = async ( break; case 'neq': case 'not': - qb = qb.whereNot(field, val); + qb = qb.where((nestedQb) => { + nestedQb + .whereNot(field, val) + .orWhereNotNull(customWhereClause ? _val : _field); + }); break; case 'like': if (column.uidt === UITypes.Formula) { From 90bfa2dec2223e6c2a8dad7b38b7ca8c17bc282f Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 19 Jan 2023 11:44:18 +0530 Subject: [PATCH 14/18] feat(gui): improve row navigation option in expanded form - Add tooltip - Show warning if out of bound - Hide option from nested - Implement it in Gallery view Signed-off-by: Pranav C --- .../nc-gui/components/smartsheet/Gallery.vue | 5 ++ .../nc-gui/components/smartsheet/Grid.vue | 51 ++---------------- .../smartsheet/expanded-form/index.vue | 19 +++++-- packages/nc-gui/composables/useSharedView.ts | 12 +---- packages/nc-gui/composables/useViewData.ts | 52 +++++++++++++++++++ packages/nc-gui/lang/en.json | 7 ++- packages/nc-gui/lib/enums.ts | 5 ++ 7 files changed, 89 insertions(+), 62 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue index cc00c0b43c..dfa2899f6b 100644 --- a/packages/nc-gui/components/smartsheet/Gallery.vue +++ b/packages/nc-gui/components/smartsheet/Gallery.vue @@ -13,6 +13,7 @@ import { ReloadRowDataHookInj, ReloadViewDataHookInj, ReloadViewMetaHookInj, + RowNavDir, computed, createEventHook, extractPkFromRow, @@ -48,6 +49,7 @@ const { galleryData, changePage, addEmptyRow, + navigateToSiblingRow, } = useViewData(meta, view) provide(IsFormInj, ref(false)) @@ -270,6 +272,9 @@ watch(view, async (nextView) => { :meta="meta" :row-id="route.query.rowId" :view="view" + show-next-prev-icons + @next="navigateToSiblingRow(RowNavDir.NEXT)" + @prev="navigateToSiblingRow(RowNavDir.PREV)" />
diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 45bd864ecd..66b33fd6d1 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -17,6 +17,7 @@ import { ReadonlyInj, ReloadRowDataHookInj, ReloadViewDataHookInj, + RowNavDir, SmartsheetStoreEvents, computed, createEventHook, @@ -117,6 +118,7 @@ const { deleteSelectedRows, selectedAllRecords, removeRowIfNew, + navigateToSiblingRow, } = useViewData(meta, view, xWhere) const { getMeta } = useMetas() @@ -638,50 +640,6 @@ const closeAddColumnDropdown = () => { columnOrder.value = null addColumnDropdown.value = false } - -enum NavDir { - NEXT, - PREV, -} - -const navigateToSiblingRow = async (dir: NavDir) => { - // get current expanded row index - const expandedRowIndex = data.value.findIndex( - (row) => routeQuery.rowId === extractPkFromRow(row.row, meta.value?.columns as ColumnType[]), - ) - - // calculate next row index based on direction - let siblingRowIndex = expandedRowIndex + (dir === NavDir.NEXT ? 1 : -1) - - const currentPage = paginationData?.value?.page || 1 - - // if next row index is less than 0, go to previous page and point to last element - if (siblingRowIndex < 0) { - // if first page, do nothing - if (currentPage === 1) return - - await changePage(currentPage - 1) - siblingRowIndex = data.value.length - 1 - - // if next row index is greater than total rows in current view - // then load next page of data and set next row index to 0 - } else if (siblingRowIndex >= data.value.length) { - siblingRowIndex = 0 - await changePage(currentPage + 1) - } - - // extract the row id of the sibling row - const rowId = extractPkFromRow(data.value[siblingRowIndex].row, meta.value?.columns as ColumnType[]) - - if (rowId) { - router.push({ - query: { - ...routeQuery, - rowId, - }, - }) - } -}