Browse Source

feat: make default sort list editable in public shared view

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/679/head
Pranav C 3 years ago
parent
commit
dcbd42ae13
  1. 4
      packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue
  2. 2
      packages/nc-gui/components/project/spreadsheet/components/spreadsheetNavDrawer.vue
  3. 10
      packages/nc-gui/components/project/spreadsheet/public/xcTable.vue
  4. 18
      packages/nocodb/src/lib/noco/meta/NcMetaMgrEE.ts

4
packages/nc-gui/components/project/spreadsheet/components/sortListMenu.vue

@ -96,7 +96,7 @@ export default {
} }
}, },
created() { created() {
this.filters = this.value || [] this.sortList = this.value || []
}, },
methods: { methods: {
addSort() { addSort() {
@ -104,7 +104,7 @@ export default {
field: '', field: '',
order: '' order: ''
}) })
this.filters = this.filters.slice() this.sortList = this.sortList.slice()
} }
} }
} }

2
packages/nc-gui/components/project/spreadsheet/components/spreadsheetNavDrawer.vue

@ -21,7 +21,7 @@
dense dense
:value="view.id" :value="view.id"
active-class="x-active--text" active-class="x-active--text"
class="body-2 text-capitalize view nc-view-item" class="body-2 view nc-view-item"
:class="`nc-${view.show_as}-view-item`" :class="`nc-${view.show_as}-view-item`"
@click="$emit('generateNewViewKey')" @click="$emit('generateNewViewKey')"
> >

10
packages/nc-gui/components/project/spreadsheet/public/xcTable.vue

@ -11,7 +11,7 @@
</v-alert> </v-alert>
<template v-else> <template v-else>
<div v-if="viewName" class="model-name text-capitalize"> <div v-if="viewName" class="model-name">
<span class="font-weight-bold"> {{ viewName }}</span> <span class="font-weight-regular ml-1" /> <span class="font-weight-bold"> {{ viewName }}</span> <span class="font-weight-regular ml-1" />
</div> </div>
@ -118,7 +118,6 @@
</v-list> </v-list>
</v-menu>--> </v-menu>-->
</v-toolbar> </v-toolbar>
<div <div
v-if="meta" v-if="meta"
class="nc-grid-wrapper d-flex" class="nc-grid-wrapper d-flex"
@ -466,9 +465,9 @@ export default {
view_name, view_name,
view_type, view_type,
client, client,
query_params: qp, query_params: qp = {},
db_alias: dbAlias, db_alias: dbAlias = '_noco',
relatedTableMetas relatedTableMetas = {}
} = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'sharedViewGet', { } = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'sharedViewGet', {
view_id: this.$route.params.id, view_id: this.$route.params.id,
password: this.password password: this.password
@ -485,6 +484,7 @@ export default {
this.query_params = qp this.query_params = qp
this.dbAlias = dbAlias this.dbAlias = dbAlias
this.metas = relatedTableMetas this.metas = relatedTableMetas
this.sortList = qp.sortList || []
this.showFields = this.query_params.showFields || {} this.showFields = this.query_params.showFields || {}

18
packages/nocodb/src/lib/noco/meta/NcMetaMgrEE.ts

@ -216,15 +216,15 @@ export default class NcMetaMgrEE extends NcMetaMgr {
if (privateViewWhere) { if (privateViewWhere) {
where += where ? `~and(${privateViewWhere})` : privateViewWhere; where += where ? `~and(${privateViewWhere})` : privateViewWhere;
} }
if (queryParams.sortList) { // if (queryParams.sortList) {
sort.push( // sort.push(
...(queryParams?.sortList // ...(queryParams?.sortList
?.map(sort => { // ?.map(sort => {
return sort.field ? `${sort.order}${sort.field}` : ''; // return sort.field ? `${sort.order}${sort.field}` : '';
}) // })
.filter(Boolean) || []) // .filter(Boolean) || [])
); // );
} // }
if (req.query.sort) { if (req.query.sort) {
sort.push(...req.query.sort.split(',')); sort.push(...req.query.sort.split(','));

Loading…
Cancel
Save