From 5393a94e5c438b80b50fc7c8a70f1bad033119cd Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Thu, 21 Sep 2023 20:03:09 +0530 Subject: [PATCH 01/11] fix: fields menu --- .../nc-gui/ee/assets/img/fieldPlaceholder.svg | 196 ++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 packages/nc-gui/ee/assets/img/fieldPlaceholder.svg diff --git a/packages/nc-gui/ee/assets/img/fieldPlaceholder.svg b/packages/nc-gui/ee/assets/img/fieldPlaceholder.svg new file mode 100644 index 0000000000..7fc8286651 --- /dev/null +++ b/packages/nc-gui/ee/assets/img/fieldPlaceholder.svg @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5f7bdb101c5f994d8e2b8c518087a5b2e5248b70 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 22 Sep 2023 13:41:33 +0530 Subject: [PATCH 02/11] fix: update fields tab --- .../smartsheet/column/EditOrAdd.vue | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue index 1b60419687..764793c103 100644 --- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue +++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue @@ -56,6 +56,8 @@ const { appInfo } = useGlobal() const { betaFeatureToggleState } = useBetaFeatureToggle() +const { openedViewsTab } = storeToRefs(useViewsStore()) + const { loadMagic, predictColumnType: _predictColumnType } = useNocoEe() const meta = inject(MetaInj, ref()) @@ -194,6 +196,10 @@ const handleEscape = (event: KeyboardEvent): void => { if (event.key === 'Escape') emit('cancel') } +const isFieldsTab = computed(() => { + return openedViewsTab.value === 'field' +}) + if (props.fromTableExplorer) { watch( formState, @@ -220,8 +226,21 @@ if (props.fromTableExplorer) { >
+ +
+ +
+
Date: Fri, 22 Sep 2023 16:11:25 +0530 Subject: [PATCH 03/11] feat: support view column reorder --- packages/nocodb/src/models/Column.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/models/Column.ts b/packages/nocodb/src/models/Column.ts index 0d57fe554a..528f8e3927 100644 --- a/packages/nocodb/src/models/Column.ts +++ b/packages/nocodb/src/models/Column.ts @@ -925,7 +925,7 @@ export default class Column implements ColumnType { static async update( colId: string, - column: Partial, + column: Partial & Partial>, ncMeta = Noco.ncMeta, ) { const oldCol = await Column.get({ colId }, ncMeta); @@ -1079,6 +1079,19 @@ export default class Column implements ColumnType { await Column.delete(barcodeCol.fk_column_id, ncMeta); } } + if (column.column_order.order && column.column_order.view_id) { + const viewColumn = ( + await View.getColumns(column.column_order.view_id) + ).find((col) => col.fk_column_id === column.id); + const res = await View.updateColumn( + column.column_order.view_id, + viewColumn.id, + { + order: column.column_order.order, + }, + ); + console.log(res); + } // get existing cache const key = `${CacheScope.COLUMN}:${colId}`; From 12ccd7d1dbc66fb4f31568395a3fd552ecd10ec3 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Fri, 22 Sep 2023 19:07:24 +0530 Subject: [PATCH 04/11] fix: fields reorder --- packages/nocodb/src/models/Column.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/nocodb/src/models/Column.ts b/packages/nocodb/src/models/Column.ts index 528f8e3927..12acbaf2d5 100644 --- a/packages/nocodb/src/models/Column.ts +++ b/packages/nocodb/src/models/Column.ts @@ -1083,14 +1083,9 @@ export default class Column implements ColumnType { const viewColumn = ( await View.getColumns(column.column_order.view_id) ).find((col) => col.fk_column_id === column.id); - const res = await View.updateColumn( - column.column_order.view_id, - viewColumn.id, - { - order: column.column_order.order, - }, - ); - console.log(res); + await View.updateColumn(column.column_order.view_id, viewColumn.id, { + order: column.column_order.order, + }); } // get existing cache From 45b78c64ee71d005f17ed4db5a61c31cf4b080fa Mon Sep 17 00:00:00 2001 From: mertmit Date: Sat, 23 Sep 2023 01:46:22 +0300 Subject: [PATCH 05/11] fix: update column issue Signed-off-by: mertmit --- packages/nocodb/src/models/Column.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/models/Column.ts b/packages/nocodb/src/models/Column.ts index 12acbaf2d5..ef0265bf22 100644 --- a/packages/nocodb/src/models/Column.ts +++ b/packages/nocodb/src/models/Column.ts @@ -1079,7 +1079,11 @@ export default class Column implements ColumnType { await Column.delete(barcodeCol.fk_column_id, ncMeta); } } - if (column.column_order.order && column.column_order.view_id) { + if ( + column.column_order && + column.column_order.order && + column.column_order.view_id + ) { const viewColumn = ( await View.getColumns(column.column_order.view_id) ).find((col) => col.fk_column_id === column.id); From fcf2082a10e4968b3f1ca24b9511ca530e445334 Mon Sep 17 00:00:00 2001 From: mertmit Date: Sat, 23 Sep 2023 01:47:02 +0300 Subject: [PATCH 06/11] fix: SQLite hacky solution for alter table issue Signed-off-by: mertmit --- .../src/db/sql-client/lib/sqlite/SqliteClient.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/sql-client/lib/sqlite/SqliteClient.ts b/packages/nocodb/src/db/sql-client/lib/sqlite/SqliteClient.ts index 3286d79ec6..2ce53a0c44 100644 --- a/packages/nocodb/src/db/sql-client/lib/sqlite/SqliteClient.ts +++ b/packages/nocodb/src/db/sql-client/lib/sqlite/SqliteClient.ts @@ -1619,6 +1619,15 @@ class SqliteClient extends KnexClient { await this.sqlClient.raw('PRAGMA legacy_alter_table = ON;'); + /* + This is a hack to avoid the following error: + - SQLITE_ERROR: duplicate column name: column_name + + Somehow this error is thrown when we drop a column and add a new column with the same name right after it. + TODO - Find a better solution for this. + */ + await this.sqlClient.raw('SELECT * FROM ?? LIMIT 1', [args.table]); + const trx = await this.sqlClient.transaction(); try { @@ -1650,7 +1659,7 @@ class SqliteClient extends KnexClient { await trx.commit(); } catch (e) { await trx.rollback(); - log.ppe(e, _func); + // log.ppe(e, _func); throw e; } finally { if (fkCheckEnabled) From c3b28e72454b38127c0e793968b0f56baa0081a7 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Sat, 23 Sep 2023 12:50:29 +0530 Subject: [PATCH 07/11] fix: center fields tab --- .../nc-gui/components/smartsheet/Details.vue | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Details.vue b/packages/nc-gui/components/smartsheet/Details.vue index ef0ef3d337..d7716f4995 100644 --- a/packages/nc-gui/components/smartsheet/Details.vue +++ b/packages/nc-gui/components/smartsheet/Details.vue @@ -28,7 +28,16 @@ watch(