show multi channel settings only when is active

This commit is contained in:
jonathan 2021-06-04 11:57:13 +02:00
parent 3c58745d37
commit e237563e74
3 changed files with 18 additions and 9 deletions

View File

@ -20,13 +20,17 @@
<b-nav-item to="/configure" exact-active-class="active-menu-item">
Configure
</b-nav-item>
<b-nav-text>&nbsp;&nbsp;</b-nav-text>
<b-nav-item-dropdown :text="configGui[configID].channel" right>
<b-nav-text v-if="multiChannel">
&nbsp;&nbsp;
</b-nav-text>
<b-nav-item-dropdown v-if="multiChannel" :text="configGui[configID].channel" right>
<b-dropdown-item v-for="(channel, index) in configGui" :key="channel.key" @click="selectChannel(index)">
{{ channel.channel }}
</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-text>&nbsp;&nbsp;</b-nav-text>
<b-nav-text v-if="multiChannel">
&nbsp;&nbsp;
</b-nav-text>
<b-nav-item to="/" @click="logout()">
Logout
</b-nav-item>
@ -42,7 +46,7 @@ export default {
name: 'Menu',
computed: {
...mapState('config', ['configID', 'configGui'])
...mapState('config', ['configID', 'configGui', 'multiChannel'])
},
methods: {

View File

@ -15,7 +15,7 @@
>
<div style="width: 100%; height: 43px;">
<div class="float-right">
<b-button size="sm" variant="primary" class="m-md-2" @click="addChannel()">
<b-button v-if="multiChannel" size="sm" variant="primary" class="m-md-2" @click="addChannel()">
Add new Channel
</b-button>
</div>
@ -56,7 +56,7 @@
<b-button type="submit" variant="primary">
Save
</b-button>
<b-button variant="danger" @click="deleteChannel()">
<b-button v-if="multiChannel && configGui[configID].id > 1" variant="danger" @click="deleteChannel()">
Delete
</b-button>
</b-button-group>
@ -255,7 +255,7 @@ export default {
},
computed: {
...mapState('config', ['configID', 'netChoices']),
...mapState('config', ['configID', 'netChoices', 'multiChannel']),
configGui: {
get () {
return this.$store.state.config.configGui

View File

@ -11,7 +11,8 @@ export const state = () => ({
configPlayout: {},
currentUser: null,
configUser: null,
timezone: 'UTC'
timezone: 'UTC',
multiChannel: false
})
export const mutations = {
@ -47,6 +48,9 @@ export const mutations = {
},
UPDATE_TIMEZONE (state, zone) {
state.timezone = zone
},
UPDATE_MULTI_CHANNEL (state, bool) {
state.multiChannel = bool
}
}
@ -62,10 +66,11 @@ export const actions = {
},
async getTimezone ({ commit, state }) {
const response = await this.$axios.get('api/player/stats/?stats=timezone')
const response = await this.$axios.get('api/player/stats/?stats=settings')
if (response.data) {
commit('UPDATE_TIMEZONE', response.data.timezone)
commit('UPDATE_MULTI_CHANNEL', response.data.multi_channel)
} else {
commit('UPDATE_TIMEZONE', this.$dayjs.tz.guess())
}