maxgui/src/store/monitor.js
/**
         * @param {String} id id of the monitor to be manipulated
         * @param {String} mode Mode to manipulate the monitor ( destroy, stop, start)
         * @param {Function} callback callback function after successfully updated
         */
@param {String} id id of the monitor to be manipulated
@param {String} mode Mode to manipulate the monitor ( destroy, stop, start)
@param {Function} callback callback function after successfully updated
@param { String } id id of the monitor to be manipulated @param { String } mode Mode to manipulate the monitor ( destroy stop start ) @param { Function } callback callback function after successfully updated
async manipulateMonitor({ commit }, { id, mode, callback }) {
            try {
                let res, message
                switch (mode) {
                    case 'destroy':
                        res = await this.vue.$axios.delete(`/monitors/${id}?force=yes`)
                        message = [`Monitor ${id} is destroyed`]
                        break
                    case 'stop':
                        res = await this.vue.$axios.put(`/monitors/${id}/stop`)
                        message = [`Monitor ${id} is stopped`]
                        break
                    case 'start':
                        res = await this.vue.$axios.put(`/monitors/${id}/start`)
                        message = [`Monitor ${id} is started`]
                        break
                }
                if (res.status === 204) {
                    commit(
                        'SET_SNACK_BAR_MESSAGE',
                        {
                            text: message,
                            type: 'success',
                        },
                        { root: true }
                    )
                    if (this.vue.$help.isFunction(callback)) await callback()
                }
            } catch (e) {
                const logger = this.vue.$logger('store-monitor-manipulateMonitor')
                logger.error(e)
            }
        }
async manipulateMonitor ( { commit } , { id , mode , callback } ) { try { let res , message switch ( mode ) { case 'destroy' : res = await this . vue . $axios . delete ( ` ${ id } ` ) message = [ ` ${ id } ` ] break case 'stop' : res = await this . vue . $axios . put ( ` ${ id } ` ) message = [ ` ${ id } ` ] break case 'start' : res = await this . vue . $axios . put ( ` ${ id } ` ) message = [ ` ${ id } ` ] break } if ( res . status === 204 ) { commit ( 'SET_SNACK_BAR_MESSAGE' , { text : message , type : 'success' , } , { root : true } ) if ( this . vue . $help . isFunction ( callback ) ) await callback ( ) } } catch ( e ) { const logger = this . vue . $logger ( 'store-monitor-manipulateMonitor' ) logger . error ( e ) } }
@param {String} id id of the monitor to be manipulated
 @param {String} mode Mode to manipulate the monitor ( destroy, stop, start)
 @param {Function} callback callback function after successfully updated
@param { String } id id of the monitor to be manipulated @param { String } mode Mode to manipulate the monitor ( destroy stop start ) @param { Function } callback callback function after successfully updated
/*  Destroy a created monitor.
                        The monitor must not have relationships to any servers in order to be destroyed. */ //Stops a started monitor. //Starts a stopped monitor. // response ok