diff --git a/src/components/pages/PbxConfiguration/CscPbxSeat.vue b/src/components/pages/PbxConfiguration/CscPbxSeat.vue index 2685786c..ed5912ff 100644 --- a/src/components/pages/PbxConfiguration/CscPbxSeat.vue +++ b/src/components/pages/PbxConfiguration/CscPbxSeat.vue @@ -200,7 +200,8 @@ 'seat', 'aliasNumberOptions', 'groupOptions', - 'loading' + 'loading', + 'callQueue' ], data () { return { @@ -459,7 +460,7 @@ }, watch: { seat() { - this.changes = this.getSeat() + this.changes = this.getSeat(); } } } diff --git a/src/store/pbx-config/actions.js b/src/store/pbx-config/actions.js index 2b935b2b..b3b69991 100644 --- a/src/store/pbx-config/actions.js +++ b/src/store/pbx-config/actions.js @@ -77,6 +77,9 @@ export default { context.commit('groupReloading', group); getGroup(group.id).then(($group)=>{ context.commit('groupReloaded', $group); + return $group; + }).then((data) => { + context.dispatch('loadCallQueueForGroup', data.id); }).catch((err)=>{ context.commit('groupReloadingFailed', { group: group, @@ -215,8 +218,11 @@ export default { reloadSeat(context, seat) { return new Promise((resolve, reject)=>{ context.commit('seatReloading', seat); - getSeat(seat.id).then(($seat)=>{ + getSeat(seat.id).then(($seat) => { context.commit('seatReloaded', $seat); + return $seat; + }).then((data) => { + context.dispatch('loadCallQueueForSeat', data.id); }).catch((err)=>{ context.commit('seatReloadingFailed', { seat: seat, diff --git a/src/store/pbx-config/mutations.js b/src/store/pbx-config/mutations.js index d3cd853c..4a67bec7 100644 --- a/src/store/pbx-config/mutations.js +++ b/src/store/pbx-config/mutations.js @@ -422,9 +422,11 @@ export default { state.callQueueGroupsAndSeats[config.id] = config; state.callQueueGroupsAndSeatsOrdered.push(config); }); - state.callQueueGroupsAndSeats = state.callQueueGroupsAndSeats.filter((item) => { - return (item !== (undefined || null || '')); - }); + if (state.callQueueGroupsAndSeats.length > 0) { + state.callQueueGroupsAndSeats = state.callQueueGroupsAndSeats.filter((item) => { + return (item !== (undefined || null || '')); + }); + } }, callQueueListFailed(state, error) { state.listState = RequestState.failed; @@ -440,7 +442,8 @@ export default { state.configReloadingError = null; Vue.set(state.callQueueGroupsAndSeats, config.id, config); for (let i = 0; i < state.callQueueGroupsAndSeatsOrdered.length; i++) { - if (state.callQueueGroupsAndSeatsOrdered[i].id === config.id) { + let callQueueState = state.callQueueGroupsAndSeatsOrdered[i]; + if (callQueueState && (state.callQueueGroupsAndSeatsOrdered[i].id === config.id)) { state.callQueueGroupsAndSeatsOrdered[i] = config; } } @@ -457,8 +460,9 @@ export default { reactiveSet(state[data.type + 'States'], id, RequestState.succeeded); reactiveSet(state[data.type + 'Errors'], id, null); Vue.set(state[data.type + 's'], id, Object.assign(state[data.type + 's'][id], data.preferences)); - for(let i = 0; i <= state[data.type + 'sOrdered'].length; i++) { - if(state[data.type + 'sOrdered'][i].id === data.preferences.id) { + for (let i = 0; i <= state[data.type + 'sOrdered'].length; i++) { + let subscriberState = state[data.type + 'sOrdered'][i]; + if (subscriberState && (state[data.type + 'sOrdered'][i].id === data.preferences.id)) { state[data.type + 'sOrdered'][i] = Object.assign(state[data.type + 'sOrdered'][i], data.preferences); } }