Closes #4698. Squashed commit of the following: commit 6be0caee58926f8cea1e10650fbde0c8d97d0dac Author: Ildar Kamalov <ik@adguard.com> Date: Fri Jul 8 13:41:50 2022 +0300 update translation commit e0370656d05e8463d73ea73568cae81187c6b2e3 Author: Ildar Kamalov <ik@adguard.com> Date: Fri Jul 8 13:40:54 2022 +0300 client: validate static lease ip commit 7f4d00f9f3a54dc93ce5d5c45e9c21745f6e39d1 Merge: 2ee7962677e5e27dAuthor: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Fri Jul 8 13:20:15 2022 +0300 Merge branch 'master' into 4698-lease-with-gateway commit 2ee79626a1b0c7b113dbd22ba4ef6e85ea9913ec Merge: 471b96b83505ce87Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Thu Jul 7 19:34:33 2022 +0300 Merge branch 'master' into 4698-lease-with-gateway commit 471b96b81da8920c1e71b7110050154f912677d2 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Thu Jul 7 16:07:23 2022 +0300 dhcpd: imp docs commit 67dd6c76f7d2df4712a57281e0f40f2ee1a1efa2 Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Thu Jul 7 15:48:47 2022 +0300 dhcpd: restrict gateway ip for lease
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Trans, withTranslation } from 'react-i18next';
|
|
import ReactModal from 'react-modal';
|
|
import { useDispatch } from 'react-redux';
|
|
import Form from './Form';
|
|
import { toggleLeaseModal } from '../../../../actions';
|
|
|
|
const Modal = ({
|
|
isModalOpen,
|
|
handleSubmit,
|
|
processingAdding,
|
|
cidr,
|
|
rangeStart,
|
|
rangeEnd,
|
|
gatewayIp,
|
|
}) => {
|
|
const dispatch = useDispatch();
|
|
|
|
const toggleModal = () => dispatch(toggleLeaseModal());
|
|
|
|
return (
|
|
<ReactModal
|
|
className="Modal__Bootstrap modal-dialog modal-dialog-centered modal-dialog--clients"
|
|
closeTimeoutMS={0}
|
|
isOpen={isModalOpen}
|
|
onRequestClose={toggleModal}
|
|
>
|
|
<div className="modal-content">
|
|
<div className="modal-header">
|
|
<h4 className="modal-title">
|
|
<Trans>dhcp_new_static_lease</Trans>
|
|
</h4>
|
|
<button type="button" className="close" onClick={toggleModal}>
|
|
<span className="sr-only">Close</span>
|
|
</button>
|
|
</div>
|
|
<Form
|
|
initialValues={{
|
|
mac: '',
|
|
ip: '',
|
|
hostname: '',
|
|
cidr,
|
|
rangeStart,
|
|
rangeEnd,
|
|
gatewayIp,
|
|
}}
|
|
onSubmit={handleSubmit}
|
|
processingAdding={processingAdding}
|
|
cidr={cidr}
|
|
rangeStart={rangeStart}
|
|
rangeEnd={rangeEnd}
|
|
/>
|
|
</div>
|
|
</ReactModal>
|
|
);
|
|
};
|
|
|
|
Modal.propTypes = {
|
|
isModalOpen: PropTypes.bool.isRequired,
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
processingAdding: PropTypes.bool.isRequired,
|
|
cidr: PropTypes.string.isRequired,
|
|
rangeStart: PropTypes.string,
|
|
rangeEnd: PropTypes.string,
|
|
gatewayIp: PropTypes.string,
|
|
};
|
|
|
|
export default withTranslation()(Modal);
|