Browse Source

fix: maintain table list order, enable template editor

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/852/head
Pranav C 3 years ago
parent
commit
32738c9bec
  1. 2
      packages/nc-gui/components/templates/editor.vue
  2. 5
      packages/nc-gui/layouts/default.vue
  3. 2
      packages/nocodb/src/lib/noco/meta/NcMetaIOImpl.ts
  4. 19
      packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts

2
packages/nc-gui/components/templates/editor.vue

@ -468,7 +468,7 @@
Click to change gradient
</div>-->
<template v-if="!excelImport">
<gradient-generator v-model="project.image_url" class=" d-100" />
<gradient-generator v-model="project.image_url" class=" d-100 mt-4" />
<v-row>
<v-col>

5
packages/nc-gui/layouts/default.vue

@ -48,7 +48,7 @@
href="https://docs.nocodb.com"
target="_blank"
>Docs</a>
<!-- <templates-modal v-if="isDashboard && _isUIAllowed('template-import')" class="align-self-center" />-->
<templates-modal v-if="isDashboard && _isUIAllowed('template-import')" v-model="templateModal" class="align-self-center" />
</v-toolbar-items>
<!-- <template v-if="!isThisMobile ">
@ -581,9 +581,11 @@ import { copyTextToClipboard } from '@/helpers/xutils'
import Snackbar from '~/components/snackbar'
import Language from '~/components/utils/language'
import Loader from '~/components/loader'
import TemplatesModal from '~/components/templates/templatesModal'
export default {
components: {
TemplatesModal,
Loader,
ReleaseInfo,
Language,
@ -596,6 +598,7 @@ export default {
xTerm
},
data: () => ({
templateModal: false,
ghStarText: 'Star',
swaggerOrGraphiqlUrl: null,
showScreensaver: false,

2
packages/nocodb/src/lib/noco/meta/NcMetaIOImpl.ts

@ -234,8 +234,6 @@ export default class NcMetaIOImpl extends NcMetaIO {
query.select(...args.fields);
}
console.log('======', query.toQuery());
return query;
}

19
packages/nocodb/src/lib/noco/rest/RestApiBuilder.ts

@ -402,11 +402,14 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
}
}
tables = args.tableNames.map(({ tn, _tn }) => ({
tn,
type: args.type,
_tn
}));
tables = args.tableNames
.sort((a, b) => (a.tn || a._tn).localeCompare(b.tn || b._tn))
.map(({ tn, _tn }) => ({
tn,
type: args.type,
_tn,
order: ++order
}));
tables.push(...relatedTableList.map(t => ({ tn: t })));
} else {
tables = (await this.sqlClient.tableList())?.data?.list?.filter(
@ -416,10 +419,14 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
// enable extra
tables.push(
...(await this.sqlClient.viewList())?.data?.list
?.sort((a, b) =>
(a.view_name || a.tn).localeCompare(b.view_name || b.tn)
)
?.map(v => {
this.viewsCount++;
v.type = 'view';
v.tn = v.view_name;
v.order = ++order;
return v;
})
.filter(v => {
@ -523,7 +530,7 @@ export class RestApiBuilder extends BaseApiBuilder<Noco> {
this.dbAlias,
'nc_models',
{
order: ++order,
order: table.order || ++order,
view_order: 1,
title: table.tn,
alias: meta._tn,

Loading…
Cancel
Save