From 3ef75660c49163bd399cdffd836a40fdea623bde Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 8 Apr 2022 16:24:04 +0530 Subject: [PATCH] refactor: code cleanup Signed-off-by: Pranav C --- .../nc-gui/components/import/dropOrSelectFileModal.vue | 1 - packages/nc-gui/helpers/sqlUi/MssqlUi.js | 10 ---------- .../src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts | 6 ------ .../nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts | 1 - .../src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts | 3 --- packages/nocodb/src/lib/noco-models/Audit.ts | 2 -- packages/nocodb/src/lib/noco-models/ProjectUser.ts | 2 -- packages/nocodb/src/lib/noco/Noco.ts | 3 --- packages/nocodb/src/lib/noco/meta/api/projectApis.ts | 2 -- packages/nocodb/src/lib/noco/meta/api/tableApis.ts | 1 - .../nocodb/src/lib/noco/meta/api/userApi/userApis.ts | 1 - .../nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts | 5 +---- 12 files changed, 1 insertion(+), 36 deletions(-) diff --git a/packages/nc-gui/components/import/dropOrSelectFileModal.vue b/packages/nc-gui/components/import/dropOrSelectFileModal.vue index 7f24221cdc..a6519e677d 100644 --- a/packages/nc-gui/components/import/dropOrSelectFileModal.vue +++ b/packages/nc-gui/components/import/dropOrSelectFileModal.vue @@ -98,7 +98,6 @@ export default { } }, dragOverHandler(ev) { - console.log('File(s) in drop zone') // Prevent default behavior (Prevent file from being opened) ev.preventDefault() diff --git a/packages/nc-gui/helpers/sqlUi/MssqlUi.js b/packages/nc-gui/helpers/sqlUi/MssqlUi.js index 9568ce3f50..f68231635f 100644 --- a/packages/nc-gui/helpers/sqlUi/MssqlUi.js +++ b/packages/nc-gui/helpers/sqlUi/MssqlUi.js @@ -570,16 +570,9 @@ export class MssqlUi { } static onCheckboxChangeAI(col) { - console.log(col) if (col.dt === 'int' || col.dt === 'bigint' || col.dt === 'smallint' || col.dt === 'tinyint') { col.altered = col.altered || 2 } - - // if (!col.ai) { - // col.dtx = 'specificType' - // } else { - // col.dtx = '' - // } } static showScale(columnObj) { @@ -596,7 +589,6 @@ export class MssqlUi { columns[i].un = false console.log('>> resetting unsigned value', columns[i].column_name) } - console.log(columns[i].column_name) } } @@ -617,8 +609,6 @@ export class MssqlUi { } static handleRawOutput(result, headers) { - console.log(result) - if (Array.isArray(result) && result[0]) { const keys = Object.keys(result[0]) // set headers before settings result diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts index fd22cfbce1..68e70dafa9 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts @@ -179,8 +179,6 @@ class BaseModelSqlv2 { if (!ignoreFilterSort) applyPaginate(qb, rest); const proto = await this.getProto(); - console.log(qb.toQuery()); - return (await qb).map(d => { d.__proto__ = proto; return d; @@ -248,8 +246,6 @@ class BaseModelSqlv2 { as: 'count' }).first(); - console.log(qb.toQuery()); - return ((await qb) as any).count; } @@ -747,8 +743,6 @@ class BaseModelSqlv2 { ).orWhereNull(rcn); }); - console.log('----', qb.toQuery()); - const aliasColObjMap = await childTable.getAliasColObjMap(); const filterObj = extractFilterFromXwhere(args.where, aliasColObjMap); diff --git a/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts b/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts index a605f82a7e..a2b3ea05be 100644 --- a/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts +++ b/packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts @@ -457,7 +457,6 @@ const appendWhereCondition = function( } }); - console.log(knexRef.toQuery()); return knexRef; }; diff --git a/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts b/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts index 92d259003b..4a0f572b5c 100644 --- a/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts +++ b/packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts @@ -767,8 +767,6 @@ export default class KnexMigratorv2 { ); } if (!sqlClient.knex.isTransaction) await trx.commit(); - - console.log('========== success '); } catch (error) { if (!sqlClient.knex.isTransaction) await trx.rollback(); vm.emitW( @@ -938,7 +936,6 @@ export default class KnexMigratorv2 { .del(); } if (!sqlClient.knex.isTransaction) await trx.commit(); - console.log('========== success '); } catch (error) { if (!sqlClient.knex.isTransaction) await trx.rollback(); vm.emitW( diff --git a/packages/nocodb/src/lib/noco-models/Audit.ts b/packages/nocodb/src/lib/noco-models/Audit.ts index 8be16ed720..6a1db21801 100644 --- a/packages/nocodb/src/lib/noco-models/Audit.ts +++ b/packages/nocodb/src/lib/noco-models/Audit.ts @@ -89,8 +89,6 @@ export default class Audit implements AuditType { if ((args.comments_only as any) == 'true') query.where('op_type', AuditOperationTypes.COMMENT); - console.log(query.toQuery()); - const audits = await query; return audits?.map(a => new Audit(a)); diff --git a/packages/nocodb/src/lib/noco-models/ProjectUser.ts b/packages/nocodb/src/lib/noco-models/ProjectUser.ts index 41f7697ee6..99c5cc81cd 100644 --- a/packages/nocodb/src/lib/noco-models/ProjectUser.ts +++ b/packages/nocodb/src/lib/noco-models/ProjectUser.ts @@ -104,8 +104,6 @@ export default class ProjectUser { ); }); - console.log(queryBuilder.toQuery()); - return await queryBuilder; } diff --git a/packages/nocodb/src/lib/noco/Noco.ts b/packages/nocodb/src/lib/noco/Noco.ts index 7b4b3dc057..352ce09570 100644 --- a/packages/nocodb/src/lib/noco/Noco.ts +++ b/packages/nocodb/src/lib/noco/Noco.ts @@ -351,7 +351,6 @@ export default class Noco { projectBuilder.updateConfig(project.config); await projectBuilder.reInit(); - console.log(`Project updated: ${projectId}`); } break; @@ -370,7 +369,6 @@ export default class Noco { this.ncToolApi.destroy(); this.ncToolApi.reInitialize(this.config); // await this.init({progressCallback}); - console.log(`Loaded env : ${data.req.args.env}`); } catch (e) { console.log(e); } @@ -510,7 +508,6 @@ export default class Noco { this.socketClient = client; client.on('disconnect', () => { - console.log('Disconnected'); this.socketClient = null; }); }); diff --git a/packages/nocodb/src/lib/noco/meta/api/projectApis.ts b/packages/nocodb/src/lib/noco/meta/api/projectApis.ts index 78ed0a9daa..09cdeeb1be 100644 --- a/packages/nocodb/src/lib/noco/meta/api/projectApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/projectApis.ts @@ -32,7 +32,6 @@ export async function projectGet( req: Request, res: Response ) { - console.log(req.query.page); const project = await Project.getWithInfo(req.params.projectId); // delete datasource connection details @@ -49,7 +48,6 @@ export async function projectList( next ) { try { - console.log(req.query.page); const projects = await Project.list(req.query); res // todo: pagination diff --git a/packages/nocodb/src/lib/noco/meta/api/tableApis.ts b/packages/nocodb/src/lib/noco/meta/api/tableApis.ts index 39577ea28f..8167fdaacb 100644 --- a/packages/nocodb/src/lib/noco/meta/api/tableApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/tableApis.ts @@ -183,7 +183,6 @@ export async function tableUpdate(req: Request, res) { export async function tableDelete(req: Request, res: Response, next) { try { - console.log(req.params); const table = await Model.getByIdOrName({ id: req.params.tableId }); await table.getColumns(); diff --git a/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts b/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts index e8d966a39f..b840760fd0 100644 --- a/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts +++ b/packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts @@ -299,7 +299,6 @@ async function passwordForgot(req: Request, res): Promise { 'Warning : `mailSend` failed, Please configure emailClient configuration.' ); } - console.log(`Password reset token : ${token}`); Audit.insert({ op_type: 'AUTHENTICATION', diff --git a/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts b/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts index 902a8c0dea..4eade93fa8 100644 --- a/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts +++ b/packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts @@ -185,7 +185,7 @@ export function axiosRequestMake(_apiMeta, apiReq, data) { export async function invokeWebhook( hook: Hook, - model: Model, + _model: Model, data, user, testFilters = null @@ -199,9 +199,6 @@ export async function invokeWebhook( ? JSON.parse(hook.notification) : hook.notification; - console.log('Hook handler ::::' + model.table_name + ':: Hook ::', hook); - console.log('Hook handler ::::' + model.table_name + ':: Data ::', data); - if (hook.condition) { if ( !(await validateCondition(