Redux changes and refactoring
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
setMountState,
|
||||
setProviderState
|
||||
} from '../../redux/actions/mount_actions';
|
||||
import {notifyError} from '../../redux/actions/error_actions';
|
||||
|
||||
const Constants = require('../../constants');
|
||||
|
||||
@@ -101,7 +102,7 @@ class MountItems extends IPCContainer {
|
||||
|
||||
handleMountUnMount = (provider, mount, location) => {
|
||||
if (!location || (location.trim().length === 0)) {
|
||||
this.props.errorHandler('Mount location is not set');
|
||||
this.props.notifyError('Mount location is not set');
|
||||
} else {
|
||||
let allowAction = true;
|
||||
if (mount) {
|
||||
@@ -117,22 +118,22 @@ class MountItems extends IPCContainer {
|
||||
});
|
||||
if (!result.Success) {
|
||||
allowAction = false;
|
||||
this.props.errorHandler(result.Error.toString());
|
||||
this.props.notifyError(result.Error.toString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
allowAction = false;
|
||||
if (result.Code === (new Uint32Array([-1]))[0]) {
|
||||
this.props.errorHandler('Failed to connect to ' + provider + ' daemon');
|
||||
this.props.notifyError('Failed to connect to ' + provider + ' daemon');
|
||||
} else if (result.Code === (new Uint32Array([-3]))[0]) {
|
||||
this.props.errorHandler('Incompatible ' + provider + ' daemon. Please upgrade ' + provider);
|
||||
this.props.notifyError('Incompatible ' + provider + ' daemon. Please upgrade ' + provider);
|
||||
} else {
|
||||
this.props.errorHandler('Version check failed: ' + result.Error);
|
||||
this.props.notifyError('Version check failed: ' + result.Error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
allowAction = false;
|
||||
this.props.errorHandler(result.Error.toString());
|
||||
this.props.notifyError(result.Error.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +202,7 @@ class MountItems extends IPCContainer {
|
||||
|
||||
this.props.setAutoMountProcessed(true);
|
||||
} else {
|
||||
this.props.errorHandler(arg.data.Error);
|
||||
this.props.notifyError(arg.data.Error);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -316,6 +317,7 @@ const mapStateToProps = state => {
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
|
||||
setAllowMount: (provider, allow) => dispatch(setAllowMount(provider, allow)),
|
||||
setAutoMountProcessed: processed => dispatch(setAutoMountProcessed(processed)),
|
||||
setMounted: (provider, mounted) => dispatch(setMounted(provider, mounted)),
|
||||
|
||||
Reference in New Issue
Block a user