Pull request 734: + client: 1778 Add ip sort function, write unit tests
Close #1778 Squashed commit of the following: commit ba63e147311799b17deaa97d7a12c2e0ec44a2ed Merge: 143ba427705a9d90Author: ArtemBaskal <a.baskal@adguard.com> Date: Thu Aug 13 12:00:10 2020 +0300 Merge branch 'master' into feature/1778 commit 143ba42707da3d7eece9f3e137a8b245f7f7888f Merge: 483d2ff997df1989Author: ArtemBaskal <a.baskal@adguard.com> Date: Thu Aug 13 11:16:46 2020 +0300 Merge branch 'master' into feature/1778 commit 483d2ff9fa3de706d94a647701f1d26a3bcbb217 Author: ArtemBaskal <a.baskal@adguard.com> Date: Wed Aug 12 13:34:21 2020 +0300 Always put ipv4 before ipv6 in sort, add invalid input unit tests commit 26eb41b313785fe7ffaf98a7573cc5eef0dca14f Author: ArtemBaskal <a.baskal@adguard.com> Date: Wed Aug 12 11:27:46 2020 +0300 Rewrite tests: replace ipv4-mapped adresses commit 4ecf287fd46945effe9ff11cfc9ae49217b9c796 Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Aug 11 19:05:15 2020 +0300 Minor fix commit 3e5e2a6bb1f2f166619da54e5ade0904fe22a20d Author: ArtemBaskal <a.baskal@adguard.com> Date: Tue Aug 11 19:01:26 2020 +0300 + client: 1778 Add ip sort function, write unit tests
This commit is contained in:
@@ -6,7 +6,7 @@ import { Trans, withTranslation } from 'react-i18next';
|
||||
import Card from '../ui/Card';
|
||||
import Cell from '../ui/Cell';
|
||||
|
||||
import { getPercent, getIpMatchListStatus } from '../../helpers/helpers';
|
||||
import { getPercent, getIpMatchListStatus, sortIp } from '../../helpers/helpers';
|
||||
import { IP_MATCH_LIST_STATUS, STATUS_COLORS } from '../../helpers/constants';
|
||||
import { formatClientCell } from '../../helpers/formatClientCell';
|
||||
|
||||
@@ -99,7 +99,7 @@ const Clients = ({
|
||||
{
|
||||
Header: 'IP',
|
||||
accessor: 'ip',
|
||||
sortMethod: (a, b) => parseInt(a.replace(/\./g, ''), 10) - parseInt(b.replace(/\./g, ''), 10),
|
||||
sortMethod: sortIp,
|
||||
Cell: clientCell(t, toggleClientStatus, processingAccessSet, disallowedClients),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ import CellWrap from '../../ui/CellWrap';
|
||||
|
||||
import whoisCell from './whoisCell';
|
||||
import LogsSearchLink from '../../ui/LogsSearchLink';
|
||||
import { sortIp } from '../../../helpers/helpers';
|
||||
|
||||
const COLUMN_MIN_WIDTH = 200;
|
||||
|
||||
@@ -18,6 +19,7 @@ class AutoClients extends Component {
|
||||
accessor: 'ip',
|
||||
minWidth: COLUMN_MIN_WIDTH,
|
||||
Cell: CellWrap,
|
||||
sortMethod: sortIp,
|
||||
},
|
||||
{
|
||||
Header: this.props.t('table_name'),
|
||||
|
||||
@@ -3,6 +3,7 @@ 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 { sortIp } from '../../../helpers/helpers';
|
||||
|
||||
class Leases extends Component {
|
||||
cellWrap = ({ value }) => (
|
||||
@@ -27,6 +28,7 @@ class Leases extends Component {
|
||||
Header: 'IP',
|
||||
accessor: 'ip',
|
||||
Cell: this.cellWrap,
|
||||
sortMethod: sortIp,
|
||||
}, {
|
||||
Header: <Trans>dhcp_table_hostname</Trans>,
|
||||
accessor: 'hostname',
|
||||
|
||||
@@ -3,7 +3,7 @@ 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 { sortIp } from '../../../../helpers/helpers';
|
||||
import Modal from './Modal';
|
||||
|
||||
class StaticLeases extends Component {
|
||||
@@ -49,6 +49,7 @@ class StaticLeases extends Component {
|
||||
{
|
||||
Header: 'IP',
|
||||
accessor: 'ip',
|
||||
sortMethod: sortIp,
|
||||
Cell: this.cellWrap,
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user