Skip to content

Commit

Permalink
adjusted front end logic for views
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
  • Loading branch information
elzody authored and juliusknorr committed Feb 29, 2024
1 parent 79bede5 commit d38fd2b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/modules/navigation/sections/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:filter-string="filterString"
:table="node" />

<NavigationViewItem v-else-if="node.tableId && !node.favorite"
<NavigationViewItem v-else-if="node.tableId && !node.favorite && !viewAlreadyListed(node)"
:key="'view' + node.id"
:view="node" />
</template>
Expand Down Expand Up @@ -130,7 +130,14 @@ export default {
computed: {
...mapState(['tables', 'views', 'tablesLoading']),
getAllNodes() {
return [...this.getFilteredTables, ...this.getSharedViews]
return [...this.getFilteredTables, ...this.getOwnViews, ...this.getSharedViews]
},
getOwnViews() {
const sharedTableIds = this.getFilteredTables.map(table => table.id)
return this.views.filter(view => {
return !view.isShared && view.ownership === getCurrentUser().uid && sharedTableIds.includes(view.tableId)
}).filter(view => view.title.toLowerCase().includes(this.filterString.toLowerCase()))
},
getSharedViews() {
const sharedTableIds = this.getFilteredTables.map(table => table.id)
Expand Down Expand Up @@ -167,6 +174,9 @@ export default {
})
}
},
viewAlreadyListed(view) {
return this.getFilteredTables.map(t => t.id).includes(view.tableId)
},
},
}
</script>
Expand Down

0 comments on commit d38fd2b

Please sign in to comment.