Added remove remote mount

This commit is contained in:
2019-10-06 19:05:25 -05:00
parent 82fad7b706
commit aff7e8cb3a
10 changed files with 173 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import * as Constants from '../../constants';
import {createAction} from 'redux-starter-kit';
import {getIPCRenderer} from '../../utils';
import {confirmYesNo, displayConfirmYesNo} from './common_actions';
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
export const displayConfiguration = (provider, remote) => {
@@ -13,6 +14,31 @@ export const displayConfiguration = (provider, remote) => {
};
};
export const removeRemoteMount = provider => {
return dispatch => {
dispatch(confirmYesNo('Delete [' + provider.substr(6) + ']?'))
.then(confirmed => {
if (confirmed) {
dispatch(removeRemoteMount2(provider));
}
});
};
};
const removeRemoteMount2 = provider => {
return dispatch => {
const ipcRenderer = getIPCRenderer();
ipcRenderer.once(Constants.IPC_Remove_Remote_Mount_Reply, (_, arg) => {
if (arg.data.Success) {
dispatch(removeRemoteMount3(provider));
}
});
ipcRenderer.send(Constants.IPC_Remove_Remote_Mount, provider.substr(6));
};
};
export const removeRemoteMount3 = createAction('mounts/removeRemoteMount3');
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
export const resetMountsState = () => {
return {