Collecting output from pip upgrade and returning to user
This commit is contained in:
@ -20,15 +20,15 @@ export function connecting(){
|
||||
}
|
||||
}
|
||||
|
||||
export function upgradeStarted(){
|
||||
export function upgrading(){
|
||||
return {
|
||||
type: 'MOPIDY_UPGRADE_STARTED'
|
||||
type: 'MOPIDY_UPGRADING'
|
||||
}
|
||||
}
|
||||
|
||||
export function restartStarted(){
|
||||
export function restarting(){
|
||||
return {
|
||||
type: 'MOPIDY_RESTART_STARTED'
|
||||
type: 'MOPIDY_RESTARTING'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,10 +8,10 @@ export default function reducer(mopidy = {}, action){
|
||||
case 'MOPIDY_CONNECTING':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: true });
|
||||
|
||||
case 'MOPIDY_RESTART_STARTED':
|
||||
case 'MOPIDY_RESTARTING':
|
||||
return Object.assign({}, mopidy, { restarting: true });
|
||||
|
||||
case 'MOPIDY_UPGRADE_STARTED':
|
||||
case 'MOPIDY_UPGRADING':
|
||||
return Object.assign({}, mopidy, { upgrading: true });
|
||||
|
||||
case 'MOPIDY_CONNECTED':
|
||||
|
||||
@ -29,15 +29,21 @@ export function disconnect(){
|
||||
}
|
||||
}
|
||||
|
||||
export function startUpgrade(){
|
||||
export function upgrade(){
|
||||
return {
|
||||
type: 'PUSHER_START_UPGRADE'
|
||||
type: 'PUSHER_UPGRADE'
|
||||
}
|
||||
}
|
||||
|
||||
export function restartMopidy(){
|
||||
export function reload(){
|
||||
return {
|
||||
type: 'PUSHER_RESTART_MOPIDY'
|
||||
type: 'PUSHER_RELOAD'
|
||||
}
|
||||
}
|
||||
|
||||
export function restart(){
|
||||
return {
|
||||
type: 'PUSHER_RESTART'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -93,13 +93,13 @@ const PusherMiddleware = (function(){
|
||||
case 'radio_stopped':
|
||||
store.dispatch(pusherActions.radioStopped());
|
||||
break;
|
||||
case 'refresh':
|
||||
case 'reload':
|
||||
window.location.reload(true);
|
||||
break;
|
||||
case 'update_started':
|
||||
store.dispatch(uiActions.createNotification({content: 'Update running...', type: 'info'}));
|
||||
case 'upgrading':
|
||||
store.dispatch(uiActions.createNotification({content: 'Upgrading...', type: 'info'}));
|
||||
break;
|
||||
case 'restart_started':
|
||||
case 'restarting':
|
||||
store.dispatch(uiActions.createNotification({content: 'Restarting...', type: 'info'}));
|
||||
break;
|
||||
}
|
||||
@ -472,17 +472,17 @@ const PusherMiddleware = (function(){
|
||||
store.dispatch(uiActions.createNotification(data));
|
||||
break
|
||||
|
||||
case 'PUSHER_RESTART':
|
||||
case 'PUSHER_RELOAD':
|
||||
// Hard reload. This doesn't strictly clear the cache, but our compiler's
|
||||
// cache buster should handle that
|
||||
window.location.reload(true);
|
||||
break
|
||||
|
||||
case 'PUSHER_RESTART_MOPIDY':
|
||||
case 'PUSHER_RESTART':
|
||||
request(store, 'restart')
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch(mopidyActions.restartStarted());
|
||||
store.dispatch(mopidyActions.restarting());
|
||||
},
|
||||
error => {
|
||||
store.dispatch(uiActions.createNotification({content: error.message, description: (error.description ? error.description : null), type: 'bad'}));
|
||||
@ -496,7 +496,7 @@ const PusherMiddleware = (function(){
|
||||
request(store, 'upgrade')
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch(mopidyActions.upgradeStarted());
|
||||
store.dispatch(mopidyActions.upgrading());
|
||||
},
|
||||
error => {
|
||||
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
|
||||
|
||||
@ -151,9 +151,9 @@ class Settings extends React.Component {
|
||||
</button>
|
||||
);
|
||||
} else if (this.props.pusher.version.upgrade_available){
|
||||
var upgrade_button = <button className="alternative" onClick={() => this.props.pusherActions.startUpgrade()}>Upgrade to { this.props.pusher.version.latest }</button>
|
||||
var upgrade_button = <button className="alternative" onClick={e => this.props.pusherActions.upgrade()}>Upgrade to { this.props.pusher.version.latest }</button>;
|
||||
} else {
|
||||
var upgrade_button = null;
|
||||
var upgrade_button = <button className="alternative" onClick={e => this.props.pusherActions.upgrade()}>Already up-to-date</button>;
|
||||
}
|
||||
|
||||
return (
|
||||
@ -278,7 +278,7 @@ class Settings extends React.Component {
|
||||
|
||||
<div className="field">
|
||||
{upgrade_button}
|
||||
<button className={"destructive"+(this.props.mopidy.restarting ? ' working' : '')} onClick={e => this.props.pusherActions.restartMopidy()}>{this.props.mopidy.restarting ? 'Restarting...' : 'Restart server'}</button>
|
||||
<button className={"destructive"+(this.props.mopidy.restarting ? ' working' : '')} onClick={e => this.props.pusherActions.restart()}>{this.props.mopidy.restarting ? 'Restarting...' : 'Restart server'}</button>
|
||||
<ConfirmationButton className="destructive" content="Reset all settings" confirmingContent="Are you sure?" onConfirm={() => this.resetAllSettings()} />
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user