Browse Source

Moving sidebar items to computed isntead of data

Reason is that data is not inherently reactive, but computed is
When locale changes, the items will be updated correctly in computed
pull/976/head
Collin Brown 4 years ago
parent
commit
f20212cb82
1 changed files with 9 additions and 9 deletions
  1. 18
      frontend/components/organisms/layout/TheSideBar.vue

18
frontend/components/organisms/layout/TheSideBar.vue

@ -53,8 +53,14 @@ export default {
data() { data() {
return { return {
selected: 0,
items: [
selected: 0
}
},
computed: {
...mapGetters('projects', ['loadSearchOptions']),
filteredItems() {
const items = [
{ icon: 'mdi-home', text: this.$t('projectHome.home'), link: '', adminOnly: false }, { icon: 'mdi-home', text: this.$t('projectHome.home'), link: '', adminOnly: false },
{ icon: 'mdi-database', text: this.$t('dataset.dataset'), link: 'dataset', adminOnly: true }, { icon: 'mdi-database', text: this.$t('dataset.dataset'), link: 'dataset', adminOnly: true },
{ icon: 'label', text: this.$t('labels.labels'), link: 'labels', adminOnly: true }, { icon: 'label', text: this.$t('labels.labels'), link: 'labels', adminOnly: true },
@ -62,13 +68,7 @@ export default {
{ icon: 'mdi-book-open-outline', text: this.$t('guideline.guideline'), link: 'guideline', adminOnly: true }, { icon: 'mdi-book-open-outline', text: this.$t('guideline.guideline'), link: 'guideline', adminOnly: true },
{ icon: 'mdi-chart-bar', text: this.$t('statistics.statistics'), link: 'statistics', adminOnly: true } { icon: 'mdi-chart-bar', text: this.$t('statistics.statistics'), link: 'statistics', adminOnly: true }
] ]
}
},
computed: {
...mapGetters('projects', ['loadSearchOptions']),
filteredItems() {
return this.items.filter(item => this.isVisible(item))
return items.filter(item => this.isVisible(item))
} }
}, },

Loading…
Cancel
Save