Browse Source

chore: lint

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5175/head
Pranav C 2 years ago
parent
commit
9c6d2af45a
  1. 1
      packages/nc-gui/components/virtual-cell/components/ListItems.vue
  2. 11
      packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts
  3. 6
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts
  4. 11
      packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts
  5. 2
      packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts
  6. 8
      packages/nocodb/src/lib/meta/helpers/mapDefaultDisplayValue.ts
  7. 10
      packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts

1
packages/nc-gui/components/virtual-cell/components/ListItems.vue

@ -252,7 +252,6 @@ watch(vModel, (nextVal) => {
</div>
</template>
<a-empty v-else class="my-10" :image="Empty.PRESENTED_IMAGE_SIMPLE" />
<Suspense>

11
packages/nocodb/src/lib/db/sql-mgr/SqlMgr.ts

@ -345,7 +345,16 @@ export default class SqlMgr {
* @returns
* @memberof SqlMgr
*/
public async projectGetSqlClient(args): Promise<SnowflakeClient | MysqlClient | SqliteClient | MssqlClient | OracleClient | PGClient> {
public async projectGetSqlClient(
args
): Promise<
| SnowflakeClient
| MysqlClient
| SqliteClient
| MssqlClient
| OracleClient
| PGClient
> {
const func = this.projectGetSqlClient.name;
log.api(`${func}:args:`, args);

6
packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2.ts

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import { promisify } from 'util';
import { Knex } from 'knex';
import { Knex } from 'knex';
import glob from 'glob';
import SqlClientFactory from '../../sql-client/lib/SqlClientFactory';
@ -754,7 +754,7 @@ export default class KnexMigratorv2 {
const vm = this;
const trx = sqlClient.knex.isTransaction
? sqlClient.knex as Knex.Transaction
? (sqlClient.knex as Knex.Transaction)
: await sqlClient.knex.transaction();
try {
for (const query of upStatements) {
@ -921,7 +921,7 @@ export default class KnexMigratorv2 {
const vm = this;
const trx = sqlClient.knex.isTransaction
? sqlClient.knex as Knex.Transaction
? (sqlClient.knex as Knex.Transaction)
: await sqlClient.knex.transaction();
try {
for (const query of downStatements) {

11
packages/nocodb/src/lib/db/sql-migrator/lib/KnexMigratorv2Tans.ts

@ -31,7 +31,16 @@ export default class KnexMigratorv2Tans extends KnexMigratorv2 {
protected get metaDb(): XKnex {
return this.ncMeta.knex || Noco.ncMeta.knex;
}
protected async getSqlClient(base: Base): Promise<SnowflakeClient | MysqlClient | SqliteClient | MssqlClient | OracleClient | PGClient> {
protected async getSqlClient(
base: Base
): Promise<
| SnowflakeClient
| MysqlClient
| SqliteClient
| MssqlClient
| OracleClient
| PGClient
> {
return this.sqlClient || NcConnectionMgrv2.getSqlClient(base);
}
}

2
packages/nocodb/src/lib/meta/api/helpers/populateMeta.ts

@ -228,7 +228,7 @@ export async function populateMeta(base: Base, project: Project): Promise<any> {
return async () => {
const columns = (await sqlClient.columnList({ tn: table.table_name }))
?.data?.list;
mapDefaultDisplayValue(columns);
/* create nc_models and its rows if it doesn't exists */

8
packages/nocodb/src/lib/meta/helpers/mapDefaultDisplayValue.ts

@ -4,7 +4,7 @@ export default function mapDefaultDisplayValue<T extends ColumnType>(
columnsArr: Array<T>
): void | T {
if (!columnsArr.some((column) => column.pv)) {
const pkIndex = columnsArr.findIndex((column) => column.pk)
const pkIndex = columnsArr.findIndex((column) => column.pk);
// if PK is at the end of table
if (pkIndex === columnsArr.length - 1) {
@ -15,11 +15,11 @@ export default function mapDefaultDisplayValue<T extends ColumnType>(
columnsArr[0].pv = true;
return columnsArr[0];
}
// pk is not at the end of table
} else if (pkIndex > -1) {
// pk is not at the end of table
} else if (pkIndex > -1) {
columnsArr[pkIndex + 1].pv = true;
return columnsArr[pkIndex + 1];
// no pk at all
// no pk at all
} else {
if (columnsArr.length > 0) {
columnsArr[0].pv = true;

10
packages/nocodb/src/lib/version-upgrader/ncStickyColumnUpgrader.ts

@ -40,8 +40,8 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
// if no display value column is set
if (!view_columns_meta.some((column) => column.pv)) {
const pkIndex = view_columns_meta.findIndex((column) => column.pk)
const pkIndex = view_columns_meta.findIndex((column) => column.pk);
// if PK is at the end of table
if (pkIndex === view_columns_meta.length - 1) {
if (pkIndex > 0) {
@ -61,8 +61,8 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
view_columns_meta[0].id
);
}
// pk is not at the end of table
} else if (pkIndex > -1) {
// pk is not at the end of table
} else if (pkIndex > -1) {
await ncMeta.metaUpdate(
null,
null,
@ -70,7 +70,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
{ pv: true },
view_columns_meta[pkIndex + 1].id
);
// no pk at all
// no pk at all
} else if (view_columns_meta.length > 0) {
await ncMeta.metaUpdate(
null,

Loading…
Cancel
Save