Browse Source

refactor: code cleanup

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1631/head
Pranav C 3 years ago
parent
commit
3ef75660c4
  1. 1
      packages/nc-gui/components/import/dropOrSelectFileModal.vue
  2. 10
      packages/nc-gui/helpers/sqlUi/MssqlUi.js
  3. 6
      packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts
  4. 1
      packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts
  5. 3
      packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts
  6. 2
      packages/nocodb/src/lib/noco-models/Audit.ts
  7. 2
      packages/nocodb/src/lib/noco-models/ProjectUser.ts
  8. 3
      packages/nocodb/src/lib/noco/Noco.ts
  9. 2
      packages/nocodb/src/lib/noco/meta/api/projectApis.ts
  10. 1
      packages/nocodb/src/lib/noco/meta/api/tableApis.ts
  11. 1
      packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts
  12. 5
      packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts

1
packages/nc-gui/components/import/dropOrSelectFileModal.vue

@ -98,7 +98,6 @@ export default {
} }
}, },
dragOverHandler(ev) { dragOverHandler(ev) {
console.log('File(s) in drop zone')
// Prevent default behavior (Prevent file from being opened) // Prevent default behavior (Prevent file from being opened)
ev.preventDefault() ev.preventDefault()

10
packages/nc-gui/helpers/sqlUi/MssqlUi.js

@ -570,16 +570,9 @@ export class MssqlUi {
} }
static onCheckboxChangeAI(col) { static onCheckboxChangeAI(col) {
console.log(col)
if (col.dt === 'int' || col.dt === 'bigint' || col.dt === 'smallint' || col.dt === 'tinyint') { if (col.dt === 'int' || col.dt === 'bigint' || col.dt === 'smallint' || col.dt === 'tinyint') {
col.altered = col.altered || 2 col.altered = col.altered || 2
} }
// if (!col.ai) {
// col.dtx = 'specificType'
// } else {
// col.dtx = ''
// }
} }
static showScale(columnObj) { static showScale(columnObj) {
@ -596,7 +589,6 @@ export class MssqlUi {
columns[i].un = false columns[i].un = false
console.log('>> resetting unsigned value', columns[i].column_name) 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) { static handleRawOutput(result, headers) {
console.log(result)
if (Array.isArray(result) && result[0]) { if (Array.isArray(result) && result[0]) {
const keys = Object.keys(result[0]) const keys = Object.keys(result[0])
// set headers before settings result // set headers before settings result

6
packages/nocodb/src/lib/dataMapper/lib/sql/BaseModelSqlv2.ts

@ -179,8 +179,6 @@ class BaseModelSqlv2 {
if (!ignoreFilterSort) applyPaginate(qb, rest); if (!ignoreFilterSort) applyPaginate(qb, rest);
const proto = await this.getProto(); const proto = await this.getProto();
console.log(qb.toQuery());
return (await qb).map(d => { return (await qb).map(d => {
d.__proto__ = proto; d.__proto__ = proto;
return d; return d;
@ -248,8 +246,6 @@ class BaseModelSqlv2 {
as: 'count' as: 'count'
}).first(); }).first();
console.log(qb.toQuery());
return ((await qb) as any).count; return ((await qb) as any).count;
} }
@ -747,8 +743,6 @@ class BaseModelSqlv2 {
).orWhereNull(rcn); ).orWhereNull(rcn);
}); });
console.log('----', qb.toQuery());
const aliasColObjMap = await childTable.getAliasColObjMap(); const aliasColObjMap = await childTable.getAliasColObjMap();
const filterObj = extractFilterFromXwhere(args.where, aliasColObjMap); const filterObj = extractFilterFromXwhere(args.where, aliasColObjMap);

1
packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts

@ -457,7 +457,6 @@ const appendWhereCondition = function(
} }
}); });
console.log(knexRef.toQuery());
return knexRef; return knexRef;
}; };

3
packages/nocodb/src/lib/migrator/SqlMigrator/lib/KnexMigratorv2.ts

@ -767,8 +767,6 @@ export default class KnexMigratorv2 {
); );
} }
if (!sqlClient.knex.isTransaction) await trx.commit(); if (!sqlClient.knex.isTransaction) await trx.commit();
console.log('========== success ');
} catch (error) { } catch (error) {
if (!sqlClient.knex.isTransaction) await trx.rollback(); if (!sqlClient.knex.isTransaction) await trx.rollback();
vm.emitW( vm.emitW(
@ -938,7 +936,6 @@ export default class KnexMigratorv2 {
.del(); .del();
} }
if (!sqlClient.knex.isTransaction) await trx.commit(); if (!sqlClient.knex.isTransaction) await trx.commit();
console.log('========== success ');
} catch (error) { } catch (error) {
if (!sqlClient.knex.isTransaction) await trx.rollback(); if (!sqlClient.knex.isTransaction) await trx.rollback();
vm.emitW( vm.emitW(

2
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') if ((args.comments_only as any) == 'true')
query.where('op_type', AuditOperationTypes.COMMENT); query.where('op_type', AuditOperationTypes.COMMENT);
console.log(query.toQuery());
const audits = await query; const audits = await query;
return audits?.map(a => new Audit(a)); return audits?.map(a => new Audit(a));

2
packages/nocodb/src/lib/noco-models/ProjectUser.ts

@ -104,8 +104,6 @@ export default class ProjectUser {
); );
}); });
console.log(queryBuilder.toQuery());
return await queryBuilder; return await queryBuilder;
} }

3
packages/nocodb/src/lib/noco/Noco.ts

@ -351,7 +351,6 @@ export default class Noco {
projectBuilder.updateConfig(project.config); projectBuilder.updateConfig(project.config);
await projectBuilder.reInit(); await projectBuilder.reInit();
console.log(`Project updated: ${projectId}`);
} }
break; break;
@ -370,7 +369,6 @@ export default class Noco {
this.ncToolApi.destroy(); this.ncToolApi.destroy();
this.ncToolApi.reInitialize(this.config); this.ncToolApi.reInitialize(this.config);
// await this.init({progressCallback}); // await this.init({progressCallback});
console.log(`Loaded env : ${data.req.args.env}`);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
@ -510,7 +508,6 @@ export default class Noco {
this.socketClient = client; this.socketClient = client;
client.on('disconnect', () => { client.on('disconnect', () => {
console.log('Disconnected');
this.socketClient = null; this.socketClient = null;
}); });
}); });

2
packages/nocodb/src/lib/noco/meta/api/projectApis.ts

@ -32,7 +32,6 @@ export async function projectGet(
req: Request<any, any, any>, req: Request<any, any, any>,
res: Response<Project> res: Response<Project>
) { ) {
console.log(req.query.page);
const project = await Project.getWithInfo(req.params.projectId); const project = await Project.getWithInfo(req.params.projectId);
// delete datasource connection details // delete datasource connection details
@ -49,7 +48,6 @@ export async function projectList(
next next
) { ) {
try { try {
console.log(req.query.page);
const projects = await Project.list(req.query); const projects = await Project.list(req.query);
res // todo: pagination res // todo: pagination

1
packages/nocodb/src/lib/noco/meta/api/tableApis.ts

@ -183,7 +183,6 @@ export async function tableUpdate(req: Request<any, any>, res) {
export async function tableDelete(req: Request, res: Response, next) { export async function tableDelete(req: Request, res: Response, next) {
try { try {
console.log(req.params);
const table = await Model.getByIdOrName({ id: req.params.tableId }); const table = await Model.getByIdOrName({ id: req.params.tableId });
await table.getColumns(); await table.getColumns();

1
packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts

@ -299,7 +299,6 @@ async function passwordForgot(req: Request<any, any>, res): Promise<any> {
'Warning : `mailSend` failed, Please configure emailClient configuration.' 'Warning : `mailSend` failed, Please configure emailClient configuration.'
); );
} }
console.log(`Password reset token : ${token}`);
Audit.insert({ Audit.insert({
op_type: 'AUTHENTICATION', op_type: 'AUTHENTICATION',

5
packages/nocodb/src/lib/noco/meta/helpers/webhookHelpers.ts

@ -185,7 +185,7 @@ export function axiosRequestMake(_apiMeta, apiReq, data) {
export async function invokeWebhook( export async function invokeWebhook(
hook: Hook, hook: Hook,
model: Model, _model: Model,
data, data,
user, user,
testFilters = null testFilters = null
@ -199,9 +199,6 @@ export async function invokeWebhook(
? JSON.parse(hook.notification) ? JSON.parse(hook.notification)
: 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 (hook.condition) {
if ( if (
!(await validateCondition( !(await validateCondition(

Loading…
Cancel
Save