mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-21 20:45:33 +03:00
Pull request: 4143 sort client ids
Merge in DNS/adguard-home from 4143-clients-sort to master
Updates #4143.
Squashed commit of the following:
commit a4b547eb46a54bdfdc7d342fab5f8ecfa54f5d06
Merge: d369c11c d82b2902
Author: Ildar Kamalov <ik@adguard.com>
Date: Thu Jan 20 11:58:42 2022 +0300
Merge branch 'master' into 4143-clients-sort
commit d369c11c69665510043f63e0283e1ca1b2974289
Author: Ildar Kamalov <ik@adguard.com>
Date: Wed Jan 19 16:53:39 2022 +0300
client: fix sort ip method
commit d767a1199c37ad9df7f3bc2d362d840b0226d836
Author: Ildar Kamalov <ik@adguard.com>
Date: Wed Jan 19 16:23:23 2022 +0300
client: sort client ids
This commit is contained in:
parent
d82b290251
commit
2fdda8a22c
2 changed files with 6 additions and 3 deletions
|
@ -4,7 +4,7 @@ import { Trans, withTranslation } from 'react-i18next';
|
|||
import ReactTable from 'react-table';
|
||||
|
||||
import { MODAL_TYPE } from '../../../helpers/constants';
|
||||
import { splitByNewLine, countClientsStatistics } from '../../../helpers/helpers';
|
||||
import { splitByNewLine, countClientsStatistics, sortIp } from '../../../helpers/helpers';
|
||||
import Card from '../../ui/Card';
|
||||
import Modal from './Modal';
|
||||
import CellWrap from '../../ui/CellWrap';
|
||||
|
@ -106,6 +106,7 @@ class ClientsTable extends Component {
|
|||
</div>
|
||||
);
|
||||
},
|
||||
sortMethod: sortIp,
|
||||
},
|
||||
{
|
||||
Header: this.props.t('table_name'),
|
||||
|
|
|
@ -754,8 +754,10 @@ const getAddressesComparisonBytes = (item) => {
|
|||
*/
|
||||
export const sortIp = (a, b) => {
|
||||
try {
|
||||
const comparisonBytesA = getAddressesComparisonBytes(a);
|
||||
const comparisonBytesB = getAddressesComparisonBytes(b);
|
||||
const comparisonBytesA = Array.isArray(a)
|
||||
? getAddressesComparisonBytes(a[0]) : getAddressesComparisonBytes(a);
|
||||
const comparisonBytesB = Array.isArray(b)
|
||||
? getAddressesComparisonBytes(b[0]) : getAddressesComparisonBytes(b);
|
||||
|
||||
for (let i = 0; i < comparisonBytesA.length; i += 1) {
|
||||
const byteA = comparisonBytesA[i];
|
||||
|
|
Loading…
Reference in a new issue