#34: Allow cancelling/closing dependency installation if version count > 1

This commit is contained in:
2019-08-14 15:13:01 -05:00
parent 76f2227855
commit 3788b9b7ec
10 changed files with 89 additions and 18 deletions

View File

@@ -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');