Bundle sudo actions into system task for cleaner permissions - some users may not be comfortable with this
This commit is contained in:
@ -52,10 +52,22 @@ export default class ConfirmationButton extends React.Component{
|
||||
if (this.state.confirming){
|
||||
className += ' confirming';
|
||||
content = this.props.confirmingContent;
|
||||
if (this.state.timing_out ) className += ' timing-out';
|
||||
if (this.state.timing_out){
|
||||
className += ' timing-out';
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.className ) className += ' '+this.props.className
|
||||
if (this.props.working){
|
||||
className += ' working';
|
||||
|
||||
if (this.props.workingContent){
|
||||
content = this.props.workingContent;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.className){
|
||||
className += ' '+this.props.className;
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
@ -8,8 +8,11 @@ export default function reducer(mopidy = {}, action){
|
||||
case 'MOPIDY_CONNECTING':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: true });
|
||||
|
||||
case 'MOPIDY_RESTARTING':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: true, restarting: true });
|
||||
|
||||
case 'MOPIDY_CONNECTED':
|
||||
return Object.assign({}, mopidy, { connected: true, connecting: false });
|
||||
return Object.assign({}, mopidy, { connected: true, connecting: false, restarting: false });
|
||||
|
||||
case 'MOPIDY_DISCONNECTED':
|
||||
return Object.assign({}, mopidy, { connected: false, connecting: false });
|
||||
|
||||
@ -265,23 +265,6 @@ const PusherMiddleware = (function(){
|
||||
})
|
||||
break;
|
||||
|
||||
case 'PUSHER_START_UPGRADE':
|
||||
ReactGA.event({ category: 'Pusher', action: 'Upgrade', label: '' })
|
||||
request(store, 'upgrade')
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch(uiActions.createNotification({content: response.message}));
|
||||
},
|
||||
error => {
|
||||
store.dispatch(coreActions.handleException(
|
||||
'Could not start upgrade',
|
||||
error
|
||||
));
|
||||
}
|
||||
);
|
||||
return next(action);
|
||||
break;
|
||||
|
||||
case 'PUSHER_SET_USERNAME':
|
||||
request(store, 'set_username', {username: action.username})
|
||||
.then(
|
||||
@ -490,6 +473,19 @@ 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
|
||||
@ -497,8 +493,16 @@ const PusherMiddleware = (function(){
|
||||
break
|
||||
|
||||
case 'PUSHER_RESTART_MOPIDY':
|
||||
store.dispatch(uiActions.createNotification({content: 'Restarting Mopidy...'}));
|
||||
request(store, 'restart');
|
||||
store.dispatch({type: 'MOPIDY_RESTARTING'});
|
||||
request(store, 'restart')
|
||||
.then(
|
||||
response => {
|
||||
store.dispatch(uiActions.createNotification({content: response.message}));
|
||||
},
|
||||
error => {
|
||||
store.dispatch(uiActions.createNotification({content: error.message, type: 'bad'}));
|
||||
}
|
||||
);
|
||||
break
|
||||
|
||||
case 'PUSHER_VERSION':
|
||||
|
||||
@ -266,7 +266,7 @@ class Settings extends React.Component {
|
||||
<div className="name">Reset</div>
|
||||
<div className="input">
|
||||
<ConfirmationButton className="destructive" content="Reset all settings" confirmingContent="Are you sure?" onConfirm={() => this.resetAllSettings()} />
|
||||
<ConfirmationButton className="destructive" content="Restart server" confirmingContent="Are you sure?" onConfirm={() => this.props.pusherActions.restartMopidy()} />
|
||||
<ConfirmationButton className="destructive" content="Restart server" confirmingContent="Are you sure?" workingContent="Restarting" working={this.props.mopidy.restarting} onConfirm={() => this.props.pusherActions.restartMopidy()} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user