@ -35,7 +35,8 @@ import {
addCallQueueConfig ,
setQueueLengthConfig ,
setWrapUpTimeConfig ,
getConfig
getConfig ,
removeCallQueue
} from '../../api/pbx-config'
export default {
@ -435,6 +436,12 @@ export default {
let config = Object . assign ( data . config , {
cloud _pbx _callqueue : true
} ) ;
if ( ! _ . isNull ( config . max _queue _length ) && config . max _queue _length . length === 0 ) {
config . max _queue _length = null ;
}
if ( ! _ . isNull ( config . queue _wrap _up _time ) && config . queue _wrap _up _time . length === 0 ) {
config . queue _wrap _up _time = null ;
}
context . commit ( 'addItemRequesting' , config ) ;
addCallQueueConfig ( data . id , config ) . then ( ( ) => {
return context . dispatch ( 'listCallQueueGroupsAndSeats' , true ) ;
@ -462,9 +469,14 @@ export default {
} ) ;
} ,
setQueueLength ( context , subscriber ) {
context . commit ( 'updateItemRequesting' , subscriber ) ;
setQueueLengthConfig ( subscriber . id , subscriber . max _queue _length ) . then ( ( ) => {
return context . dispatch ( 'reloadConfig' , subscriber ) ;
let updateItem = {
id : subscriber . id ,
max _queue _length : subscriber . max _queue _length || 5 ,
queue _wrap _up _time : subscriber . queue _wrap _up _time || 10
} ;
context . commit ( 'updateItemRequesting' , updateItem ) ;
setQueueLengthConfig ( updateItem . id , updateItem . max _queue _length ) . then ( ( ) => {
return context . dispatch ( 'reloadConfig' , updateItem ) ;
} ) . then ( ( ) => {
context . commit ( 'updateItemSucceeded' ) ;
} ) . catch ( ( err ) => {
@ -472,13 +484,28 @@ export default {
} ) ;
} ,
setWrapUpTime ( context , subscriber ) {
context . commit ( 'updateItemRequesting' , subscriber ) ;
setWrapUpTimeConfig ( subscriber . id , subscriber . queue _wrap _up _time ) . then ( ( ) => {
return context . dispatch ( 'reloadConfig' , subscriber ) ;
let updateItem = {
id : subscriber . id ,
max _queue _length : subscriber . max _queue _length || 5 ,
queue _wrap _up _time : subscriber . queue _wrap _up _time || 10
} ;
context . commit ( 'updateItemRequesting' , updateItem ) ;
setWrapUpTimeConfig ( updateItem . id , updateItem . queue _wrap _up _time ) . then ( ( ) => {
return context . dispatch ( 'reloadConfig' , updateItem ) ;
} ) . then ( ( ) => {
context . commit ( 'updateItemSucceeded' ) ;
} ) . catch ( ( err ) => {
context . commit ( 'updateItemFailed' , err . message ) ;
} ) ;
} ,
removeCallQueue ( context , config ) {
context . commit ( 'removeItemRequesting' , config ) ;
removeCallQueue ( config . id ) . then ( ( ) => {
return context . dispatch ( 'listCallQueueGroupsAndSeats' , true ) ;
} ) . then ( ( ) => {
context . commit ( 'removeItemSucceeded' ) ;
} ) . catch ( ( err ) => {
context . commit ( 'removeItemFailed' , err . message ) ;
} ) ;
}
}