Updates #3459. Squashed commit of the following: commit 7a660c689da898c125a268f88378e38a58b457da Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com> Date: Tue Mar 21 10:40:25 2023 +0200 consider issues commit 066bf77ac44fa8602c66aa0ea220b52fca6d1180 Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com> Date: Mon Mar 20 18:37:14 2023 +0200 client: fix icon commit 356b4c3895436f165697510bb3b3abf95f18894f Author: Vladislav Abdulmyanov <v.abdulmyanov@adguard.com> Date: Mon Mar 20 18:32:03 2023 +0200 client: add transform dinamic lease to static
73 lines
2.3 KiB
JavaScript
73 lines
2.3 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Trans, withTranslation } from 'react-i18next';
|
|
import ReactModal from 'react-modal';
|
|
import { shallowEqual, useDispatch, useSelector } 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());
|
|
const leaseInitialData = useSelector(
|
|
(state) => state.dhcp.leaseModalConfig, shallowEqual,
|
|
) || {};
|
|
|
|
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: leaseInitialData.mac ?? '',
|
|
ip: leaseInitialData.ip ?? '',
|
|
hostname: leaseInitialData.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);
|