diff --git a/packages/nc-gui/components/project/appStore/inputs/checkboxField.vue b/packages/nc-gui/components/project/appStore/inputs/checkboxField.vue index d8c05e90fb..5d46f03fd8 100644 --- a/packages/nc-gui/components/project/appStore/inputs/checkboxField.vue +++ b/packages/nc-gui/components/project/appStore/inputs/checkboxField.vue @@ -29,9 +29,6 @@ export default { return $listeners } }, - created() { - this.localState = false - }, } diff --git a/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue b/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue index 630f94eb7c..b8be60b14e 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/moreActions.vue @@ -286,10 +286,6 @@ export default { }, async importData(columnMappings) { try { - const api = this.$ncApis.get({ - table: this.meta.table_name - }) - const data = this.parsedCsv.data for (let i = 0, progress = 0; i < data.length; i += 500) { const batchData = data.slice(i, i + 500).map(row => columnMappings.reduce((res, col) => { @@ -312,7 +308,12 @@ export default { } return res }, {})) - await api.insertBulk(batchData) + await this.$api.dbTableRow.bulkCreate( + 'noco', + this.projectName, + this.meta.title, + batchData + ) progress += batchData.length this.$store.commit('loader/MutMessage', `Importing data : ${progress}/${data.length}`) this.$store.commit('loader/MutProgress', Math.round((100 * progress / data.length))) diff --git a/packages/nc-gui/package-lock.json b/packages/nc-gui/package-lock.json index 1b15a10054..31215b8952 100644 --- a/packages/nc-gui/package-lock.json +++ b/packages/nc-gui/package-lock.json @@ -7876,9 +7876,9 @@ } }, "nocodb-sdk": { - "version": "0.90.1", - "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.90.1.tgz", - "integrity": "sha512-hjweeyVQHD4EGcF8BwF7yrONrWJzN065d09KvK5HWiEjupdzkGwBpz3blK2YqDQQNdLwjwzMBVjS0BnxBYdq3A==", + "version": "0.90.2", + "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.90.2.tgz", + "integrity": "sha512-myA+9Vluo4iULAd8hT0xO0I7n5kKIPhL+6p2LNBiE9FL9g1xRIMt5stDpuhP79qTiSMiXvdOV2Wyb1Zqz/7Qiw==", "requires": { "axios": "^0.21.1", "jsep": "^0.4.0" diff --git a/packages/nc-gui/package.json b/packages/nc-gui/package.json index 734268f212..28bd8946a9 100644 --- a/packages/nc-gui/package.json +++ b/packages/nc-gui/package.json @@ -29,7 +29,7 @@ "monaco-editor": "^0.19.3", "monaco-themes": "^0.2.5", "nano-assign": "^1.0.1", - "nocodb-sdk": "0.90.1", + "nocodb-sdk": "0.90.2", "nuxt": "^2.14.0", "odometer": "^0.4.8", "papaparse": "^5.3.1", diff --git a/packages/nc-lib-gui/package.json b/packages/nc-lib-gui/package.json index 4ad3a1ed81..48d52fd300 100644 --- a/packages/nc-lib-gui/package.json +++ b/packages/nc-lib-gui/package.json @@ -1,6 +1,6 @@ { "name": "nc-lib-gui", - "version": "0.90.1", + "version": "0.90.2", "description": "> TODO: description", "author": "“pranavxc” ", "homepage": "https://gitlab.com/xgenecloud-ts/xgenecloud-ts#readme", diff --git a/packages/nocodb-sdk/package-lock.json b/packages/nocodb-sdk/package-lock.json index 1a1d81b135..bb76580586 100644 --- a/packages/nocodb-sdk/package-lock.json +++ b/packages/nocodb-sdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "nocodb-sdk", - "version": "0.90.1", + "version": "0.90.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/nocodb-sdk/package.json b/packages/nocodb-sdk/package.json index 293a63ee22..1f085b0e37 100644 --- a/packages/nocodb-sdk/package.json +++ b/packages/nocodb-sdk/package.json @@ -1,6 +1,6 @@ { "name": "nocodb-sdk", - "version": "0.90.1", + "version": "0.90.2", "description": "NocoDB SDK", "main": "build/main/index.js", "typings": "build/main/index.d.ts", diff --git a/packages/nocodb/package-lock.json b/packages/nocodb/package-lock.json index 7249127e81..583d4b2d16 100644 --- a/packages/nocodb/package-lock.json +++ b/packages/nocodb/package-lock.json @@ -1,6 +1,6 @@ { "name": "nocodb", - "version": "0.90.1", + "version": "0.90.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -12483,9 +12483,9 @@ } }, "nc-lib-gui": { - "version": "0.90.1", - "resolved": "https://registry.npmjs.org/nc-lib-gui/-/nc-lib-gui-0.90.1.tgz", - "integrity": "sha512-4S/hOUUwrpIBfjEgiONEjAdanejv6yFdIq77RZjvuhuGuySccHMdvOZ7KOWkxsdiDXCzc0W0YCCyn6WICKUrVA==", + "version": "0.90.2", + "resolved": "https://registry.npmjs.org/nc-lib-gui/-/nc-lib-gui-0.90.2.tgz", + "integrity": "sha512-+ftnlNyc6I/QU8DxAITSBNSoK7cHZAL4JjLIk7xqFSP4M7v3shCTDO4zkxOxVRih5z915dj1iR/Vw7A5qWz58A==", "requires": { "axios": "^0.19.2", "body-parser": "^1.19.0", @@ -12592,9 +12592,9 @@ "dev": true }, "nocodb-sdk": { - "version": "0.90.1", - "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.90.1.tgz", - "integrity": "sha512-hjweeyVQHD4EGcF8BwF7yrONrWJzN065d09KvK5HWiEjupdzkGwBpz3blK2YqDQQNdLwjwzMBVjS0BnxBYdq3A==", + "version": "0.90.2", + "resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.90.2.tgz", + "integrity": "sha512-myA+9Vluo4iULAd8hT0xO0I7n5kKIPhL+6p2LNBiE9FL9g1xRIMt5stDpuhP79qTiSMiXvdOV2Wyb1Zqz/7Qiw==", "requires": { "axios": "^0.21.1", "jsep": "^0.4.0" diff --git a/packages/nocodb/package.json b/packages/nocodb/package.json index b4540a6d3a..907f02ea68 100644 --- a/packages/nocodb/package.json +++ b/packages/nocodb/package.json @@ -1,6 +1,6 @@ { "name": "nocodb", - "version": "0.90.1", + "version": "0.90.2", "description": "NocoDB", "main": "dist/bundle.js", "repository": "https://github.com/nocodb/nocodb", @@ -151,10 +151,10 @@ "nanoid": "^3.1.20", "nc-common": "0.0.6", "nc-help": "^0.2.44", - "nc-lib-gui": "0.90.1", + "nc-lib-gui": "0.90.2", "nc-plugin": "^0.1.1", "ncp": "^2.0.0", - "nocodb-sdk": "0.90.1", + "nocodb-sdk": "0.90.2", "nodemailer": "^6.4.10", "ora": "^4.0.4", "os-locale": "^5.0.0", diff --git a/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts b/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts index ba703baab0..25df4729f9 100644 --- a/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts +++ b/packages/nocodb/src/lib/noco/common/XcMigrationSourcev2.ts @@ -1,4 +1,5 @@ -import * as nc_011 from '../migrations/nc_011'; +import * as nc_011 from '../migrationsv2/nc_011'; +import * as nc_012_alter_column_data_types from '../migrationsv2/nc_012_alter_column_data_types'; // Create a custom migration source class export default class XcMigrationSourcev2 { @@ -7,7 +8,7 @@ export default class XcMigrationSourcev2 { // arguments to getMigrationName and getMigration public getMigrations(): Promise { // In this example we are just returning migration names - return Promise.resolve(['nc_011']); + return Promise.resolve(['nc_011', 'nc_012_alter_column_data_types']); } public getMigrationName(migration): string { @@ -18,6 +19,8 @@ export default class XcMigrationSourcev2 { switch (migration) { case 'nc_011': return nc_011; + case 'nc_012_alter_column_data_types': + return nc_012_alter_column_data_types; } } } diff --git a/packages/nocodb/src/lib/noco/meta/helpers/catchError.ts b/packages/nocodb/src/lib/noco/meta/helpers/catchError.ts index ee75573a03..f83c8fc94b 100644 --- a/packages/nocodb/src/lib/noco/meta/helpers/catchError.ts +++ b/packages/nocodb/src/lib/noco/meta/helpers/catchError.ts @@ -8,7 +8,7 @@ export default function( // todo: error log console.log(requestHandler.name ? `${requestHandler.name} ::` : '', e); - if (e instanceof BasRequest) { + if (e instanceof BadRequest) { return res.status(400).json({ msg: e.message }); } else if (e instanceof Unauthorized) { return res.status(401).json({ msg: e.message }); @@ -26,7 +26,7 @@ export default function( }; } -class BasRequest extends Error {} +class BadRequest extends Error {} class Unauthorized extends Error {} class Forbidden extends Error {} class NotFound extends Error {} @@ -38,7 +38,7 @@ export class NcError { throw new NotFound(message); } static badRequest(message) { - throw new BasRequest(message); + throw new BadRequest(message); } static unauthorized(message) { throw new Unauthorized(message); diff --git a/packages/nocodb/src/lib/noco/migrations/nc_011.ts b/packages/nocodb/src/lib/noco/migrationsv2/nc_011.ts similarity index 100% rename from packages/nocodb/src/lib/noco/migrations/nc_011.ts rename to packages/nocodb/src/lib/noco/migrationsv2/nc_011.ts diff --git a/packages/nocodb/src/lib/noco/migrationsv2/nc_012_alter_column_data_types.ts b/packages/nocodb/src/lib/noco/migrationsv2/nc_012_alter_column_data_types.ts new file mode 100644 index 0000000000..6f643cba0f --- /dev/null +++ b/packages/nocodb/src/lib/noco/migrationsv2/nc_012_alter_column_data_types.ts @@ -0,0 +1,48 @@ +import Knex from 'knex'; +import { MetaTable } from '../../utils/globals'; + +const up = async (knex: Knex) => { + if (knex.client.config.client !== 'sqlite3') { + await knex.schema.alterTable(MetaTable.COLUMNS, table => { + table.text('cdf').alter(); + table.text('dtxp').alter(); + table.text('cc').alter(); + table.text('ct').alter(); + }); + } +}; + +const down = async knex => { + await knex.schema.alterTable(MetaTable.COLUMNS, table => { + if (knex.client.config.client !== 'sqlite3') { + table.string('cdf').alter(); + table.string('dtxp').alter(); + table.string('cc').alter(); + table.string('ct').alter(); + } + }); +}; + +export { up, down }; + +/** + * @copyright Copyright (c) 2022, Xgene Cloud Ltd + * + * @author Wing-Kam Wong + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */