Refactor dialogs
This commit is contained in:
@@ -3,7 +3,7 @@ import { createAction } from '@reduxjs/toolkit';
|
||||
import * as Constants from '../../constants';
|
||||
import { getIPCRenderer } from '../../utils.jsx';
|
||||
|
||||
import { confirmYesNo, saveState } from './common_actions';
|
||||
import { confirmYesNoAction, saveState } from './common_actions';
|
||||
import { notifyError } from './error_actions';
|
||||
|
||||
export const addRemoteMount = (hostNameOrIp, port, token) => {
|
||||
@@ -23,7 +23,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
|
||||
Version: getState().relver.InstalledVersion,
|
||||
});
|
||||
} else {
|
||||
dispatch(notifyError('Failed to create S3 instance: ' + arg.data.Error));
|
||||
dispatch(notifyError('Failed to create remote mount: ' + arg.data.Error));
|
||||
dispatch(setBusy(false));
|
||||
}
|
||||
});
|
||||
@@ -32,7 +32,7 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
|
||||
Items: [
|
||||
{ Name: 'RemoteMount.RemoteHostNameOrIp', Value: hostNameOrIp },
|
||||
{ Name: 'RemoteMount.RemoteToken', Value: token },
|
||||
{ Name: 'RemoteMount.RemotePort', Value: port },
|
||||
{ Name: 'RemoteMount.RemotePort', Value: port.toString() },
|
||||
{ Name: 'RemoteMount.IsRemoteMount', Value: 'true' },
|
||||
],
|
||||
Provider: provider,
|
||||
@@ -96,13 +96,15 @@ export const displayConfiguration = (provider, remote, s3) => {
|
||||
export const removeMount = (provider) => {
|
||||
return (dispatch) => {
|
||||
const isRemote = provider.startsWith('Remote');
|
||||
dispatch(confirmYesNo('Delete [' + provider.substr(isRemote ? 6 : 2) + ']?')).then(
|
||||
(confirmed) => {
|
||||
if (confirmed) {
|
||||
dispatch(removeMount2(provider));
|
||||
}
|
||||
dispatch(
|
||||
confirmYesNoAction.display(true, null, {
|
||||
title: 'Delete [' + provider.substr(isRemote ? 6 : 2) + ']?',
|
||||
})
|
||||
).then(({ changed }) => {
|
||||
if (changed) {
|
||||
dispatch(removeMount2(provider));
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user