System script, implement deley to alert other users; UI

This commit is contained in:
James Barnsley
2018-04-17 15:58:39 +12:00
parent 23dd955d6d
commit c48d07a8cd
10 changed files with 25481 additions and 23589 deletions

View File

@ -14,6 +14,24 @@ export function connect(){
}
}
export function connecting(){
return {
type: 'MOPIDY_CONNECTING'
}
}
export function upgradeStarted(){
return {
type: 'MOPIDY_UPGRADE_STARTED'
}
}
export function restartStarted(){
return {
type: 'MOPIDY_RESTART_STARTED'
}
}
export function disconnect(){
return {
type: 'MOPIDY_DISCONNECT'

View File

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

View File

@ -4,6 +4,7 @@ import ReactGA from 'react-ga'
var helpers = require('../../helpers.js')
var coreActions = require('../core/actions.js')
var uiActions = require('../ui/actions.js')
var mopidyActions = require('../mopidy/actions.js')
var pusherActions = require('./actions.js')
var lastfmActions = require('../lastfm/actions.js')
var spotifyActions = require('../spotify/actions.js')
@ -92,9 +93,15 @@ const PusherMiddleware = (function(){
case 'radio_stopped':
store.dispatch(pusherActions.radioStopped());
break;
case 'restart':
case 'refresh':
window.location.reload(true);
break;
case 'update_started':
store.dispatch(uiActions.createNotification({content: 'Update running...', type: 'info'}));
break;
case 'restart_started':
store.dispatch(uiActions.createNotification({content: 'Restarting...', type: 'info'}));
break;
}
}
}
@ -483,27 +490,26 @@ const PusherMiddleware = (function(){
request(store, 'restart')
.then(
response => {
// No notification required
store.dispatch(mopidyActions.restartStarted());
},
error => {
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
store.dispatch(uiActions.createNotification({content: error.message, description: (error.description ? error.description : null), type: 'bad'}));
}
);
next(action);
break
case 'PUSHER_START_UPGRADE':
case 'PUSHER_UPGRADE':
ReactGA.event({ category: 'Pusher', action: 'Upgrade', label: '' });
request(store, 'start_upgrade')
request(store, 'upgrade')
.then(
response => {
// No notification required
store.dispatch(mopidyActions.upgradeStarted());
},
error => {
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
}
);
next(action);
break;
case 'PUSHER_VERSION':

View File

@ -7,7 +7,6 @@ import FontAwesome from 'react-fontawesome'
import ConfirmationButton from '../components/ConfirmationButton'
import PusherConnectionList from '../components/PusherConnectionList'
import VersionManager from '../components/VersionManager'
import Header from '../components/Header'
import Parallax from '../components/Parallax'
import Icon from '../components/Icon'