Add remote mount

This commit is contained in:
2019-10-06 21:39:14 -05:00
parent 3359ff5357
commit d52a2f7291
8 changed files with 188 additions and 33 deletions

View File

@@ -5,6 +5,43 @@ import {
confirmYesNo,
saveState
} from './common_actions';
import {notifyError} from './error_actions';
export const addRemoteMount = (hostNameOrIp, port, token) => {
return (dispatch, getState) => {
const ipcRenderer = getIPCRenderer();
const provider = 'Remote' + hostNameOrIp + ':' + port;
dispatch(addRemoteMount2(provider));
dispatch(setBusy(true));
ipcRenderer.once(Constants.IPC_Set_Config_Values_Reply, (_, arg) => {
if (arg.data.Success) {
ipcRenderer.send(Constants.IPC_Detect_Mounts, {
RemoteMounts: getState().mounts.RemoteMounts,
Version: getState().relver.InstalledVersion,
});
} else {
dispatch(notifyError('Failed to set \'RemoteToken\': ' + arg.data.Error));
dispatch(setBusy(false));
}
});
ipcRenderer.send(Constants.IPC_Set_Config_Values, {
Items: [
{Name: 'RemoteMount.RemoteHostNameOrIp', Value: hostNameOrIp},
{Name: 'RemoteMount.RemoteToken', Value: token},
{Name: 'RemoteMount.RemotePort', Value: port},
{Name: 'RemoteMount.IsRemoteMount', Value: 'true'},
],
Provider: provider,
Remote: true,
Version: getState().relver.InstalledVersion,
});
};
};
export const addRemoteMount2 = createAction('mounts/addRemoteMount2');
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
export const displayConfiguration = (provider, remote) => {