forked from platypush/platypush
[UI] Persist current settings page on the URL.
This commit is contained in:
parent
91f6beb349
commit
a8343cb45b
3 changed files with 21 additions and 4 deletions
|
@ -19,7 +19,7 @@
|
|||
<li v-for="config, name in configSections" :key="name" class="entry"
|
||||
:class="{selected: name === selectedConfigPanel}"
|
||||
:title="config.name" @click="$emit('select-config', name)">
|
||||
<a href="/#settings">
|
||||
<a :href="`/#settings?page=${name}`">
|
||||
<span class="icon">
|
||||
<i :class="config.icon['class']" v-if="config.icon?.['class']" />
|
||||
<img :src="config.icon?.imgUrl" v-else-if="config.icon?.imgUrl" alt="name"/>
|
||||
|
|
|
@ -20,6 +20,7 @@ export default {
|
|||
name: "Settings",
|
||||
components: {Application, Users, Token},
|
||||
mixins: [Utils],
|
||||
emits: ['change-page'],
|
||||
|
||||
props: {
|
||||
selectedPanel: {
|
||||
|
@ -41,8 +42,24 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.refresh()
|
||||
watch: {
|
||||
selectedPanel(value) {
|
||||
this.setUrlArgs({page: value})
|
||||
},
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
const args = this.getUrlArgs()
|
||||
let page = null
|
||||
if (args.page?.length) {
|
||||
page = args.page
|
||||
} else {
|
||||
page = this.selectedPanel?.length ? this.selectedPanel : 'users'
|
||||
}
|
||||
|
||||
this.$emit('change-page', page)
|
||||
await this.refresh()
|
||||
this.setUrlArgs({page: this.selectedPanel})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<div class="canvas" v-if="selectedPanel === 'settings'">
|
||||
<div class="panel">
|
||||
<Settings :selected-panel="selectedConfigPanel" />
|
||||
<Settings :selected-panel="selectedConfigPanel" @change-page="selectedConfigPanel = $event" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue