Unmount before install

This commit is contained in:
2020-02-21 16:38:52 -06:00
parent 39409495c4
commit 12ad878618

View File

@@ -13,6 +13,7 @@ import {
setReleaseUpgradeAvailable setReleaseUpgradeAvailable
} from './release_version_actions'; } from './release_version_actions';
import { import {
confirmYesNo,
displaySelectAppPlatform, displaySelectAppPlatform,
setAllowMount, setAllowMount,
setApplicationReady, setApplicationReady,
@@ -21,6 +22,7 @@ import {
showWindow, showWindow,
shutdownApplication shutdownApplication
} from './common_actions'; } from './common_actions';
import {unmountAll} from './mount_actions';
const ipcRenderer = getIPCRenderer(); const ipcRenderer = getIPCRenderer();
@@ -188,18 +190,25 @@ export const installAndTestRelease = (source, version, appPlatform) => {
export const installReleaseByVersion = (release, version) => { export const installReleaseByVersion = (release, version) => {
return (dispatch, getState) => { return (dispatch, getState) => {
let allowInstall = !getState().mounts.MountsBusy; const install = () => {
if (!allowInstall) {
// TODO: prompt to unmount
}
if (allowInstall) {
if (getState().download.AllowDownload && !getState().download.DownloadActive) { if (getState().download.AllowDownload && !getState().download.DownloadActive) {
dispatch(setAutoInstallRelease(true)); dispatch(setAutoInstallRelease(true));
dispatch(setActiveRelease(release, version)); dispatch(setActiveRelease(release, version));
} else { } else {
notifyError('Download is active. Unable to install release.'); notifyError('Download is active. Unable to install release.');
} }
};
if (getState().mounts.MountsBusy) {
dispatch(confirmYesNo('Unmount all drives?'))
.then(confirmed => {
if (confirmed) {
dispatch(unmountAll(install));
}
})
.catch(error => notifyError(error));
} else {
install();
} }
}; };
}; };