Upgrade and restart as separate system file

This commit is contained in:
James Barnsley
2018-04-16 21:58:38 +12:00
parent b3007b7bd5
commit 23dd955d6d
8 changed files with 23522 additions and 25400 deletions

View File

@ -8,11 +8,14 @@ export default function reducer(mopidy = {}, action){
case 'MOPIDY_CONNECTING':
return Object.assign({}, mopidy, { connected: false, connecting: true });
case 'MOPIDY_RESTARTING':
case 'PUSHER_RESTART_MOPIDY':
return Object.assign({}, mopidy, { connected: false, connecting: true, restarting: true });
case 'PUSHER_START_UPGRADE':
return Object.assign({}, mopidy, { upgrading: true });
case 'MOPIDY_CONNECTED':
return Object.assign({}, mopidy, { connected: true, connecting: false, restarting: false });
return Object.assign({}, mopidy, { connected: true, connecting: false, restarting: false, upgrading: false });
case 'MOPIDY_DISCONNECTED':
return Object.assign({}, mopidy, { connected: false, connecting: false });

View File

@ -473,19 +473,6 @@ const PusherMiddleware = (function(){
store.dispatch(uiActions.createNotification(data));
break
case 'PUSHER_START_UPGRADE':
ReactGA.event({ category: 'Pusher', action: 'Upgrade', label: '' })
request(store, 'start_upgrade')
.then(
response => {
store.dispatch(uiActions.createNotification({content: response.message}));
},
error => {
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
}
);
break;
case 'PUSHER_RESTART':
// Hard reload. This doesn't strictly clear the cache, but our compiler's
// cache buster should handle that
@ -493,25 +480,39 @@ const PusherMiddleware = (function(){
break
case 'PUSHER_RESTART_MOPIDY':
store.dispatch({type: 'MOPIDY_RESTARTING'});
request(store, 'restart')
.then(
response => {
store.dispatch(uiActions.createNotification({content: response.message}));
// No notification required
},
error => {
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
}
);
next(action);
break
case 'PUSHER_START_UPGRADE':
ReactGA.event({ category: 'Pusher', action: 'Upgrade', label: '' });
request(store, 'start_upgrade')
.then(
response => {
// No notification required
},
error => {
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
}
);
next(action);
break;
case 'PUSHER_VERSION':
ReactGA.event({ category: 'Pusher', action: 'Version', label: action.version.current })
if (action.version.upgrade_available){
store.dispatch(uiActions.createNotification({content: 'Version '+action.version.latest+' is available. See settings to upgrade.'}));
}
next(action )
next(action);
break
case 'PUSHER_CONFIG':