6206 get table page size from local storage
Updates #6206
Squashed commit of the following:
commit 03089136a749fbda7da9be1af5997a24738eabb6
Merge: 7078c449c 3ce3c41b5
Author: Ildar Kamalov <ik@adguard.com>
Date: Wed Oct 11 15:25:11 2023 +0300
Merge branch 'master' into ADG-7558
commit 7078c449cb02039b47bdd085de12145b6982ea2c
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Oct 9 19:47:58 2023 +0300
fix default page size
commit 64569487a916797bbb42246eb935f1388626590e
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Oct 9 19:47:22 2023 +0300
remove unused
commit 17614fa76b5aab617b807e226f743b9fd461c247
Author: Ildar Kamalov <ik@adguard.com>
Date: Mon Oct 9 19:30:22 2023 +0300
ADG-7473 get table page size from local storage
This commit is contained in:
@@ -4,6 +4,7 @@ import ReactTable from 'react-table';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { sortIp } from '../../../helpers/helpers';
|
||||
import { MODAL_TYPE } from '../../../helpers/constants';
|
||||
import { LocalStorageHelper, LOCAL_STORAGE_KEYS } from '../../../helpers/localStorageHelper';
|
||||
|
||||
class Table extends Component {
|
||||
cellWrap = ({ value }) => (
|
||||
@@ -85,7 +86,8 @@ class Table extends Component {
|
||||
loading={processing || processingAdd || processingDelete}
|
||||
className="-striped -highlight card-table-overflow"
|
||||
showPagination
|
||||
defaultPageSize={10}
|
||||
defaultPageSize={LocalStorageHelper.getItem(LOCAL_STORAGE_KEYS.REWRITES_PAGE_SIZE) || 10}
|
||||
onPageSizeChange={(size) => LocalStorageHelper.setItem(LOCAL_STORAGE_KEYS.REWRITES_PAGE_SIZE, size)}
|
||||
minRows={5}
|
||||
ofText="/"
|
||||
previousText={t('previous_btn')}
|
||||
|
||||
@@ -6,6 +6,7 @@ import CellWrap from '../ui/CellWrap';
|
||||
import { MODAL_TYPE } from '../../helpers/constants';
|
||||
import { formatDetailedDateTime } from '../../helpers/helpers';
|
||||
import { isValidAbsolutePath } from '../../helpers/form';
|
||||
import { LOCAL_STORAGE_KEYS, LocalStorageHelper } from '../../helpers/localStorageHelper';
|
||||
|
||||
class Table extends Component {
|
||||
getDateCell = (row) => CellWrap(row, formatDetailedDateTime);
|
||||
@@ -126,12 +127,17 @@ class Table extends Component {
|
||||
loading, filters, t, whitelist,
|
||||
} = this.props;
|
||||
|
||||
const localStorageKey = whitelist
|
||||
? LOCAL_STORAGE_KEYS.ALLOWLIST_PAGE_SIZE
|
||||
: LOCAL_STORAGE_KEYS.BLOCKLIST_PAGE_SIZE;
|
||||
|
||||
return (
|
||||
<ReactTable
|
||||
data={filters}
|
||||
columns={this.columns}
|
||||
showPagination
|
||||
defaultPageSize={10}
|
||||
defaultPageSize={LocalStorageHelper.getItem(localStorageKey) || 10}
|
||||
onPageSizeChange={(size) => LocalStorageHelper.setItem(localStorageKey, size)}
|
||||
loading={loading}
|
||||
minRows={6}
|
||||
ofText="/"
|
||||
|
||||
@@ -9,6 +9,7 @@ import CellWrap from '../../ui/CellWrap';
|
||||
import whoisCell from './whoisCell';
|
||||
import LogsSearchLink from '../../ui/LogsSearchLink';
|
||||
import { sortIp } from '../../../helpers/helpers';
|
||||
import { LocalStorageHelper, LOCAL_STORAGE_KEYS } from '../../../helpers/localStorageHelper';
|
||||
|
||||
const COLUMN_MIN_WIDTH = 200;
|
||||
|
||||
@@ -85,7 +86,10 @@ class AutoClients extends Component {
|
||||
]}
|
||||
className="-striped -highlight card-table-overflow"
|
||||
showPagination
|
||||
defaultPageSize={10}
|
||||
defaultPageSize={LocalStorageHelper.getItem(LOCAL_STORAGE_KEYS.AUTO_CLIENTS_PAGE_SIZE) || 10}
|
||||
onPageSizeChange={(size) => (
|
||||
LocalStorageHelper.setItem(LOCAL_STORAGE_KEYS.AUTO_CLIENTS_PAGE_SIZE, size)
|
||||
)}
|
||||
minRows={5}
|
||||
ofText="/"
|
||||
previousText={t('previous_btn')}
|
||||
|
||||
@@ -19,6 +19,7 @@ import Card from '../../../ui/Card';
|
||||
import CellWrap from '../../../ui/CellWrap';
|
||||
import LogsSearchLink from '../../../ui/LogsSearchLink';
|
||||
import Modal from '../Modal';
|
||||
import { LocalStorageHelper, LOCAL_STORAGE_KEYS } from '../../../../helpers/localStorageHelper';
|
||||
|
||||
const ClientsTable = ({
|
||||
clients,
|
||||
@@ -342,7 +343,10 @@ const ClientsTable = ({
|
||||
]}
|
||||
className="-striped -highlight card-table-overflow"
|
||||
showPagination
|
||||
defaultPageSize={10}
|
||||
defaultPageSize={LocalStorageHelper.getItem(LOCAL_STORAGE_KEYS.CLIENTS_PAGE_SIZE) || 10}
|
||||
onPageSizeChange={(size) => (
|
||||
LocalStorageHelper.setItem(LOCAL_STORAGE_KEYS.CLIENTS_PAGE_SIZE, size)
|
||||
)}
|
||||
minRows={5}
|
||||
ofText="/"
|
||||
previousText={t('previous_btn')}
|
||||
|
||||
Reference in New Issue
Block a user