From 38b3ec19cc6fed5fb2f9f5bff65f48aad8dd9677 Mon Sep 17 00:00:00 2001 From: Ildar Kamalov Date: Wed, 20 Dec 2023 18:17:05 +0300 Subject: [PATCH] Pull request: fix edit static lease Updates #6534 Squashed commit of the following: commit 1ca6cdc37a865ff0beab2d1f4fb0d44528bd4df3 Author: Ildar Kamalov Date: Wed Dec 20 15:41:27 2023 +0300 ADG-7889 fix edit static lease --- CHANGELOG.md | 2 ++ client/src/components/Settings/Dhcp/Leases.js | 7 +++++-- client/src/helpers/constants.js | 1 + client/src/reducers/dhcp.js | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65f60b6c..6067c7ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,12 +33,14 @@ NOTE: Add new changes BELOW THIS COMMENT. ### Fixed +- Pre-filling the Edit static lease window with data ([#6534]). - Names defined in the `/etc/hosts` for a single address family wrongly considered undefined for another family ([#6541]). - Omitted CNAME records in safe search results, which can cause YouTube to not work on iOS ([#6352]). [#6352]: https://github.com/AdguardTeam/AdGuardHome/issues/6352 +[#6534]: https://github.com/AdguardTeam/AdGuardHome/issues/6534 [#6541]: https://github.com/AdguardTeam/AdGuardHome/issues/6541 [#6545]: https://github.com/AdguardTeam/AdGuardHome/issues/6545 diff --git a/client/src/components/Settings/Dhcp/Leases.js b/client/src/components/Settings/Dhcp/Leases.js index 9b245dbe..3b267b3b 100644 --- a/client/src/components/Settings/Dhcp/Leases.js +++ b/client/src/components/Settings/Dhcp/Leases.js @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import ReactTable from 'react-table'; import { Trans, withTranslation } from 'react-i18next'; -import { LEASES_TABLE_DEFAULT_PAGE_SIZE } from '../../../helpers/constants'; +import { LEASES_TABLE_DEFAULT_PAGE_SIZE, MODAL_TYPE } from '../../../helpers/constants'; import { sortIp } from '../../../helpers/helpers'; import { toggleLeaseModal } from '../../../actions'; @@ -18,7 +18,10 @@ class Leases extends Component { convertToStatic = (data) => () => { const { dispatch } = this.props; - dispatch(toggleLeaseModal(data)); + dispatch(toggleLeaseModal({ + type: MODAL_TYPE.ADD_LEASE, + config: data, + })); } makeStatic = ({ row }) => { diff --git a/client/src/helpers/constants.js b/client/src/helpers/constants.js index 0b345f4d..89f53cae 100644 --- a/client/src/helpers/constants.js +++ b/client/src/helpers/constants.js @@ -181,6 +181,7 @@ export const MODAL_TYPE = { ADD_REWRITE: 'ADD_REWRITE', EDIT_REWRITE: 'EDIT_REWRITE', EDIT_LEASE: 'EDIT_LEASE', + ADD_LEASE: 'ADD_LEASE', }; export const CLIENT_ID = { diff --git a/client/src/reducers/dhcp.js b/client/src/reducers/dhcp.js index 877451a5..47768b50 100644 --- a/client/src/reducers/dhcp.js +++ b/client/src/reducers/dhcp.js @@ -128,7 +128,8 @@ const dhcp = handleActions( const newState = { ...state, isModalOpen: !state.isModalOpen, - leaseModalConfig: payload, + modalType: payload?.type || '', + leaseModalConfig: payload?.config, }; return newState; },