From 84656d17e2b5a7d137079366713d025bedb49c8e Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 10 Dec 2021 16:20:22 +0530 Subject: [PATCH] fix: keep table and view order Signed-off-by: Pranav C --- packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts | 9 ++++++--- packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts b/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts index 03f053306f..ed4a3c9ea1 100644 --- a/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts +++ b/packages/nocodb/src/lib/noco/gql/GqlApiBuilder.ts @@ -773,9 +773,12 @@ export class GqlApiBuilder extends BaseApiBuilder implements XcMetaMgr { tables.push(...relatedTableList.map(t => ({ tn: t }))); } else { - tables = (await this.sqlClient.tableList())?.data?.list?.filter( - ({ tn }) => !IGNORE_TABLES.includes(tn) - ); + tables = (await this.sqlClient.tableList())?.data?.list + ?.filter(({ tn }) => !IGNORE_TABLES.includes(tn)) + ?.map(t => { + t.order = ++order; + return t; + }); // enable extra tables.push( diff --git a/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts b/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts index 0bb67c179c..a1a1434b3e 100644 --- a/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts +++ b/packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts @@ -405,9 +405,12 @@ export class RestApiBuilder extends BaseApiBuilder { })); tables.push(...relatedTableList.map(t => ({ tn: t }))); } else { - tables = (await this.sqlClient.tableList())?.data?.list?.filter( - ({ tn }) => !IGNORE_TABLES.includes(tn) - ); + tables = (await this.sqlClient.tableList())?.data?.list + ?.filter(({ tn }) => !IGNORE_TABLES.includes(tn)) + ?.map(t => { + t.order = ++order; + return t; + }); // enable extra tables.push(