Auto-restart on unexpected failure

This commit is contained in:
Scott E. Graves
2018-11-06 15:41:51 -06:00
parent 9fb07b80bc
commit 7eb1bbe804
4 changed files with 96 additions and 5 deletions

View File

@@ -62,6 +62,7 @@ class App extends Component {
ExtractActive: false,
Hyperspace: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
},
LocationsLookup: {},
@@ -78,10 +79,12 @@ class App extends Component {
InstalledVersion: 'none',
Sia: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
},
SiaPrime: {
AutoMount: false,
AutoRestart: false,
MountLocation: '',
},
UpgradeAvailable: false,
@@ -180,27 +183,68 @@ class App extends Component {
...this.state.Hyperspace
};
this.saveState(this.state.Release, this.state.Version, sia, hyperspace, siaPrime);
if (storageType === 'Hyperspace') {
hyperspace.AutoMount = e.target.checked;
this.setState({
Hyperspace: hyperspace,
}, ()=> {
this.saveState(this.state.Release, this.state.Version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
});
} else if (storageType === 'Sia') {
sia.AutoMount = e.target.checked;
this.setState({
Sia: sia,
}, ()=> {
this.saveState(this.state.Release, this.state.Version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
});
} else if (storageType === 'SiaPrime') {
siaPrime.AutoMount = e.target.checked;
this.setState({
SiaPrime: siaPrime,
}, ()=> {
this.saveState(this.state.Release, this.state.Version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
});
}
};
handleAutoRestartChanged = (storageType, e) => {
let sia = {
...this.state.Sia
};
let siaPrime = {
...this.state.SiaPrime
};
let hyperspace = {
...this.state.Hyperspace
};
if (storageType === 'Hyperspace') {
hyperspace.AutoRestart = e.target.checked;
this.setState({
Hyperspace: hyperspace,
}, ()=> {
this.saveState(this.state.Release, this.state.Version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
});
} else if (storageType === 'Sia') {
sia.AutoRestart = e.target.checked;
this.setState({
Sia: sia,
}, ()=> {
this.saveState(this.state.Release, this.state.Version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
});
} else if (storageType === 'SiaPrime') {
siaPrime.AutoRestart = e.target.checked;
this.setState({
SiaPrime: siaPrime,
}, ()=> {
this.saveState(this.state.Release, this.state.Version, this.state.Sia, this.state.Hyperspace, this.state.SiaPrime);
});
}
};
handleConfigClicked = (storageType) => {
this.setState({
ConfigStorageType: storageType,
@@ -426,16 +470,25 @@ class App extends Component {
if (hyperspace.AutoMount === undefined) {
hyperspace['AutoMount'] = false;
}
if (hyperspace.AutoRestart === undefined) {
hyperspace['AutoRestart'] = false;
}
let sia = arg.data.Sia || this.state.Sia;
if (sia.AutoMount === undefined) {
sia['AutoMount'] = false;
}
if (sia.AutoRestart === undefined) {
sia['AutoRestart'] = false;
}
let siaPrime = arg.data.SiaPrime || this.state.SiaPrime;
if (siaPrime.AutoMount === undefined) {
siaPrime['AutoMount'] = false;
}
if (siaPrime.AutoRestart === undefined) {
siaPrime['AutoRestart'] = false;
}
this.setState({
Hyperspace: hyperspace,
@@ -683,10 +736,11 @@ class App extends Component {
if (allowMount) {
mainContent.push((
<div key={'md_' + key++}
style={{height: '66%'}}>
style={{height: '69%'}}>
<MountItems allowConfig={allowConfig}
autoMountChanged={this.handleAutoMountChanged}
autoMountProcessed={this.notifyAutoMountProcessed}
autoRestartChanged={this.handleAutoRestartChanged}
changed={this.handleMountLocationChanged}
configClicked={this.handleConfigClicked}
directory={Constants.DATA_LOCATIONS[this.props.platform]}