From 06b609e5cb9463014dfcb0081d1bae06b7a1076e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 18:12:39 +0800 Subject: [PATCH 01/42] feat(gui-v2): add isMssql --- packages/nc-gui-v2/composables/useProject.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/composables/useProject.ts b/packages/nc-gui-v2/composables/useProject.ts index 7d4fc760db..91b4434893 100644 --- a/packages/nc-gui-v2/composables/useProject.ts +++ b/packages/nc-gui-v2/composables/useProject.ts @@ -44,10 +44,11 @@ export function useProject(projectId?: MaybeRef) { const projectBaseType = $computed(() => project.value?.bases?.[0]?.type || '') const isMysql = computed(() => ['mysql', 'mysql2'].includes(projectBaseType)) + const isMssql = computed(() => projectBaseType === 'mssql') const isPg = computed(() => projectBaseType === 'pg') const sqlUi = computed( () => SqlUiFactory.create({ client: projectBaseType }) as Exclude, typeof OracleUi>, ) - return { project, tables, loadProjectRoles, loadProject, loadTables, isMysql, isPg, sqlUi } + return { project, tables, loadProjectRoles, loadProject, loadTables, isMysql, isMssql, isPg, sqlUi } } From db0385cb8aab2a34e233454607f59152ac62b3e2 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 18:13:55 +0800 Subject: [PATCH 02/42] feat(gui-v2): add table name length validator --- .../nc-gui-v2/components/dlg/TableRename.vue | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui-v2/components/dlg/TableRename.vue b/packages/nc-gui-v2/components/dlg/TableRename.vue index 3b58660782..2b89e802a4 100644 --- a/packages/nc-gui-v2/components/dlg/TableRename.vue +++ b/packages/nc-gui-v2/components/dlg/TableRename.vue @@ -24,8 +24,7 @@ const dialogShow = computed({ }) const { updateTab } = useTabs() -const { loadTables } = useProject() -const { tables } = useProject() +const { loadTables, tables, project, isMysql, isMssql, isPg } = useProject() const inputEl = $ref() let loading = $ref(false) @@ -37,6 +36,25 @@ const validators = computed(() => { return { title: [ validateTableName, + { + validator: (rule: any, value: any) => { + return new Promise((resolve, reject) => { + let tableNameLengthLimit = 255 + if (isMysql) { + tableNameLengthLimit = 64 + } else if (isPg) { + tableNameLengthLimit = 63 + } else if (isMssql) { + tableNameLengthLimit = 128 + } + const projectPrefix = project?.value?.prefix || '' + if ((projectPrefix + value).length > tableNameLengthLimit) { + return reject(new Error(`Table name exceeds ${tableNameLengthLimit} characters`)) + } + resolve() + }) + }, + }, { validator: (rule: any, value: any, callback: (errMsg?: string) => void) => { if (/^\s+|\s+$/.test(value)) { From ecd1d637711c65a2e70046043323cc83a13954ff Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 18:15:03 +0800 Subject: [PATCH 03/42] refactor(gui-v2): make table name validator promise based --- .../nc-gui-v2/components/dlg/TableRename.vue | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/nc-gui-v2/components/dlg/TableRename.vue b/packages/nc-gui-v2/components/dlg/TableRename.vue index 2b89e802a4..7bdcc2f25f 100644 --- a/packages/nc-gui-v2/components/dlg/TableRename.vue +++ b/packages/nc-gui-v2/components/dlg/TableRename.vue @@ -56,18 +56,20 @@ const validators = computed(() => { }, }, { - validator: (rule: any, value: any, callback: (errMsg?: string) => void) => { - if (/^\s+|\s+$/.test(value)) { - callback('Leading or trailing whitespace not allowed in table name') - } - if ( - !(tables?.value || []).every( - (t) => t.id === tableMeta.id || t.table_name.toLowerCase() !== (value || '').toLowerCase(), - ) - ) { - callback('Duplicate table alias') - } - callback() + validator: (rule: any, value: any) => { + return new Promise((resolve, reject) => { + if (/^\s+|\s+$/.test(value)) { + return reject(new Error('Leading or trailing whitespace not allowed in table name')) + } + if ( + !(tables?.value || []).every( + (t) => t.id === tableMeta.id || t.table_name.toLowerCase() !== (value || '').toLowerCase(), + ) + ) { + return reject(new Error('Duplicate table alias')) + } + resolve() + }) }, }, ], From 33c9f8e60f3b11be0b1823ef814fd7360645c255 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 18:34:31 +0800 Subject: [PATCH 04/42] fix(gui-v2): add a try-catch for api call --- packages/nc-gui-v2/composables/useTable.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/nc-gui-v2/composables/useTable.ts b/packages/nc-gui-v2/composables/useTable.ts index e0dc39c4aa..79dc527b4f 100644 --- a/packages/nc-gui-v2/composables/useTable.ts +++ b/packages/nc-gui-v2/composables/useTable.ts @@ -31,12 +31,16 @@ export function useTable(onTableCreate?: (tableMeta: TableType) => void) { return table.columns.includes(col.column_name) }) - const tableMeta = await $api.dbTable.create(project?.value?.id as string, { - ...table, - columns, - }) - - onTableCreate?.(tableMeta) + try { + const tableMeta = await $api.dbTable.create(project?.value?.id as string, { + ...table, + columns, + }) + onTableCreate?.(tableMeta) + } catch (e: any) { + message.error(await extractSdkResponseErrorMsg(e)) + return + } } watch( From df7d58c97746af9d107ec1eb52bde0e72949ba42 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 19:12:19 +0800 Subject: [PATCH 05/42] fix(gui-v2): add table name length validator for table create --- .../nc-gui-v2/components/dlg/TableCreate.vue | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui-v2/components/dlg/TableCreate.vue b/packages/nc-gui-v2/components/dlg/TableCreate.vue index 596eb44adc..91a6b8176d 100644 --- a/packages/nc-gui-v2/components/dlg/TableCreate.vue +++ b/packages/nc-gui-v2/components/dlg/TableCreate.vue @@ -18,7 +18,7 @@ const isAdvanceOptVisible = ref(false) const { addTab } = useTabs() -const { loadTables } = useProject() +const { loadTables, isMysql, isMssql, isPg } = useProject() const { table, createTable, generateUniqueTitle, tables, project } = useTable(async (table) => { await loadTables() @@ -40,7 +40,29 @@ const useForm = Form.useForm const validators = computed(() => { return { - title: [validateTableName, validateDuplicateAlias], + title: [ + validateTableName, + validateDuplicateAlias, + { + validator: (rule: any, value: any) => { + return new Promise((resolve, reject) => { + let tableNameLengthLimit = 255 + if (isMysql) { + tableNameLengthLimit = 64 + } else if (isPg) { + tableNameLengthLimit = 63 + } else if (isMssql) { + tableNameLengthLimit = 128 + } + const projectPrefix = project?.value?.prefix || '' + if ((projectPrefix + value).length > tableNameLengthLimit) { + return reject(new Error(`Table name exceeds ${tableNameLengthLimit} characters`)) + } + resolve() + }) + }, + }, + ], table_name: [validateTableName], } }) From ad3a706e63617bb52b2b7e4f7877b3ddad0daee7 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 19:12:59 +0800 Subject: [PATCH 06/42] chore(gui-v2): remove unnecessary return --- packages/nc-gui-v2/composables/useTable.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/nc-gui-v2/composables/useTable.ts b/packages/nc-gui-v2/composables/useTable.ts index 79dc527b4f..6efebffd96 100644 --- a/packages/nc-gui-v2/composables/useTable.ts +++ b/packages/nc-gui-v2/composables/useTable.ts @@ -39,7 +39,6 @@ export function useTable(onTableCreate?: (tableMeta: TableType) => void) { onTableCreate?.(tableMeta) } catch (e: any) { message.error(await extractSdkResponseErrorMsg(e)) - return } } From 509a447dea3369ad4ecbb4a6f153ab628cca1bbd Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 12 Aug 2022 19:13:34 +0800 Subject: [PATCH 07/42] fix(gui-v2): rename underlying db table when a table is renamed --- .../nc-gui-v2/components/dlg/TableRename.vue | 3 +- packages/nocodb/src/lib/meta/api/tableApis.ts | 81 +++++++++++++++++-- packages/nocodb/src/lib/models/Model.ts | 16 +++- 3 files changed, 92 insertions(+), 8 deletions(-) diff --git a/packages/nc-gui-v2/components/dlg/TableRename.vue b/packages/nc-gui-v2/components/dlg/TableRename.vue index 7bdcc2f25f..0e60c4cf03 100644 --- a/packages/nc-gui-v2/components/dlg/TableRename.vue +++ b/packages/nc-gui-v2/components/dlg/TableRename.vue @@ -91,7 +91,8 @@ const renameTable = async () => { loading = true try { await $api.dbTable.update(tableMeta?.id as string, { - title: formState.title, + project_id: project?.value?.id as string, + table_name: formState.title, }) dialogShow.value = false loadTables() diff --git a/packages/nocodb/src/lib/meta/api/tableApis.ts b/packages/nocodb/src/lib/meta/api/tableApis.ts index a68515ffaf..f7a52890df 100644 --- a/packages/nocodb/src/lib/meta/api/tableApis.ts +++ b/packages/nocodb/src/lib/meta/api/tableApis.ts @@ -2,6 +2,7 @@ import { Request, Response, Router } from 'express'; import Model from '../../models/Model'; import { PagedResponseImpl } from '../helpers/PagedResponse'; import { Tele } from 'nc-help'; +import DOMPurify from 'isomorphic-dompurify'; import { AuditOperationSubTypes, AuditOperationTypes, @@ -103,6 +104,8 @@ export async function tableCreate(req: Request, res) { } } + req.body.table_name = DOMPurify.sanitize(req.body.table_name); + // validate table name if (/^\s+|\s+$/.test(req.body.table_name)) { NcError.badRequest( @@ -218,18 +221,86 @@ export async function tableCreate(req: Request, res) { export async function tableUpdate(req: Request, res) { const model = await Model.get(req.params.tableId); + const project = await Project.getWithInfo(req.body.project_id); + const base = project.bases[0]; + + if (!req.body.table_name) { + NcError.badRequest( + 'Missing table name `table_name` property in request body' + ); + } + + if (project.prefix) { + if (!req.body.table_name.startsWith(project.prefix)) { + req.body.table_name = `${project.prefix}${req.body.table_name}`; + } + } + + req.body.table_name = DOMPurify.sanitize(req.body.table_name); + + // validate table name + if (/^\s+|\s+$/.test(req.body.table_name)) { + NcError.badRequest( + 'Leading or trailing whitespace not allowed in table names' + ); + } + + if ( + !(await Model.checkTitleAvailable({ + table_name: req.body.table_name, + project_id: project.id, + base_id: base.id, + })) + ) { + NcError.badRequest('Duplicate table name'); + } + + if (!req.body.title) { + req.body.title = getTableNameAlias( + req.body.table_name, + project.prefix, + base + ); + } + if ( !(await Model.checkAliasAvailable({ title: req.body.title, - project_id: model.project_id, - base_id: model.base_id, - exclude_id: req.params.tableId, + project_id: project.id, + base_id: base.id, })) ) { - NcError.badRequest('Duplicate table name'); + NcError.badRequest('Duplicate table alias'); } - await Model.updateAlias(req.params.tableId, req.body.title); + const sqlMgr = await ProjectMgrv2.getSqlMgr(project); + const sqlClient = NcConnectionMgrv2.getSqlClient(base); + + let tableNameLengthLimit = 255; + const sqlClientType = sqlClient.clientType; + if (sqlClientType === 'mysql2' || sqlClientType === 'mysql') { + tableNameLengthLimit = 64; + } else if (sqlClientType === 'pg') { + tableNameLengthLimit = 63; + } else if (sqlClientType === 'mssql') { + tableNameLengthLimit = 128; + } + + if (req.body.table_name.length > tableNameLengthLimit) { + NcError.badRequest(`Table name exceeds ${tableNameLengthLimit} characters`); + } + + await Model.updateAliasAndTableName( + req.params.tableId, + req.body.title, + req.body.table_name + ); + + await sqlMgr.sqlOpPlus(base, 'tableRename', { + ...req.body, + tn: req.body.table_name, + tn_old: model.table_name, + }); Tele.emit('evt', { evt_type: 'table:updated' }); diff --git a/packages/nocodb/src/lib/models/Model.ts b/packages/nocodb/src/lib/models/Model.ts index 4e0a8578a8..1dce0d5c30 100644 --- a/packages/nocodb/src/lib/models/Model.ts +++ b/packages/nocodb/src/lib/models/Model.ts @@ -412,14 +412,25 @@ export default class Model implements TableType { return insertObj; } - static async updateAlias(tableId, title: string, ncMeta = Noco.ncMeta) { - if (!title) NcError.badRequest("Missing 'title' property in body"); + static async updateAliasAndTableName( + tableId, + title: string, + table_name: string, + ncMeta = Noco.ncMeta + ) { + if (!title) { + NcError.badRequest("Missing 'title' property in body"); + } + if (!table_name) { + NcError.badRequest("Missing 'table_name' property in body"); + } // get existing cache const key = `${CacheScope.MODEL}:${tableId}`; const o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT); // update alias if (o) { o.title = title; + o.table_name = table_name; // set cache await NocoCache.set(key, o); } @@ -430,6 +441,7 @@ export default class Model implements TableType { MetaTable.MODELS, { title, + table_name, }, tableId ); From 5d2b6ff57c4c215f89e088b4535e9f67cf93e41c Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 13 Aug 2022 16:49:31 +0800 Subject: [PATCH 08/42] fix(gui-v2): cypress for renaming table --- scripts/cypress/integration/common/1a_table_operations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/cypress/integration/common/1a_table_operations.js b/scripts/cypress/integration/common/1a_table_operations.js index 3e5b2793bc..f13449ddf3 100644 --- a/scripts/cypress/integration/common/1a_table_operations.js +++ b/scripts/cypress/integration/common/1a_table_operations.js @@ -76,6 +76,9 @@ export const genTest = (apiType, dbType) => { cy.closeTableTab("CityX"); + // revert re-name operation to not impact rest of test suite + cy.renameTable("CityX", "City"); + // 4. verify linked contents in other table // 4a. Address table, has many field cy.openTableTab("Address", 25); @@ -97,9 +100,6 @@ export const genTest = (apiType, dbType) => { .contains("Kabul") .should("exist"); cy.closeTableTab("Country"); - - // revert re-name operation to not impact rest of test suite - cy.renameTable("CityX", "City"); }); }); }; From 54a6999ddd14933249d7380b2c8d58af7cf3436e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 16 Aug 2022 19:52:34 +0800 Subject: [PATCH 09/42] fix(gui-v2): revise dbTable patch properties --- packages/nocodb-sdk/src/lib/Api.ts | 2 +- scripts/sdk/swagger.json | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index d916b3839b..ab3f7a8aef 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -1486,7 +1486,7 @@ export class Api< */ update: ( tableId: string, - data: { title?: string }, + data: { table_name?: string; project_id?: string }, params: RequestParams = {} ) => this.request({ diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index b3e60d58f3..83606049e0 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -1309,7 +1309,10 @@ "schema": { "type": "object", "properties": { - "title": { + "table_name": { + "type": "string" + }, + "project_id": { "type": "string" } } From 672979debaf51638ef754f46cc6ec07142c291c3 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 16 Aug 2022 19:52:51 +0800 Subject: [PATCH 10/42] chore(gui-v2): use tableMeta?.project_id --- packages/nc-gui-v2/components/dlg/TableRename.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/components/dlg/TableRename.vue b/packages/nc-gui-v2/components/dlg/TableRename.vue index 0e60c4cf03..da94b36524 100644 --- a/packages/nc-gui-v2/components/dlg/TableRename.vue +++ b/packages/nc-gui-v2/components/dlg/TableRename.vue @@ -91,7 +91,7 @@ const renameTable = async () => { loading = true try { await $api.dbTable.update(tableMeta?.id as string, { - project_id: project?.value?.id as string, + project_id: tableMeta?.project_id as string, table_name: formState.title, }) dialogShow.value = false From b13297030683963b0a0eb94a422f489d004d5f10 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 19 Aug 2022 17:28:06 +0800 Subject: [PATCH 11/42] feat(gui-v2): add smtp rejectUnauthorized --- .../dashboard/settings/app-store/AppInstall.vue | 7 +++++++ packages/nocodb/src/lib/plugins/smtp/SMTP.ts | 14 ++++++-------- packages/nocodb/src/lib/plugins/smtp/index.ts | 13 ++++++++++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue b/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue index 1c589933ee..70a284e5b7 100644 --- a/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue +++ b/packages/nc-gui-v2/components/dashboard/settings/app-store/AppInstall.vue @@ -103,6 +103,13 @@ const readPluginDetails = async () => { const emptyParsedInput = formDetails.array ? [{}] : {} const parsedInput = res.input ? JSON.parse(res.input) : emptyParsedInput + // the type of 'secure' was XcType.SingleLineText in 0.0.1 + // and it has been changed to XcType.Checkbox, since 0.0.2 + // hence, change the text value to boolean here + if ('secure' in parsedInput && typeof parsedInput.secure === 'string') { + parsedInput.secure = !!parsedInput.secure + } + plugin = { ...res, formDetails, parsedInput } pluginFormData = plugin.parsedInput } catch (e) { diff --git a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts index 3e7695eeca..7b2b31e9c3 100644 --- a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts +++ b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts @@ -14,21 +14,19 @@ export default class SMTP implements IEmailAdapter { public async init(): Promise { const config = { - // from: this.input.from, - // options: { host: this.input?.host, port: parseInt(this.input?.port, 10), - secure: this.input?.secure === 'true', - ignoreTLS: - typeof this.input?.ignoreTLS === 'boolean' - ? this.input?.ignoreTLS - : this.input?.ignoreTLS === 'true', + secure: this.input?.secure, + ignoreTLS: this.input?.ignoreTLS, auth: { user: this.input?.username, pass: this.input?.password, }, - // } + tls: { + rejectUnauthorized: this.input?.rejectUnauthorized, + }, }; + this.transporter = nodemailer.createTransport(config); } diff --git a/packages/nocodb/src/lib/plugins/smtp/index.ts b/packages/nocodb/src/lib/plugins/smtp/index.ts index f239bfd009..2f17f0ade6 100644 --- a/packages/nocodb/src/lib/plugins/smtp/index.ts +++ b/packages/nocodb/src/lib/plugins/smtp/index.ts @@ -8,7 +8,7 @@ import SMTPPlugin from './SMTPPlugin'; const config: XcPluginConfig = { builder: SMTPPlugin, title: 'SMTP', - version: '0.0.1', + version: '0.0.2', // icon: 'mdi-email-outline', description: 'SMTP email client', price: 'Free', @@ -42,8 +42,8 @@ const config: XcPluginConfig = { key: 'secure', label: 'Secure', placeholder: 'Secure', - type: XcType.SingleLineText, - required: true, + type: XcType.Checkbox, + required: false, }, { key: 'ignoreTLS', @@ -52,6 +52,13 @@ const config: XcPluginConfig = { type: XcType.Checkbox, required: false, }, + { + key: 'rejectUnauthorized', + label: 'Reject Unauthorized', + placeholder: 'Reject Unauthorized', + type: XcType.Checkbox, + required: false, + }, { key: 'username', label: 'Username', From e086272f856933b4c16b3582d399d9f4e236fb33 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 19 Aug 2022 19:10:35 +0800 Subject: [PATCH 12/42] fix(gui-v2): cover string cases for secure & ignoreTLS --- packages/nocodb/src/lib/plugins/smtp/SMTP.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts index 7b2b31e9c3..9ceb06e703 100644 --- a/packages/nocodb/src/lib/plugins/smtp/SMTP.ts +++ b/packages/nocodb/src/lib/plugins/smtp/SMTP.ts @@ -16,8 +16,14 @@ export default class SMTP implements IEmailAdapter { const config = { host: this.input?.host, port: parseInt(this.input?.port, 10), - secure: this.input?.secure, - ignoreTLS: this.input?.ignoreTLS, + secure: + typeof this.input?.secure === 'boolean' + ? this.input?.secure + : this.input?.secure === 'true', + ignoreTLS: + typeof this.input?.ignoreTLS === 'boolean' + ? this.input?.ignoreTLS + : this.input?.ignoreTLS === 'true', auth: { user: this.input?.username, pass: this.input?.password, From 37228f903669581c06ef4ff669fa90441606d761 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 19 Aug 2022 23:16:05 +0800 Subject: [PATCH 13/42] cypress(gui-v2): change secure to button --- scripts/cypress/support/page_objects/mainPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/cypress/support/page_objects/mainPage.js b/scripts/cypress/support/page_objects/mainPage.js index b388264871..82fc06aade 100644 --- a/scripts/cypress/support/page_objects/mainPage.js +++ b/scripts/cypress/support/page_objects/mainPage.js @@ -222,7 +222,7 @@ export class _mainPage { .click() .type(host); cy.getActiveModal().find('[placeholder="Port"]').click().type(port); - cy.getActiveModal().find('[placeholder="Secure"]').click().type(secure); + if (secure) cy.getActiveModal().find('[placeholder="Secure"]').click(); cy.getActiveModal().find("button").contains("Save").click(); cy.toastWait( "Successfully installed and email notification will use SMTP configuration" From ae78c6cff66fa54d6450f53ec0894f2d509d0a2e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Sat, 20 Aug 2022 02:10:25 +0800 Subject: [PATCH 14/42] fix(gui-v2): cypress - change smtp secure type --- packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql b/packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql index d71eaf7f3b..39a4970fb6 100644 --- a/packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql +++ b/packages/nocodb/tests/pg-cy-quick/01-cy-quick.sql @@ -3308,7 +3308,7 @@ nc_iyhlectialukbv Vultr Object Storage Using Vultr Object Storage can give flexi nc_lr8pcvg64g5bho OvhCloud Object Storage Upload your files to a space that you can access via HTTPS using the OpenStack Swift API, or the S3 API. f \N 0.0.1 \N install \N plugins/ovhCloud.png \N Storage Storage {"title":"Configure OvhCloud Object Storage","items":[{"key":"bucket","label":"Bucket Name","placeholder":"Bucket Name","type":"SingleLineText","required":true},{"key":"region","label":"Region","placeholder":"Region","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and attachment will be stored in OvhCloud Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.60416+00 2022-06-13 07:00:02.60416+00 nc_3f19m6v5iyudty Linode Object Storage S3-compatible Linode Object Storage makes it easy and more affordable to manage unstructured data such as content assets, as well as sophisticated and data-intensive storage challenges around artificial intelligence and machine learning. f \N 0.0.1 \N install \N plugins/linode.svg \N Storage Storage {"title":"Configure Linode Object Storage","items":[{"key":"bucket","label":"Bucket Name","placeholder":"Bucket Name","type":"SingleLineText","required":true},{"key":"region","label":"Region","placeholder":"Region","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and attachment will be stored in Linode Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.606391+00 2022-06-13 07:00:02.606391+00 nc_ikemr7ajwzfcr3 UpCloud Object Storage The perfect home for your data. Thanks to the S3-compatible programmable interface,\nyou have a host of options for existing tools and code implementations.\n f \N 0.0.1 \N install \N plugins/upcloud.png \N Storage Storage {"title":"Configure UpCloud Object Storage","items":[{"key":"bucket","label":"Bucket Name","placeholder":"Bucket Name","type":"SingleLineText","required":true},{"key":"endpoint","label":"Endpoint","placeholder":"Endpoint","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and attachment will be stored in UpCloud Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.6085+00 2022-06-13 07:00:02.6085+00 -nc_tv5fgn17fgvcwh SMTP SMTP email client f \N 0.0.1 \N install \N \N \N Email Email {"title":"Configure Email SMTP","items":[{"key":"from","label":"From","placeholder":"eg: admin@run.com","type":"SingleLineText","required":true},{"key":"host","label":"Host","placeholder":"eg: smtp.run.com","type":"SingleLineText","required":true},{"key":"port","label":"Port","placeholder":"Port","type":"SingleLineText","required":true},{"key":"secure","label":"Secure","placeholder":"Secure","type":"SingleLineText","required":true},{"key":"ignoreTLS","label":"Ignore TLS","placeholder":"Ignore TLS","type":"Checkbox","required":false},{"key":"username","label":"Username","placeholder":"Username","type":"SingleLineText","required":false},{"key":"password","label":"Password","placeholder":"Password","type":"Password","required":false}],"actions":[{"label":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use SMTP configuration","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.61079+00 2022-06-13 07:00:02.61079+00 +nc_tv5fgn17fgvcwh SMTP SMTP email client f \N 0.0.1 \N install \N \N \N Email Email {"title":"Configure Email SMTP","items":[{"key":"from","label":"From","placeholder":"eg: admin@run.com","type":"SingleLineText","required":true},{"key":"host","label":"Host","placeholder":"eg: smtp.run.com","type":"SingleLineText","required":true},{"key":"port","label":"Port","placeholder":"Port","type":"SingleLineText","required":true},{"key":"secure","label":"Secure","placeholder":"Secure","type":"Checkbox","required":false},{"key":"ignoreTLS","label":"Ignore TLS","placeholder":"Ignore TLS","type":"Checkbox","required":false},{"key":"username","label":"Username","placeholder":"Username","type":"SingleLineText","required":false},{"key":"password","label":"Password","placeholder":"Password","type":"Password","required":false}],"actions":[{"label":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use SMTP configuration","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.61079+00 2022-06-13 07:00:02.61079+00 nc_hcnsq71s0tr8um MailerSend MailerSend email client f \N 0.0.1 \N install \N plugins/mailersend.svg \N Email Email {"title":"Configure MailerSend","items":[{"key":"api_key","label":"API KEy","placeholder":"eg: ***************","type":"Password","required":true},{"key":"from","label":"From","placeholder":"eg: admin@run.com","type":"SingleLineText","required":true},{"key":"from_name","label":"From Name","placeholder":"eg: Adam","type":"SingleLineText","required":true}],"actions":[{"label":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use MailerSend configuration","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.612874+00 2022-06-13 07:00:02.612874+00 nc_z2zas0qdy0cz7e Scaleway Object Storage Scaleway Object Storage is an S3-compatible object store from Scaleway Cloud Platform. f \N 0.0.1 \N install \N plugins/scaleway.png \N Storage Storage {"title":"Setup Scaleway","items":[{"key":"bucket","label":"Bucket name","placeholder":"Bucket name","type":"SingleLineText","required":true},{"key":"region","label":"Region of bucket","placeholder":"Region of bucket","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed Scaleway Object Storage","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.61482+00 2022-06-13 07:00:02.61482+00 nc_96vkc0jdyw7los SES Amazon Simple Email Service (SES) is a cost-effective, flexible, and scalable email service that enables developers to send mail from within any application. f \N 0.0.1 \N install \N plugins/aws.png \N Email Email {"title":"Configure Amazon Simple Email Service (SES)","items":[{"key":"from","label":"From","placeholder":"From","type":"SingleLineText","required":true},{"key":"region","label":"Region","placeholder":"Region","type":"SingleLineText","required":true},{"key":"access_key","label":"Access Key","placeholder":"Access Key","type":"SingleLineText","required":true},{"key":"access_secret","label":"Access Secret","placeholder":"Access Secret","type":"Password","required":true}],"actions":[{"label":"Test","placeholder":"Test","key":"test","actionType":"TEST","type":"Button"},{"label":"Save","placeholder":"Save","key":"save","actionType":"SUBMIT","type":"Button"}],"msgOnInstall":"Successfully installed and email notification will use Amazon SES","msgOnUninstall":""} \N \N \N \N 2022-06-13 07:00:02.617114+00 2022-06-13 07:00:02.617114+00 From a32c18e8eddedb40963f4ee0b032982dfb8e835e Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 22 Aug 2022 19:59:44 +0800 Subject: [PATCH 15/42] feat(gui-v2): add project_id to tableMeta --- scripts/sdk/swagger.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index db38ca1665..85c16c1795 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -6053,6 +6053,9 @@ }, "slug": { "type": "string" + }, + "project_id": { + "type": "string" } }, "required": [ From bc19bcdc0edd1d5d8e9bae687a1ef16ca6f98554 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 22 Aug 2022 19:59:56 +0800 Subject: [PATCH 16/42] chore(gui-v2): rebuild sdk --- packages/nocodb-sdk/src/lib/Api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index f8d68e05c3..08c38fdef7 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -121,6 +121,7 @@ export interface TableType { columns?: ColumnType[]; columnsById?: object; slug?: string; + project_id?: string; } export interface ViewType { @@ -169,7 +170,7 @@ export interface TableReqType { deleted?: boolean; order?: number; mm?: boolean; - columns?: ColumnType[]; + columns: ColumnType[]; } export interface TableListType { From f1681c17e38bfa937021d075782398052ce3c266 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 22 Aug 2022 20:00:12 +0800 Subject: [PATCH 17/42] chore(gui-v2): remove as string --- packages/nc-gui-v2/components/dlg/TableRename.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/components/dlg/TableRename.vue b/packages/nc-gui-v2/components/dlg/TableRename.vue index da94b36524..63385bac4f 100644 --- a/packages/nc-gui-v2/components/dlg/TableRename.vue +++ b/packages/nc-gui-v2/components/dlg/TableRename.vue @@ -91,7 +91,7 @@ const renameTable = async () => { loading = true try { await $api.dbTable.update(tableMeta?.id as string, { - project_id: tableMeta?.project_id as string, + project_id: tableMeta?.project_id, table_name: formState.title, }) dialogShow.value = false From 5e291c964f7b840ba224389453662fc48f535a16 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 22 Aug 2022 17:34:46 +0530 Subject: [PATCH 18/42] fix/Fixed styling of search and bottom buttons of tree view --- .../components/dashboard/TreeView.vue | 6 +- .../components/general/HelpAndSupport.vue | 85 +++++++++---------- .../components/general/ShareBaseButton.vue | 2 +- .../smartsheet-toolbar/SearchData.vue | 48 +++++++---- 4 files changed, 78 insertions(+), 63 deletions(-) diff --git a/packages/nc-gui-v2/components/dashboard/TreeView.vue b/packages/nc-gui-v2/components/dashboard/TreeView.vue index 5388b17a9e..74e081dedb 100644 --- a/packages/nc-gui-v2/components/dashboard/TreeView.vue +++ b/packages/nc-gui-v2/components/dashboard/TreeView.vue @@ -401,10 +401,10 @@ function openTableCreateDialog() { -
- +
+ - +
diff --git a/packages/nc-gui-v2/components/general/HelpAndSupport.vue b/packages/nc-gui-v2/components/general/HelpAndSupport.vue index 96ab9275da..1a4766c6a0 100644 --- a/packages/nc-gui-v2/components/general/HelpAndSupport.vue +++ b/packages/nc-gui-v2/components/general/HelpAndSupport.vue @@ -15,54 +15,53 @@ const openSwaggerLink = () => { From be5223b0dd8f4d729cb665a66da0520134f3fe48 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 22 Aug 2022 13:23:12 +0200 Subject: [PATCH 24/42] chore(gui-v2): remove active styles --- packages/nc-gui-v2/components/dashboard/settings/Modal.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/components/dashboard/settings/Modal.vue b/packages/nc-gui-v2/components/dashboard/settings/Modal.vue index 1a6736855c..550e461c2c 100644 --- a/packages/nc-gui-v2/components/dashboard/settings/Modal.vue +++ b/packages/nc-gui-v2/components/dashboard/settings/Modal.vue @@ -138,6 +138,7 @@ watch( >
SETTINGS + - + {{ $t('labels.serverCA') }} @@ -370,13 +365,13 @@ onMounted(() => { - + {{ type }} - + {{ type }} @@ -439,12 +434,12 @@ onMounted(() => { :deep(.ant-input-affix-wrapper), :deep(.ant-input), :deep(.ant-select) { - @apply !appearance-none my-1 border-1 border-solid border-primary/50 rounded; + @apply !appearance-none border-1 border-solid border-primary/50 rounded; } - .nc-extdb-host-password { + :deep(.ant-input-password) { input { - @apply !border-none; + @apply !border-none my-0; } } } From 2b890228483139bc23548c400092a3a268ab86a8 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 22 Aug 2022 10:42:10 +0200 Subject: [PATCH 36/42] chore(gui-v2): remove colored border from inputs --- packages/nc-gui-v2/pages/index/index/[id].vue | 2 +- packages/nc-gui-v2/pages/index/index/create-external.vue | 2 +- packages/nc-gui-v2/pages/index/index/create.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui-v2/pages/index/index/[id].vue b/packages/nc-gui-v2/pages/index/index/[id].vue index a28250f406..ceacb2aea5 100644 --- a/packages/nc-gui-v2/pages/index/index/[id].vue +++ b/packages/nc-gui-v2/pages/index/index/[id].vue @@ -107,7 +107,7 @@ await getProject() .update-project { .ant-input-affix-wrapper, .ant-input { - @apply !appearance-none my-1 border-1 border-solid border-primary/50 rounded; + @apply !appearance-none my-1 border-1 border-solid rounded; } .submit { diff --git a/packages/nc-gui-v2/pages/index/index/create-external.vue b/packages/nc-gui-v2/pages/index/index/create-external.vue index cefa7d99d5..81a222cb7c 100644 --- a/packages/nc-gui-v2/pages/index/index/create-external.vue +++ b/packages/nc-gui-v2/pages/index/index/create-external.vue @@ -434,7 +434,7 @@ onMounted(() => { :deep(.ant-input-affix-wrapper), :deep(.ant-input), :deep(.ant-select) { - @apply !appearance-none border-1 border-solid border-primary/50 rounded; + @apply !appearance-none border-1 border-solid rounded; } :deep(.ant-input-password) { diff --git a/packages/nc-gui-v2/pages/index/index/create.vue b/packages/nc-gui-v2/pages/index/index/create.vue index 991840691c..2c3edbd051 100644 --- a/packages/nc-gui-v2/pages/index/index/create.vue +++ b/packages/nc-gui-v2/pages/index/index/create.vue @@ -98,7 +98,7 @@ onMounted(async () => { .create { .ant-input-affix-wrapper, .ant-input { - @apply !appearance-none my-1 border-1 border-solid border-primary/50 rounded; + @apply !appearance-none my-1 border-1 border-solid rounded; } .submit { From 890b31c018e3aa469bdb06f07fef7bb491322076 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 22 Aug 2022 10:55:25 +0200 Subject: [PATCH 37/42] fix(gui-v2): use correct route names in sharebase btn and remove font color --- packages/nc-gui-v2/components/general/ShareBaseButton.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui-v2/components/general/ShareBaseButton.vue b/packages/nc-gui-v2/components/general/ShareBaseButton.vue index 9ea4f224c0..b53892f0fb 100644 --- a/packages/nc-gui-v2/components/general/ShareBaseButton.vue +++ b/packages/nc-gui-v2/components/general/ShareBaseButton.vue @@ -14,15 +14,16 @@ const { isUIAllowed } = useUIPermission() v-if=" isUIAllowed('newUser') && route.name !== 'index' && - route.name !== 'project-index-create' && - route.name !== 'project-index-create-external' && + route.name !== 'index-index-create' && + route.name !== 'index-index-create-external' && route.name !== 'index-user-index' " @click="showUserModal = true" > -
+
From a643cf3ea3ea87dd52426d06aa2bd098c3077fb4 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Mon, 22 Aug 2022 11:20:51 +0200 Subject: [PATCH 38/42] chore(gui-v2): hide links on create / update pages --- .../components/general/ShareBaseButton.vue | 2 +- packages/nc-gui-v2/layouts/base.vue | 2 +- packages/nc-gui-v2/pages/index/index.vue | 26 +++++++++++++------ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/packages/nc-gui-v2/components/general/ShareBaseButton.vue b/packages/nc-gui-v2/components/general/ShareBaseButton.vue index b53892f0fb..16d36223c5 100644 --- a/packages/nc-gui-v2/components/general/ShareBaseButton.vue +++ b/packages/nc-gui-v2/components/general/ShareBaseButton.vue @@ -1,5 +1,5 @@ +