diff --git a/src/App.js b/src/App.js index 2f46cb3..e7685dd 100644 --- a/src/App.js +++ b/src/App.js @@ -16,9 +16,9 @@ import Text from './components/UI/Text/Text'; import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon'; import UpgradeUI from './components/UpgradeUI/UpgradeUI'; import {setProviderState} from './redux/actions/mount_actions'; -import {detectUIUpgrade, loadReleases, setActiveRelease, setDismissUIUpgrade, setReleaseUpgradeAvailable} from './redux/actions/release_version_actions'; +import {detectUIUpgrade, loadReleases, setActiveRelease, setDismissUIUpgrade, setInstalledVersion, setReleaseUpgradeAvailable} from './redux/actions/release_version_actions'; import {downloadItem, setAllowDownload} from './redux/actions/download_actions'; -import {installDependency, installRelease, installUpgrade} from './redux/actions/install_actions'; +import {installDependency, installRelease, installUpgrade, setMissingDependencies} from './redux/actions/install_actions'; import {notifyError} from './redux/actions/error_actions'; const Constants = require('./constants'); @@ -32,11 +32,6 @@ class App extends IPCContainer { this.setRequestHandler(Constants.IPC_Get_State_Reply, this.onGetStateReply); } - state = { - MissingDependencies: [], - InstalledVersion: 'none', - }; - checkVersionInstalled = () => { this.props.setAllowDownload(false); const selectedVersion = this.getSelectedVersion(); @@ -152,11 +147,8 @@ class App extends IPCContainer { } this.props.setReleaseUpgradeAvailable(upgradeAvailable); this.props.setAllowDownload(true); - - this.setState({ - MissingDependencies: arg.data.Dependencies, - InstalledVersion: installedVersion, - }); + this.props.setInstalledVersion(installedVersion); + this.props.setMissingDependencies(arg.data.Dependencies); }; if (arg.data.Success) { @@ -258,7 +250,7 @@ class App extends IPCContainer { }; waitForDependencyInstall = (source, url) => { - const dep = this.state.MissingDependencies.find(d => { + const dep = this.props.MissingDependencies.find(d => { return d.download === url; }); @@ -285,10 +277,10 @@ class App extends IPCContainer { !this.props.MountsBusy && !this.props.DownloadActive && (selectedVersion !== 'unavailable') && - (selectedVersion !== this.state.InstalledVersion); + (selectedVersion !== this.props.InstalledVersion); - const missingDependencies = (this.state.MissingDependencies.length > 0); - const allowMount = this.state.InstalledVersion !== 'none' && + const missingDependencies = (this.props.MissingDependencies.length > 0); + const allowMount = this.props.InstalledVersion !== 'none' && !missingDependencies && !this.props.InstallActive; @@ -337,9 +329,7 @@ class App extends IPCContainer { if (showDependencies) { dependencyDisplay = ( - + ); } @@ -368,11 +358,8 @@ class App extends IPCContainer { mainContent.push((
- +
)); @@ -381,8 +368,7 @@ class App extends IPCContainer {
+ noConsoleSupported={noConsoleSupported}/>
)); } @@ -440,7 +426,9 @@ const mapStateToProps = state => { DownloadType: state.download.DownloadType, InstallActive: state.install.InstallActive, InstallType: state.install.InstallType, + InstalledVersion: state.relver.InstalledVersion, LocationsLookup: state.relver.LocationsLookup, + MissingDependencies: state.install.MissingDependencies, MountsBusy: state.mounts.MountsBusy, Platform: state.common.Platform, ProviderState: state.mounts.ProviderState, @@ -466,6 +454,8 @@ const mapDispatchToProps = dispatch => { setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)), setAllowDownload: allow => dispatch(setAllowDownload(allow)), setDismissUIUpgrade: dismiss => dispatch(setDismissUIUpgrade(dismiss)), + setInstalledVersion: version => dispatch(setInstalledVersion(version)), + setMissingDependencies: dependencies => dispatch(setMissingDependencies(dependencies)), setProviderState: (provider, state) => dispatch(setProviderState(provider, state)), setReleaseUpgradeAvailable: available => dispatch(setReleaseUpgradeAvailable(available)), }; diff --git a/src/components/DependencyList/Dependency/Dependency.js b/src/components/DependencyList/Dependency/Dependency.js index f5e1fbc..77a91f0 100644 --- a/src/components/DependencyList/Dependency/Dependency.js +++ b/src/components/DependencyList/Dependency/Dependency.js @@ -1,7 +1,15 @@ import React from 'react'; import './Dependency.css'; +import {connect} from 'react-redux'; +import * as Constants from '../../../constants'; -export default props => { +const mapStateToProps = state => { + return { + AllowDownload: (state.download.DownloadType !== Constants.INSTALL_TYPES.Dependency), + }; +}; + +export default connect(mapStateToProps)(props => { return (
@@ -11,7 +19,7 @@ export default props => {

{props.name}

@@ -20,4 +28,4 @@ export default props => {
- {props.allowDownload ? + {props.AllowDownload ? {props.onDownload(props.download); return false;}}>Install : 'Installing...'}
); -}; \ No newline at end of file +}); \ No newline at end of file diff --git a/src/components/DependencyList/DependencyList.js b/src/components/DependencyList/DependencyList.js index 94012fd..4032cfe 100644 --- a/src/components/DependencyList/DependencyList.js +++ b/src/components/DependencyList/DependencyList.js @@ -1,13 +1,19 @@ import React from 'react'; import './DependencyList.css'; +import {connect} from 'react-redux'; import Dependency from './Dependency/Dependency'; import Box from '../UI/Box/Box'; -export default props => { - const items = props.dependencies.map((k, i)=> { +const mapStateToProps = state => { + return { + MissingDependencies: state.install.MissingDependencies, + }; +}; + +export default connect(mapStateToProps)(props => { + const items = props.MissingDependencies.map((k, i)=> { return ( - @@ -22,5 +28,4 @@ export default props => { {items} ); - -}; \ No newline at end of file +}); \ No newline at end of file diff --git a/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js b/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js index 1f80451..c658984 100644 --- a/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js +++ b/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js @@ -11,6 +11,12 @@ import {setActiveRelease} from "../../redux/actions/release_version_actions"; const mapStateToProps = state => { return { + AppPlatform: state.common.AppPlatform, + DownloadActive: state.download.DownloadActive, + InstallActive: state.install.InstallActive, + InstallType: state.install.InstallType, + InstalledVersion: state.relver.InstalledVersion, + MountsBusy: state.mounts.MountsBusy, Release: state.relver.Release, ReleaseUpgradeAvailable: state.relver.ReleaseUpgradeAvailable, ReleaseVersion: state.relver.Version, @@ -35,9 +41,13 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { props.setActiveRelease(props.Release, parseInt(e.target.value, 10)); }; + const text = props.InstalledVersion + ' [' + props.AppPlatform + ']'; + const disabled = props.DownloadActive || props.InstallActive || props.MountsBusy; + const releaseExtracting = (props.InstallType === Constants.INSTALL_TYPES.Release); + let optionsDisplay = []; let key = 0; - if (props.releaseExtracting) { + if (releaseExtracting) { optionsDisplay.push(( (dimensions.columns / 3) * 2} colSpan={'remain'} @@ -53,7 +63,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { key={key++} row={5} rowSpan={7} - text={props.text} + text={text} textAlign={'left'}/> )); } else if (props.downloadDisabled) { @@ -73,7 +83,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { key={key++} row={5} rowSpan={7} - text={props.text} + text={text} textAlign={'left'}/> )); } else { @@ -97,7 +107,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { type={'Heading2'}/> remain / 3 - 1} - disabled={props.disabled} + disabled={disabled} items={Constants.RELEASE_TYPES} row={5} rowSpan={7} @@ -116,7 +126,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { dimensions.columns / 3} colSpan={remain=>remain / 2 - 1} - disabled={props.disabled} + disabled={disabled} items={props.VersionLookup[Constants.RELEASE_TYPES[props.Release]]} row={5} rowSpan={7} diff --git a/src/containers/MountItems/MountItems.js b/src/containers/MountItems/MountItems.js index 47c2d9a..c26c456 100644 --- a/src/containers/MountItems/MountItems.js +++ b/src/containers/MountItems/MountItems.js @@ -73,7 +73,7 @@ class MountItems extends IPCContainer { if (!this.state.DisplayRetry) { this.props.setMountsBusy(true); this.sendRequest(Constants.IPC_Detect_Mounts, { - Version: this.props.version, + Version: this.props.InstalledVersion, }); } }; @@ -108,7 +108,7 @@ class MountItems extends IPCContainer { if (mount) { let result = this.sendSyncRequest(Constants.IPC_Check_Daemon_Version, { Provider: provider, - Version: this.props.version + Version: this.props.InstalledVersion }).data; if (result.Success) { if (result.Valid) { @@ -146,13 +146,13 @@ class MountItems extends IPCContainer { Location: location, NoConsoleSupported: this.props.noConsoleSupported, Provider: provider, - Version: this.props.version, + Version: this.props.InstalledVersion, }); } else { this.sendRequest(Constants.IPC_Unmount_Drive, { Location: location, Provider: provider, - Version: this.props.version, + Version: this.props.InstalledVersion, }); } } @@ -309,6 +309,7 @@ class MountItems extends IPCContainer { const mapStateToProps = state => { return { AutoMountProcessed: state.mounts.AutoMountProcessed, + InstalledVersion: state.relver.InstalledVersion, MountState: state.mounts.MountState, Platform: state.common.Platform, ProviderState: state.mounts.ProviderState, diff --git a/src/redux/actions/install_actions.js b/src/redux/actions/install_actions.js index 2c964bc..e69cd26 100644 --- a/src/redux/actions/install_actions.js +++ b/src/redux/actions/install_actions.js @@ -78,3 +78,4 @@ export const installUpgrade = (source, sha256, signature, skipVerification, comp export const setInstallActive = createAction('install/setInstallActive'); export const setInstallComplete = createAction('install/setInstallComplete'); +export const setMissingDependencies = createAction('install/setMissingDependencies'); diff --git a/src/redux/actions/release_version_actions.js b/src/redux/actions/release_version_actions.js index 80b44d9..263c4f4 100644 --- a/src/redux/actions/release_version_actions.js +++ b/src/redux/actions/release_version_actions.js @@ -101,6 +101,7 @@ export const setActiveRelease = (release, version) => { }; export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade'); +export const setInstalledVersion = createAction('relver/setInstalledVersion'); export const SET_RELEASE_DATA = 'relver/setReleaseData'; export const setReleaseData = (locationsLookup, versionLookup)=> { diff --git a/src/redux/reducers/install_reducer.js b/src/redux/reducers/install_reducer.js index 459e9e7..2e97f81 100644 --- a/src/redux/reducers/install_reducer.js +++ b/src/redux/reducers/install_reducer.js @@ -1,10 +1,11 @@ import {createReducer} from 'redux-starter-kit'; -import {setInstallActive, setInstallComplete} from '../actions/install_actions'; +import {setInstallActive, setInstallComplete, setMissingDependencies} from '../actions/install_actions'; export const installReducer = createReducer({ InstallActive: false, InstallResult: null, InstallType: null, + MissingDependencies: [], }, { [setInstallActive]: (state, action) => { return { @@ -21,5 +22,11 @@ export const installReducer = createReducer({ InstallResult: action.payload, InstallType: null, } + }, + [setMissingDependencies]: (state, action) => { + return { + ...state, + MissingDependencies: action.payload, + } } }); \ No newline at end of file diff --git a/src/redux/reducers/release_version_reducer.js b/src/redux/reducers/release_version_reducer.js index a84e258..ea2d827 100644 --- a/src/redux/reducers/release_version_reducer.js +++ b/src/redux/reducers/release_version_reducer.js @@ -14,6 +14,7 @@ const versionLookup = Constants.RELEASE_TYPES.map(k=> { }); export const releaseVersionReducer = createReducer({ + InstalledVersion: 'none', LocationsLookup: {}, Release: 2, ReleaseUpgradeAvailable: false, @@ -43,6 +44,12 @@ export const releaseVersionReducer = createReducer({ UpgradeDismissed: action.payload, }; }, + [Actions.setInstalledVersion]: (state, action) => { + return { + ...state, + InstalledVersion: action.payload, + } + }, [Actions.SET_RELEASE_DATA]: (state, action) => { return { ...state,