Handle release unavailable
This commit is contained in:
@@ -72,6 +72,12 @@ function setWindowVisibility(show) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const unmountAllDrives = () => {
|
const unmountAllDrives = () => {
|
||||||
|
// Reset mount states
|
||||||
|
for (const provider of Constants.PROVIDER_LIST) {
|
||||||
|
clearManualMountDetection(provider);
|
||||||
|
expectedUnmount[provider] = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Unmount all items
|
// Unmount all items
|
||||||
for (const i in mountedLocations) {
|
for (const i in mountedLocations) {
|
||||||
const data = mountedData[mountedLocations[i]];
|
const data = mountedData[mountedLocations[i]];
|
||||||
@@ -898,16 +904,21 @@ ipcMain.on(Constants.IPC_Show_Window + '_sync', event => {
|
|||||||
event.returnValue = true;
|
event.returnValue = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.on(Constants.IPC_Unmount_All_Drives, (event, data) => {
|
||||||
|
unmountAllDrives();
|
||||||
|
standardIPCReply(event, Constants.IPC_Unmount_All_Drives_Reply);
|
||||||
|
});
|
||||||
|
|
||||||
ipcMain.on(Constants.IPC_Unmount_Drive, (event, data) => {
|
ipcMain.on(Constants.IPC_Unmount_Drive, (event, data) => {
|
||||||
clearManualMountDetection(data.Provider);
|
clearManualMountDetection(data.Provider);
|
||||||
|
|
||||||
expectedUnmount[data.Provider] = true;
|
expectedUnmount[data.Provider] = true;
|
||||||
helpers
|
helpers
|
||||||
.stopMountProcess(data.Version, data.Provider)
|
.stopMountProcess(data.Version, data.Provider)
|
||||||
.then((result)=> {
|
.then(result => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch(e => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -114,5 +114,8 @@ exports.IPC_Set_Config_Values_Reply = 'set_config_values_reply';
|
|||||||
|
|
||||||
exports.IPC_Shutdown = 'shutdown';
|
exports.IPC_Shutdown = 'shutdown';
|
||||||
|
|
||||||
|
exports.IPC_Unmount_All_Drives = 'unmount_all';
|
||||||
|
exports.IPC_Unmount_All_Drives_Reply = 'unmount_all_reply';
|
||||||
|
|
||||||
exports.IPC_Unmount_Drive = 'unmount_drive';
|
exports.IPC_Unmount_Drive = 'unmount_drive';
|
||||||
exports.IPC_Unmount_Drive_Reply = 'unmount_drive_reply';
|
exports.IPC_Unmount_Drive_Reply = 'unmount_drive_reply';
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
|
import * as Constants from '../../constants';
|
||||||
import {createAction} from 'redux-starter-kit';
|
import {createAction} from 'redux-starter-kit';
|
||||||
|
import {getIPCRenderer} from '../../utils';
|
||||||
|
|
||||||
export const displayConfiguration = createAction('mounts/displayConfiguration');
|
export const displayConfiguration = createAction('mounts/displayConfiguration');
|
||||||
|
|
||||||
@@ -9,6 +11,7 @@ export const resetMountsState = () => {
|
|||||||
payload: null,
|
payload: null,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SET_ALLOW_MOUNT = 'mounts/setAllowMount';
|
export const SET_ALLOW_MOUNT = 'mounts/setAllowMount';
|
||||||
export const setAllowMount = (provider, allow) => {
|
export const setAllowMount = (provider, allow) => {
|
||||||
return {
|
return {
|
||||||
@@ -54,4 +57,16 @@ export const setProviderState = (provider, state) => {
|
|||||||
state
|
state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const unmountAll = completedCallback => {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
const ipcRenderer = getIPCRenderer();
|
||||||
|
const unmountedCallback = () => {
|
||||||
|
dispatch(resetMountsState());
|
||||||
|
completedCallback();
|
||||||
|
};
|
||||||
|
ipcRenderer.once(Constants.IPC_Unmount_All_Drives_Reply, unmountedCallback);
|
||||||
|
ipcRenderer.send(Constants.IPC_Unmount_All_Drives);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@@ -3,9 +3,11 @@ import * as Constants from '../../constants';
|
|||||||
import {createAction} from 'redux-starter-kit';
|
import {createAction} from 'redux-starter-kit';
|
||||||
import {notifyError} from './error_actions';
|
import {notifyError} from './error_actions';
|
||||||
import {
|
import {
|
||||||
|
saveState,
|
||||||
setApplicationReady,
|
setApplicationReady,
|
||||||
showWindow
|
showWindow
|
||||||
} from './common_actions';
|
} from './common_actions';
|
||||||
|
import {unmountAll} from './mount_actions';
|
||||||
|
|
||||||
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
|
export const CLEAR_UI_UPGRADE = 'relver/clearUIUpgrade';
|
||||||
export const clearUIUpgrade = () => {
|
export const clearUIUpgrade = () => {
|
||||||
@@ -47,19 +49,34 @@ export const loadReleases = () => {
|
|||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const dispatchActions = (locationsLookup, versionLookup)=> {
|
const dispatchActions = (locationsLookup, versionLookup)=> {
|
||||||
const state = getState().relver;
|
const state = getState().relver;
|
||||||
const latestVersion = versionLookup[Constants.RELEASE_TYPES[state.Release]].length - 1;
|
let latestVersion = versionLookup[Constants.RELEASE_TYPES[state.Release]].length - 1;
|
||||||
|
let release = state.Release;
|
||||||
let version = state.Version;
|
let version = state.Version;
|
||||||
if ((version === -1) || !versionLookup[Constants.RELEASE_TYPES[state.Release]][version]) {
|
if (versionLookup[Constants.RELEASE_TYPES[release]][0] === 'unavailable') {
|
||||||
|
release = state.ReleaseDefault;
|
||||||
|
latestVersion = version = 0;
|
||||||
|
} else if ((version === -1) || !versionLookup[Constants.RELEASE_TYPES[state.Release]][version]) {
|
||||||
version = latestVersion;
|
version = latestVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(setReleaseData(locationsLookup, versionLookup));
|
dispatch(setReleaseData(locationsLookup, versionLookup));
|
||||||
if (version !== state.Version) {
|
|
||||||
dispatch(setActiveRelease(state.Release, version));
|
const dispatchActions = () => {
|
||||||
|
dispatch(setReleaseUpgradeAvailable((version !== latestVersion)));
|
||||||
|
dispatch(setApplicationReady(true));
|
||||||
|
dispatch(detectUIUpgrade());
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((version !== state.Version) || (release !== state.Release)) {
|
||||||
|
dispatch(unmountAll(() => {
|
||||||
|
dispatch(setActiveRelease(release, version));
|
||||||
|
dispatchActions();
|
||||||
|
dispatch(showWindow());
|
||||||
|
dispatch(saveState());
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
dispatchActions();
|
||||||
}
|
}
|
||||||
dispatch(setReleaseUpgradeAvailable((version !== latestVersion)));
|
|
||||||
dispatch(setApplicationReady(true));
|
|
||||||
dispatch(detectUIUpgrade());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
axios
|
axios
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export const releaseVersionReducer = createReducer({
|
|||||||
InstalledVersion: 'none',
|
InstalledVersion: 'none',
|
||||||
LocationsLookup: {},
|
LocationsLookup: {},
|
||||||
Release: 0,
|
Release: 0,
|
||||||
|
ReleaseDefault: 0,
|
||||||
ReleaseUpgradeAvailable: false,
|
ReleaseUpgradeAvailable: false,
|
||||||
UpgradeAvailable: false,
|
UpgradeAvailable: false,
|
||||||
UpgradeData: null,
|
UpgradeData: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user