[Partial error handling changes] [Standardize IPC replies]
This commit is contained in:
62
src/App.js
62
src/App.js
@@ -48,6 +48,9 @@ class App extends Component {
|
||||
AllowDownload: false,
|
||||
AutoMountChecked: false,
|
||||
ConfigStorageType: null,
|
||||
DisplayError: false,
|
||||
Error: null,
|
||||
ErrorAction: null,
|
||||
DownloadActive: false,
|
||||
DownloadProgress: 0.0,
|
||||
DownloadingDependency: false,
|
||||
@@ -280,27 +283,35 @@ class App extends Component {
|
||||
notifyMountsBusy = (busy) => {
|
||||
this.setState({MountsBusy: busy})
|
||||
};
|
||||
|
||||
|
||||
onCheckInstalledReply = (event, arg) => {
|
||||
const repertoryVersion = arg.data.Success && arg.data.Exists ? arg.data.Version : 'none';
|
||||
let versionAvailable = false;
|
||||
const action = () => {
|
||||
const repertoryVersion = arg.data.Success && arg.data.Exists ? arg.data.Version : 'none';
|
||||
let versionAvailable = false;
|
||||
|
||||
if (repertoryVersion !== 'none') {
|
||||
const latestVersion = this.state.VersionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
||||
let version = this.state.Version;
|
||||
if (version === -1) {
|
||||
version = latestVersion;
|
||||
if (repertoryVersion !== 'none') {
|
||||
const latestVersion = this.state.VersionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
||||
let version = this.state.Version;
|
||||
if (version === -1) {
|
||||
version = latestVersion;
|
||||
}
|
||||
versionAvailable = version !== latestVersion;
|
||||
}
|
||||
versionAvailable = version !== latestVersion;
|
||||
}
|
||||
|
||||
this.setState({
|
||||
AllowDownload: true,
|
||||
DownloadingDependency: false,
|
||||
MissingDependencies: arg.data.Dependencies,
|
||||
RepertoryVersion: repertoryVersion,
|
||||
VersionAvailable: versionAvailable,
|
||||
});
|
||||
this.setState({
|
||||
AllowDownload: true,
|
||||
DownloadingDependency: false,
|
||||
MissingDependencies: arg.data.Dependencies,
|
||||
RepertoryVersion: repertoryVersion,
|
||||
VersionAvailable: versionAvailable,
|
||||
});
|
||||
};
|
||||
|
||||
if (arg.data.Success) {
|
||||
action();
|
||||
} else {
|
||||
this.setErrorState(arg.data.Error, action);
|
||||
}
|
||||
};
|
||||
|
||||
onDownloadFileComplete = (event, arg) => {
|
||||
@@ -506,6 +517,14 @@ class App extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
setErrorState = (error, action) => {
|
||||
this.setState({
|
||||
DisplayError: true,
|
||||
Error: error,
|
||||
ErrorAction: action,
|
||||
});
|
||||
};
|
||||
|
||||
updateCheckScheduledJob = () => {
|
||||
if (this.state.Platform !== 'unknown') {
|
||||
if (ipcRenderer) {
|
||||
@@ -537,12 +556,18 @@ class App extends Component {
|
||||
this.state.ConfigStorageType &&
|
||||
allowConfig;
|
||||
|
||||
const showUpgrade = !showConfig &&
|
||||
const showUpgrade = !this.state.DisplayError &&
|
||||
!showConfig &&
|
||||
!missingDependencies &&
|
||||
!this.state.DownloadActive &&
|
||||
this.state.UpgradeAvailable &&
|
||||
!this.state.UpgradeDismissed;
|
||||
|
||||
let errorDisplay = null;
|
||||
if (this.state.DisplayError) {
|
||||
|
||||
}
|
||||
|
||||
let configDisplay = null;
|
||||
if (showConfig) {
|
||||
configDisplay = (
|
||||
@@ -664,6 +689,7 @@ class App extends Component {
|
||||
|
||||
return (
|
||||
<div styleName='App'>
|
||||
{errorDisplay}
|
||||
{dependencyDisplay}
|
||||
{upgradeDisplay}
|
||||
{downloadDisplay}
|
||||
|
||||
@@ -277,7 +277,7 @@ class Configuration extends Component {
|
||||
<h1 style={{width: '100%', textAlign: 'center'}}>{this.props.storageType + ' Configuration'}</h1>
|
||||
<div style={{overflowY: 'auto', height: '90%'}}>
|
||||
{objectItems}
|
||||
<h1>Settings</h1>
|
||||
{(configurationItems.length > 0) ? <h1>Settings</h1> : null}
|
||||
{configurationItems}
|
||||
</div>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user