Revert "Make use of the new dynamic navItems feature in phoenix"

This reverts commit cdf1d89a63.
It was commited in this branch by accident.
This commit is contained in:
Benedikt Kulmann
2020-06-04 08:48:40 +02:00
parent cdf1d89a63
commit cf02e53703
2 changed files with 13 additions and 37 deletions

View File

File diff suppressed because one or more lines are too long

View File

@@ -37,7 +37,7 @@
</template>
<script>
import { mapActions, mapGetters, mapMutations } from 'vuex'
import { mapActions, mapGetters } from 'vuex'
import SettingsBundle from './SettingsBundle.vue'
export default {
name: 'SettingsApp',
@@ -49,7 +49,7 @@ export default {
}
},
computed: {
...mapGetters(['settingsValuesLoaded', 'getNavItems']),
...mapGetters(['settingsValuesLoaded']),
...mapGetters('Settings', [
'extensions',
'initialized',
@@ -59,7 +59,13 @@ export default {
return this.$route.params.extension
},
selectedExtensionName () {
return this.getExtensionName(this.selectedExtension)
// TODO: extensions need to be registered with display names, separate from the settings bundles. until then: hardcoded translation
if (this.selectedExtension === 'ocis-accounts') {
return 'Account'
} else if (this.selectedExtension === 'ocis-test') {
return 'Test'
}
return this.selectedExtension
},
selectedSettingsBundles () {
if (this.selectedExtension) {
@@ -70,7 +76,6 @@ export default {
},
methods: {
...mapActions('Settings', ['initialize']),
...mapMutations(['ADD_NAV_ITEM']),
resetSelectedExtension () {
if (this.extensions.length > 0) {
if (this.extensionRouteParam && this.extensions.includes(this.extensionRouteParam)) {
@@ -79,43 +84,14 @@ export default {
this.selectedExtension = this.extensions[0]
}
}
},
resetMenuItems () {
this.extensions.forEach(extension => {
/*
* TODO:
* a) set up a map with possible extensions and icons?
* or b) let extensions register app info like displayName + icon?
*/
const navItem = {
name: this.getExtensionName(extension),
iconMaterial: 'application',
route: {
name: 'settings',
path: `/${extension}`
}
}
this.ADD_NAV_ITEM({
extension: 'settings',
navItem
})
})
console.log(this.getNavItems('settings'))
},
getExtensionName (extension) {
switch (extension) {
case 'ocis-accounts': return this.$gettext('Account')
case 'ocis-hello': return this.$gettext('Hello')
default: return extension
}
}
},
async created () {
await this.initialize()
this.resetSelectedExtension()
},
watch: {
initialized () {
this.resetMenuItems()
this.resetSelectedExtension()
},
extensionRouteParam () {