diff --git a/CHANGELOG.md b/CHANGELOG.md index 221f569..1b8db00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * \#33: Add 'Microsoft Visual C++ Redistributable' as dependency installation on Windows * \#32: Don't display network error message when check for UI updates fails * \#30: Add uninstall feature with reboot to handle WinFSP upgrades/downgrades +* \#34: Allow cancelling/closing dependency installation if version count > 1 ## 1.0.6 * Additional Linux distribution support: diff --git a/src/App.js b/src/App.js index 1e48184..b0ae7f8 100644 --- a/src/App.js +++ b/src/App.js @@ -2,7 +2,6 @@ import React from 'react'; import './App.css'; import Box from './components/UI/Box/Box'; import Configuration from './containers/Configuration/Configuration'; -import {checkVersionInstalled} from './redux/actions/install_actions'; import {connect} from 'react-redux'; import DependencyList from './components/DependencyList/DependencyList'; import DownloadProgress from './components/DownloadProgress/DownloadProgress'; @@ -45,7 +44,6 @@ class App extends IPCContainer { (prevProps.ReleaseVersion !== this.props.ReleaseVersion) || (prevProps.VersionLookup !== this.props.VersionLookup)) { this.props.saveState(); - this.props.checkVersionInstalled(); } else if (Object.keys(this.props.ProviderState).filter(k=> { return this.props.ProviderState[k] !== prevProps.ProviderState[k]; }).length > 0) { @@ -78,8 +76,11 @@ class App extends IPCContainer { (selectedVersion !== 'unavailable') && (selectedVersion !== this.props.InstalledVersion); - const missingDependencies = (this.props.MissingDependencies.length > 0); - const allowMount = this.props.InstalledVersion !== 'none' && + const missingDependencies = (this.props.MissingDependencies.length > 0) && + this.props.AllowMount; + + const allowMount = this.props.AllowMount && + this.props.InstalledVersion !== 'none' && !missingDependencies && !this.props.InstallActive; @@ -108,7 +109,9 @@ class App extends IPCContainer { const showDependencies = !showUpgrade && missingDependencies && !this.props.DownloadActive && - !this.props.RebootRequired; + !this.props.RebootRequired && + !this.props.DismissDependencies && + this.props.AllowMount; const rebootDisplay = this.createModalConditionally(this.props.RebootRequired, ); const configDisplay = this.createModalConditionally(showConfig, ); @@ -184,8 +187,10 @@ class App extends IPCContainer { const mapStateToProps = state => { return { AllowDownload: state.download.AllowDownload, + AllowMount: state.common.AllowMount, AppPlatform: state.common.AppPlatform, AppReady: state.common.AppReady, + DismissDependencies: state.install.DismissDependencies, DisplayConfiguration: state.mounts.DisplayConfiguration, DisplayError: state.error.DisplayError, DownloadActive: state.download.DownloadActive, @@ -207,7 +212,6 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - checkVersionInstalled: () => dispatch(checkVersionInstalled()), loadReleases: ()=> dispatch(loadReleases()), notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), saveState: () => dispatch(saveState()), diff --git a/src/components/DependencyList/DependencyList.js b/src/components/DependencyList/DependencyList.js index d93e103..43d35af 100644 --- a/src/components/DependencyList/DependencyList.js +++ b/src/components/DependencyList/DependencyList.js @@ -6,16 +6,19 @@ import Dependency from './Dependency/Dependency'; import Box from '../UI/Box/Box'; import {downloadItem} from '../../redux/actions/download_actions'; import {extractFileNameFromURL} from '../../utils'; +import {setDismissDependencies} from '../../redux/actions/install_actions'; const mapStateToProps = state => { return { + AllowDismissDependencies: state.relver.AllowDismissDependencies, MissingDependencies: state.install.MissingDependencies, }; }; const mapDispatchToProps = (dispatch) => { return { - downloadItem: (name, type, url, isWinFSP) => dispatch(downloadItem(name, type, url, isWinFSP)) + downloadItem: (name, type, url, isWinFSP) => dispatch(downloadItem(name, type, url, isWinFSP)), + setDismissDependencies: dismiss => dispatch(setDismissDependencies(dismiss)), }; }; @@ -28,8 +31,19 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { ); }); + let dismissDisplay; + if (props.AllowDismissDependencies) { + dismissDisplay = ( +
+ props.setDismissDependencies(true)}>X + +
); + } + return ( + {dismissDisplay}

Missing Dependencies

diff --git a/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js b/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js index 26eb7d0..9106a18 100644 --- a/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js +++ b/src/components/ReleaseVersionDisplay/ReleaseVersionDisplay.js @@ -7,12 +7,13 @@ import Grid from '../UI/Grid/Grid'; import Text from '../UI/Text/Text'; import Button from '../UI/Button/Button'; import UpgradeIcon from '../UpgradeIcon/UpgradeIcon'; -import {setActiveRelease} from "../../redux/actions/release_version_actions"; +import {setActiveRelease} from '../../redux/actions/release_version_actions'; import {downloadItem} from '../../redux/actions/download_actions'; const mapStateToProps = state => { return { AppPlatform: state.common.AppPlatform, + DismissDependencies: state.install.DismissDependencies, DownloadActive: state.download.DownloadActive, InstallActive: state.install.InstallActive, InstallType: state.install.InstallType, @@ -74,7 +75,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { text={text} textAlign={'left'}/> )); - } else if (props.downloadDisabled) { + } else if (props.downloadDisabled || props.DismissDependencies) { optionsDisplay.push(( (dimensions.columns / 3) * 2} colSpan={'remain'} @@ -100,7 +101,6 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => { col={dimensions => (dimensions.columns / 3) * 2} colSpan={20} key={key++} - disabled={props.downloadDisabled} row={5} rowSpan={7}>Install )); diff --git a/src/redux/actions/common_actions.js b/src/redux/actions/common_actions.js index 7dbe084..72854fb 100644 --- a/src/redux/actions/common_actions.js +++ b/src/redux/actions/common_actions.js @@ -5,6 +5,7 @@ import {getIPCRenderer} from '../../utils'; const ipcRenderer = getIPCRenderer(); export const notifyRebootRequired = createAction('common/notifyRebootRequired'); +export const setAllowMount = createAction('common/setAllowMount'); export const rebootSystem = () => { return dispatch => { diff --git a/src/redux/actions/install_actions.js b/src/redux/actions/install_actions.js index 8c3fbd7..4c11816 100644 --- a/src/redux/actions/install_actions.js +++ b/src/redux/actions/install_actions.js @@ -12,6 +12,7 @@ import { setReleaseUpgradeAvailable } from './release_version_actions'; import { + setAllowMount, setApplicationReady, setRebootRequired, showWindow, @@ -43,6 +44,7 @@ export const checkInstalled = (dependencies, version) => { dispatch(setReleaseUpgradeAvailable(upgradeAvailable)); dispatch(setMissingDependencies(result.Dependencies)); dispatch(setAllowDownload(true)); + dispatch(setAllowMount(true)); if (result.Dependencies && (result.Dependencies.length > 0)) { dispatch(showWindow()); } @@ -189,6 +191,7 @@ export const installUpgrade = (source, sha256, signature, skipVerification) => { }; }; +export const setDismissDependencies = createAction('install/setDismissDependencies'); 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 be8e073..0fe9ebd 100644 --- a/src/redux/actions/release_version_actions.js +++ b/src/redux/actions/release_version_actions.js @@ -4,9 +4,14 @@ import {createAction} from 'redux-starter-kit'; import {notifyError} from './error_actions'; import { saveState, + setAllowMount, setApplicationReady, showWindow } from './common_actions'; +import { + checkVersionInstalled, + setDismissDependencies +} from './install_actions'; import {unmountAll} from './mount_actions'; export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade'; @@ -60,16 +65,20 @@ export const loadReleases = () => { dispatch(setReleaseData(locationsLookup, versionLookup)); - const dispatchActions = () => { + const dispatchActions = (processAllowDismiss = true) => { dispatch(setReleaseUpgradeAvailable((version !== latestVersion))); dispatch(setApplicationReady(true)); dispatch(detectUIUpgrade()); + if (processAllowDismiss) { + dispatch(setAllowDismissDependencies(versionLookup[Constants.RELEASE_TYPES[release]].length > 1)); + } + dispatch(checkVersionInstalled()); }; if ((version !== state.Version) || (release !== state.Release)) { dispatch(unmountAll(() => { dispatch(setActiveRelease(release, version)); - dispatchActions(); + dispatchActions(false); dispatch(showWindow()); dispatch(saveState()); })); @@ -112,17 +121,33 @@ export const loadReleases = () => { }; }; -export const SET_ACTIVE_RELEASE = 'relver/setActiveRelease'; -export const setActiveRelease = (release, version) => { +export const NOTIFY_ACTIVE_RELEASE = 'relver/notifyActiveRelease'; +export const notifyActiveRelease = (release, version) => { return { - type: SET_ACTIVE_RELEASE, + type: NOTIFY_ACTIVE_RELEASE, payload: { - release, - version + release: release, + version: version + }, + }; +}; + +export const setActiveRelease = (release, version) => { + return (dispatch, getState) => { + dispatch(setAllowMount(false)); + const relVer = getState().relver; + const common = getState().common; + const versions = relVer.VersionLookup[Constants.RELEASE_TYPES[release]]; + dispatch(setAllowDismissDependencies(versions.length > 1)); + dispatch(setDismissDependencies(false)); + dispatch(notifyActiveRelease(release, version)); + if (common.AppReady) { + dispatch(checkVersionInstalled()); } }; }; +export const setAllowDismissDependencies = createAction('relver/setAllowDismissDependencies'); export const setDismissUIUpgrade = createAction('relver/setDismissUIUpgrade'); export const setInstalledVersion = createAction('relver/setInstalledVersion'); diff --git a/src/redux/reducers/common_reducer.js b/src/redux/reducers/common_reducer.js index e0ef60e..a2599bc 100644 --- a/src/redux/reducers/common_reducer.js +++ b/src/redux/reducers/common_reducer.js @@ -1,17 +1,25 @@ import {createReducer} from 'redux-starter-kit'; import { notifyRebootRequired, + setAllowMount, setApplicationReady, } from '../actions/common_actions'; export const createCommonReducer = (platform, appPlatform, version) => { return createReducer({ + AllowMount: false, AppPlatform: appPlatform, AppReady: false, Platform: platform, RebootRequired: false, Version: version, }, { + [setAllowMount]: (state, action) => { + return { + ...state, + AllowMount: action.payload, + } + }, [setApplicationReady]: (state, action) => { return { ...state, diff --git a/src/redux/reducers/install_reducer.js b/src/redux/reducers/install_reducer.js index ed6326b..9237040 100644 --- a/src/redux/reducers/install_reducer.js +++ b/src/redux/reducers/install_reducer.js @@ -1,16 +1,24 @@ import {createReducer} from 'redux-starter-kit'; import { + setDismissDependencies, setInstallActive, setInstallComplete, setMissingDependencies } from '../actions/install_actions'; export const installReducer = createReducer({ + DismissDependencies: false, InstallActive: false, InstallResult: null, InstallType: null, MissingDependencies: [], }, { + [setDismissDependencies]: (state, action) => { + return { + ...state, + DismissDependencies: action.payload, + } + }, [setInstallActive]: (state, action) => { return { ...state, diff --git a/src/redux/reducers/release_version_reducer.js b/src/redux/reducers/release_version_reducer.js index f106fa0..1214b42 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({ + AllowDismissDependencies: false, InstalledVersion: 'none', LocationsLookup: {}, Release: 0, @@ -35,13 +36,19 @@ export const releaseVersionReducer = createReducer({ UpgradeVersion: null, }; }, - [Actions.SET_ACTIVE_RELEASE]: (state, action) => { + [Actions.NOTIFY_ACTIVE_RELEASE]: (state, action) => { return { ...state, Release: action.payload.release, Version: action.payload.version }; }, + [Actions.setAllowDismissDependencies]: (state, action) => { + return { + ...state, + AllowDismissDependencies: action.payload, + }; + }, [Actions.setDismissUIUpgrade]: (state, action) => { return { ...state,