From c49bc68689b0672f35c4ea314d416aefab48d184 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 20 Oct 2021 18:31:01 +0530 Subject: [PATCH] refactor: show current view on top Signed-off-by: Pranav C --- .../spreadsheet/components/sharedViewsList.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue b/packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue index 8bde433018..e787eed433 100644 --- a/packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue +++ b/packages/nc-gui/components/project/spreadsheet/components/sharedViewsList.vue @@ -65,9 +65,16 @@ export default { }, methods: { 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 }]) + + 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) { try { @@ -75,7 +82,7 @@ export default { id }]) this.$toast.success('Deleted shared view successfully').goAway(3000) - this.loadSharedViewsList() + await this.loadSharedViewsList() } catch (e) { this.$toast.error(e.message).goAway(3000) } @@ -85,7 +92,7 @@ export default {