Testing restarter

This commit is contained in:
James Barnsley
2018-04-16 09:01:42 +12:00
parent 68c89d0070
commit 55ade30130
8 changed files with 94 additions and 57 deletions

View File

@ -31,7 +31,13 @@ export function disconnect(){
export function startUpgrade(){
return {
type: 'START_UPGRADE'
type: 'PUSHER_START_UPGRADE'
}
}
export function restartMopidy(){
return {
type: 'PUSHER_RESTART_MOPIDY'
}
}

View File

@ -270,16 +270,9 @@ const PusherMiddleware = (function(){
request(store, 'upgrade')
.then(
response => {
if (response.upgrade_successful){
store.dispatch(uiActions.createNotification({content: 'Upgrade complete'}));
} else {
store.dispatch(uiActions.createNotification({content: 'Upgrade failed, please upgrade manually', type: 'bad'}));
}
response.type = 'PUSHER_VERSION'
store.dispatch(response)
store.dispatch(uiActions.createNotification({content: response.message}));
},
error => {
error => {
store.dispatch(coreActions.handleException(
'Could not start upgrade',
error
@ -503,6 +496,11 @@ const PusherMiddleware = (function(){
window.location.reload(true);
break
case 'PUSHER_RESTART_MOPIDY':
store.dispatch(uiActions.createNotification({content: 'Restarting Mopidy...'}));
request(store, 'restart');
break
case 'PUSHER_VERSION':
ReactGA.event({ category: 'Pusher', action: 'Version', label: action.version.current })