Testing restarter
This commit is contained in:
@ -15,9 +15,11 @@ class VersionManager extends React.Component{
|
||||
}
|
||||
|
||||
renderUpgradeButton(){
|
||||
return <button className="productive" onClick={() => this.props.pusherActions.startUpgrade()}>Upgrade to { this.props.pusher.version.latest }</button>
|
||||
|
||||
if (this.props.pusher.upgrading){
|
||||
return (
|
||||
<button className="outline" disabled>
|
||||
<button className="productive working" disabled>
|
||||
<FontAwesome name="circle-o-notch" spin />
|
||||
|
||||
Upgrading
|
||||
@ -25,22 +27,18 @@ class VersionManager extends React.Component{
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.props.pusher.version.is_root){
|
||||
return <button className="outline" disabled>Not running as root</button>
|
||||
}
|
||||
|
||||
if (this.props.pusher.version.upgrade_available){
|
||||
return <button className="primary" onClick={() => this.props.pusherActions.startUpgrade()}>Upgrade to { this.props.pusher.version.latest }</button>
|
||||
return <button className="productive" onClick={() => this.props.pusherActions.startUpgrade()}>Upgrade to { this.props.pusher.version.latest }</button>
|
||||
}
|
||||
|
||||
return <button className="outline" disabled>No updates available</button>
|
||||
return <button className="secondary" disabled>Already up-to-date</button>
|
||||
}
|
||||
|
||||
render(){
|
||||
return (
|
||||
<span className="version-manager">
|
||||
{ this.renderUpgradeButton() }
|
||||
<span className="description">{ this.props.pusher.version.current } installed</span>
|
||||
<span>{ this.props.pusher.version.current } installed</span>
|
||||
{this.renderUpgradeButton()}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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 })
|
||||
|
||||
|
||||
@ -266,6 +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()} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user