Support S3 delete

This commit is contained in:
2020-12-12 14:45:26 -06:00
parent 7e0f06ba56
commit 54bc306fb0
5 changed files with 99 additions and 89 deletions

View File

@@ -95,31 +95,36 @@ export const displayConfiguration = (provider, remote, s3) => {
};
};
export const removeRemoteMount = provider => {
export const removeMount = provider => {
return dispatch => {
dispatch(confirmYesNo('Delete [' + provider.substr(6) + ']?'))
const isRemote = provider.startsWith('Remote');
dispatch(confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?'))
.then(confirmed => {
if (confirmed) {
dispatch(removeRemoteMount2(provider));
dispatch(removeMount2(provider));
}
});
};
};
const removeRemoteMount2 = provider => {
const removeMount2 = provider => {
return dispatch => {
const ipcRenderer = getIPCRenderer();
ipcRenderer.once(Constants.IPC_Remove_Remote_Mount_Reply, (_, arg) => {
ipcRenderer.once(Constants.IPC_Remove_Mount_Reply, (_, arg) => {
if (arg.data.Success) {
dispatch(removeRemoteMount3(provider));
dispatch(removeMount3(provider));
dispatch(saveState());
}
});
ipcRenderer.send(Constants.IPC_Remove_Remote_Mount, provider.substr(6));
const isRemote = provider.startsWith('Remote');
ipcRenderer.send(Constants.IPC_Remove_Mount, {
Remote: isRemote,
Name: provider.substr(isRemote ? 6 : 2)
});
};
};
export const removeRemoteMount3 = createAction('mounts/removeRemoteMount3');
export const removeMount3 = createAction('mounts/removeMount3');
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
export const resetMountsState = () => {