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() {
this.filters = this.value || []
this.sortList = this.value || []
},
methods: {
addSort() {
@ -104,7 +104,7 @@ export default {
field: '',
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
:value="view.id"
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`"
@click="$emit('generateNewViewKey')"
>

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

@ -11,7 +11,7 @@
</v-alert>
<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" />
</div>
@ -118,7 +118,6 @@
</v-list>
</v-menu>-->
</v-toolbar>
<div
v-if="meta"
class="nc-grid-wrapper d-flex"
@ -466,9 +465,9 @@ export default {
view_name,
view_type,
client,
query_params: qp,
db_alias: dbAlias,
relatedTableMetas
query_params: qp = {},
db_alias: dbAlias = '_noco',
relatedTableMetas = {}
} = await this.$store.dispatch('sqlMgr/ActSqlOp', [null, 'sharedViewGet', {
view_id: this.$route.params.id,
password: this.password
@ -485,6 +484,7 @@ export default {
this.query_params = qp
this.dbAlias = dbAlias
this.metas = relatedTableMetas
this.sortList = qp.sortList || []
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) {
where += where ? `~and(${privateViewWhere})` : privateViewWhere;
}
if (queryParams.sortList) {
sort.push(
...(queryParams?.sortList
?.map(sort => {
return sort.field ? `${sort.order}${sort.field}` : '';
})
.filter(Boolean) || [])
);
}
// if (queryParams.sortList) {
// sort.push(
// ...(queryParams?.sortList
// ?.map(sort => {
// return sort.field ? `${sort.order}${sort.field}` : '';
// })
// .filter(Boolean) || [])
// );
// }
if (req.query.sort) {
sort.push(...req.query.sort.split(','));

Loading…
Cancel
Save