Save state on remove
This commit is contained in:
@@ -126,15 +126,15 @@ class App extends IPCContainer {
|
|||||||
!this.props.DismissDependencies &&
|
!this.props.DismissDependencies &&
|
||||||
this.props.AllowMount;
|
this.props.AllowMount;
|
||||||
|
|
||||||
const confirmDisplay = this.createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
|
||||||
const infoDisplay = this.createModalConditionally(this.props.DisplayInfo, <InfoDetails/>, true);
|
|
||||||
const rebootDisplay = this.createModalConditionally(this.props.RebootRequired, <Reboot />);
|
|
||||||
const configDisplay = this.createModalConditionally(showConfig, <Configuration version={selectedVersion} remoteSupported={remoteSupported} />);
|
const configDisplay = this.createModalConditionally(showConfig, <Configuration version={selectedVersion} remoteSupported={remoteSupported} />);
|
||||||
|
const confirmDisplay = this.createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
||||||
const dependencyDisplay = this.createModalConditionally(showDependencies, <DependencyList/>);
|
const dependencyDisplay = this.createModalConditionally(showDependencies, <DependencyList/>);
|
||||||
const downloadDisplay = this.createModalConditionally(this.props.DownloadActive, <DownloadProgress/>);
|
const downloadDisplay = this.createModalConditionally(this.props.DownloadActive, <DownloadProgress/>);
|
||||||
const errorDisplay = this.createModalConditionally(this.props.DisplayError, <ErrorDetails/>, true);
|
const errorDisplay = this.createModalConditionally(this.props.DisplayError, <ErrorDetails/>, true);
|
||||||
const upgradeDisplay = this.createModalConditionally(showUpgrade, <UpgradeUI/>);
|
const infoDisplay = this.createModalConditionally(this.props.DisplayInfo, <InfoDetails/>, true);
|
||||||
|
const rebootDisplay = this.createModalConditionally(this.props.RebootRequired, <Reboot />);
|
||||||
const selectAppPlatformDisplay = this.createModalConditionally(this.props.DisplaySelectAppPlatform, <SelectAppPlatform/>);
|
const selectAppPlatformDisplay = this.createModalConditionally(this.props.DisplaySelectAppPlatform, <SelectAppPlatform/>);
|
||||||
|
const upgradeDisplay = this.createModalConditionally(showUpgrade, <UpgradeUI/>);
|
||||||
|
|
||||||
let mainContent = [];
|
let mainContent = [];
|
||||||
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
|
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
|
||||||
|
|||||||
@@ -13,25 +13,6 @@ export const confirmYesNo = title => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const hideConfirmYesNo = confirmed => {
|
|
||||||
return dispatch => {
|
|
||||||
dispatch(handleConfirmYesNo(false, confirmed));
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleConfirmYesNo = (show, titleOrConfirmed, resolve) => {
|
|
||||||
return dispatch => {
|
|
||||||
if (show) {
|
|
||||||
yesNoResolvers.push(resolve);
|
|
||||||
dispatch(displayConfirmYesNo(show, titleOrConfirmed))
|
|
||||||
} else {
|
|
||||||
yesNoResolvers[0](titleOrConfirmed);
|
|
||||||
yesNoResolvers.splice(0, 1);
|
|
||||||
dispatch(displayConfirmYesNo(false))
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DISPLAY_CONFIRM_YES_NO = 'common/displayConfirmYesNo';
|
export const DISPLAY_CONFIRM_YES_NO = 'common/displayConfirmYesNo';
|
||||||
const displayConfirmYesNo = (show, title) => {
|
const displayConfirmYesNo = (show, title) => {
|
||||||
return {
|
return {
|
||||||
@@ -53,6 +34,25 @@ export const displaySelectAppPlatform = display => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const hideConfirmYesNo = confirmed => {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch(handleConfirmYesNo(false, confirmed));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleConfirmYesNo = (show, titleOrConfirmed, resolve) => {
|
||||||
|
return dispatch => {
|
||||||
|
if (show) {
|
||||||
|
yesNoResolvers.push(resolve);
|
||||||
|
dispatch(displayConfirmYesNo(show, titleOrConfirmed));
|
||||||
|
} else {
|
||||||
|
yesNoResolvers[0](titleOrConfirmed);
|
||||||
|
yesNoResolvers.splice(0, 1);
|
||||||
|
dispatch(displayConfirmYesNo(false));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const notifyRebootRequired = createAction('common/notifyRebootRequired');
|
export const notifyRebootRequired = createAction('common/notifyRebootRequired');
|
||||||
|
|
||||||
export const rebootSystem = () => {
|
export const rebootSystem = () => {
|
||||||
@@ -64,6 +64,33 @@ export const rebootSystem = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const saveState = () => {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
const state = getState();
|
||||||
|
if (state.common.AppReady) {
|
||||||
|
let currentState = {
|
||||||
|
Release: state.relver.Release,
|
||||||
|
RemoteMounts: state.mounts.RemoteMounts,
|
||||||
|
Version: state.relver.Version,
|
||||||
|
};
|
||||||
|
|
||||||
|
const providerList = [
|
||||||
|
...Constants.PROVIDER_LIST,
|
||||||
|
...state.mounts.RemoteMounts,
|
||||||
|
];
|
||||||
|
for (const provider of providerList) {
|
||||||
|
currentState[provider] = state.mounts.ProviderState[provider];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ipcRenderer) {
|
||||||
|
ipcRenderer.send(Constants.IPC_Save_State, {
|
||||||
|
State: currentState
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const setAllowMount = createAction('common/setAllowMount');
|
export const setAllowMount = createAction('common/setAllowMount');
|
||||||
export const setApplicationReady = createAction('common/setApplicationReady');
|
export const setApplicationReady = createAction('common/setApplicationReady');
|
||||||
|
|
||||||
@@ -100,30 +127,3 @@ export const shutdownApplication = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const saveState = () => {
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
const state = getState();
|
|
||||||
if (state.common.AppReady) {
|
|
||||||
let currentState = {
|
|
||||||
Release: state.relver.Release,
|
|
||||||
RemoteMounts: state.mounts.RemoteMounts,
|
|
||||||
Version: state.relver.Version,
|
|
||||||
};
|
|
||||||
|
|
||||||
const providerList = [
|
|
||||||
...Constants.PROVIDER_LIST,
|
|
||||||
...state.mounts.RemoteMounts,
|
|
||||||
];
|
|
||||||
for (const provider of providerList) {
|
|
||||||
currentState[provider] = state.mounts.ProviderState[provider];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ipcRenderer) {
|
|
||||||
ipcRenderer.send(Constants.IPC_Save_State, {
|
|
||||||
State: currentState
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
import * as Constants from '../../constants';
|
import * as Constants from '../../constants';
|
||||||
import {createAction} from 'redux-starter-kit';
|
import {createAction} from 'redux-starter-kit';
|
||||||
import {getIPCRenderer} from '../../utils';
|
import {getIPCRenderer} from '../../utils';
|
||||||
import {confirmYesNo, displayConfirmYesNo} from './common_actions';
|
import {
|
||||||
|
confirmYesNo,
|
||||||
|
saveState
|
||||||
|
} from './common_actions';
|
||||||
|
|
||||||
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
|
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
|
||||||
export const displayConfiguration = (provider, remote) => {
|
export const displayConfiguration = (provider, remote) => {
|
||||||
@@ -31,6 +34,7 @@ const removeRemoteMount2 = provider => {
|
|||||||
ipcRenderer.once(Constants.IPC_Remove_Remote_Mount_Reply, (_, arg) => {
|
ipcRenderer.once(Constants.IPC_Remove_Remote_Mount_Reply, (_, arg) => {
|
||||||
if (arg.data.Success) {
|
if (arg.data.Success) {
|
||||||
dispatch(removeRemoteMount3(provider));
|
dispatch(removeRemoteMount3(provider));
|
||||||
|
dispatch(saveState());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ipcRenderer.send(Constants.IPC_Remove_Remote_Mount, provider.substr(6));
|
ipcRenderer.send(Constants.IPC_Remove_Remote_Mount, provider.substr(6));
|
||||||
|
|||||||
Reference in New Issue
Block a user