[Layout changes] [Skynet premium portal support]
This commit is contained in:
@@ -5,12 +5,13 @@ import DropDown from '../../components/UI/DropDown/DropDown';
|
||||
import PropTypes from 'prop-types';
|
||||
import Text from '../../components/UI/Text/Text';
|
||||
import { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { createDismissDisplay } from '../../utils.jsx';
|
||||
import {
|
||||
addEditHost,
|
||||
completeAddEditHost,
|
||||
} from '../../redux/actions/host_actions';
|
||||
import { connect } from 'react-redux';
|
||||
import { createDismissDisplay } from '../../utils.jsx';
|
||||
import { notifyError } from '../../redux/actions/error_actions';
|
||||
|
||||
class AddEditHost extends Component {
|
||||
state = {
|
||||
@@ -37,6 +38,18 @@ class AddEditHost extends Component {
|
||||
}
|
||||
|
||||
handleSave = () => {
|
||||
if (this.state.HostNameOrIp.trim().length == 0) {
|
||||
this.props.notifyError('Host / IP cannot be empty');
|
||||
return;
|
||||
}
|
||||
if (this.state.HostNameOrIp.trim().indexOf('/') >= 0) {
|
||||
this.props.notifyError(`Host / IP cannot be contain '/'`);
|
||||
return;
|
||||
}
|
||||
if (this.state.HostNameOrIp.trim().indexOf(':') >= 0) {
|
||||
this.props.notifyError(`Host / IP cannot be contain ':'`);
|
||||
return;
|
||||
}
|
||||
this.props.completeAddEditHost(this.state);
|
||||
};
|
||||
|
||||
@@ -224,6 +237,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
Close: () => dispatch(addEditHost(false)),
|
||||
completeAddEditHost: (host_data) =>
|
||||
dispatch(completeAddEditHost(true, host_data)),
|
||||
notifyError: (msg) => dispatch(notifyError(msg)),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -231,6 +245,7 @@ AddEditHost.propTypes = {
|
||||
Close: PropTypes.func.isRequired,
|
||||
completeAddEditHost: PropTypes.func.isRequired,
|
||||
HostData: PropTypes.object,
|
||||
notifyError: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AddEditHost);
|
||||
|
||||
Reference in New Issue
Block a user