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"
|
<li v-for="config, name in configSections" :key="name" class="entry"
|
||||||
:class="{selected: name === selectedConfigPanel}"
|
:class="{selected: name === selectedConfigPanel}"
|
||||||
:title="config.name" @click="$emit('select-config', name)">
|
:title="config.name" @click="$emit('select-config', name)">
|
||||||
<a href="/#settings">
|
<a :href="`/#settings?page=${name}`">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i :class="config.icon['class']" v-if="config.icon?.['class']" />
|
<i :class="config.icon['class']" v-if="config.icon?.['class']" />
|
||||||
<img :src="config.icon?.imgUrl" v-else-if="config.icon?.imgUrl" alt="name"/>
|
<img :src="config.icon?.imgUrl" v-else-if="config.icon?.imgUrl" alt="name"/>
|
||||||
|
|
|
@ -20,6 +20,7 @@ export default {
|
||||||
name: "Settings",
|
name: "Settings",
|
||||||
components: {Application, Users, Token},
|
components: {Application, Users, Token},
|
||||||
mixins: [Utils],
|
mixins: [Utils],
|
||||||
|
emits: ['change-page'],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
selectedPanel: {
|
selectedPanel: {
|
||||||
|
@ -41,8 +42,24 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
watch: {
|
||||||
this.refresh()
|
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>
|
</script>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<div class="canvas" v-if="selectedPanel === 'settings'">
|
<div class="canvas" v-if="selectedPanel === 'settings'">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<Settings :selected-panel="selectedConfigPanel" />
|
<Settings :selected-panel="selectedConfigPanel" @change-page="selectedConfigPanel = $event" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue