Browse Source

refactor: show current view on top

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/679/head
Pranav C 3 years ago
parent
commit
c49bc68689
  1. 15
      packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue

15
packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue

@ -65,9 +65,16 @@ export default {
}, },
methods: { methods: {
async loadSharedViewsList() { async loadSharedViewsList() {
this.viewsList = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: this.nodes.dbAlias }, 'listSharedViewLinks', { const viewsList = await this.$store.dispatch('sqlMgr/ActSqlOp', [{ dbAlias: this.nodes.dbAlias }, 'listSharedViewLinks', {
model_name: this.modelName model_name: this.modelName
}]) }])
const index = viewsList.findIndex(v => (v.view_name || '').toLowerCase() === (this.$route.query.view || '').toLowerCase())
if (index > -1) {
viewsList.unshift(...viewsList.splice(index, 1))
}
this.viewsList = viewsList
}, },
async deleteLink(id) { async deleteLink(id) {
try { try {
@ -75,7 +82,7 @@ export default {
id id
}]) }])
this.$toast.success('Deleted shared view successfully').goAway(3000) this.$toast.success('Deleted shared view successfully').goAway(3000)
this.loadSharedViewsList() await this.loadSharedViewsList()
} catch (e) { } catch (e) {
this.$toast.error(e.message).goAway(3000) this.$toast.error(e.message).goAway(3000)
} }
@ -85,7 +92,7 @@ export default {
</script> </script>
<style scoped> <style scoped>
th,td{ th, td {
padding: 0 5px; padding: 0 5px;
} }
</style> </style>

Loading…
Cancel
Save