Web console: fix supervisor stats table pagination (#12227)

* fixes #11627 supervisor stats table pagination

* use spread instead of assign
This commit is contained in:
Vadim Ogievetsky 2022-02-03 00:09:21 -08:00 committed by GitHub
parent e648b01afb
commit fc76b014d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 22 deletions

View File

@ -96,7 +96,7 @@ exports[`SupervisorStatisticsTable matches snapshot on error 1`] = `
defaultFilterMethod={[Function]}
defaultFiltered={Array []}
defaultPage={0}
defaultPageSize={6}
defaultPageSize={25}
defaultResized={Array []}
defaultSortDesc={false}
defaultSortMethod={[Function]}
@ -147,9 +147,6 @@ exports[`SupervisorStatisticsTable matches snapshot on error 1`] = `
pageJumpText="jump to page"
pageSizeOptions={
Array [
5,
10,
20,
25,
50,
100,
@ -273,7 +270,7 @@ exports[`SupervisorStatisticsTable matches snapshot on init 1`] = `
defaultFilterMethod={[Function]}
defaultFiltered={Array []}
defaultPage={0}
defaultPageSize={6}
defaultPageSize={25}
defaultResized={Array []}
defaultSortDesc={false}
defaultSortMethod={[Function]}
@ -324,9 +321,6 @@ exports[`SupervisorStatisticsTable matches snapshot on init 1`] = `
pageJumpText="jump to page"
pageSizeOptions={
Array [
5,
10,
20,
25,
50,
100,
@ -476,7 +470,7 @@ exports[`SupervisorStatisticsTable matches snapshot on no data 1`] = `
defaultFilterMethod={[Function]}
defaultFiltered={Array []}
defaultPage={0}
defaultPageSize={6}
defaultPageSize={25}
defaultResized={Array []}
defaultSortDesc={false}
defaultSortMethod={[Function]}
@ -527,9 +521,6 @@ exports[`SupervisorStatisticsTable matches snapshot on no data 1`] = `
pageJumpText="jump to page"
pageSizeOptions={
Array [
5,
10,
20,
25,
50,
100,
@ -709,7 +700,7 @@ exports[`SupervisorStatisticsTable matches snapshot on some data 1`] = `
defaultFilterMethod={[Function]}
defaultFiltered={Array []}
defaultPage={0}
defaultPageSize={6}
defaultPageSize={25}
defaultResized={Array []}
defaultSortDesc={false}
defaultSortMethod={[Function]}
@ -760,9 +751,6 @@ exports[`SupervisorStatisticsTable matches snapshot on some data 1`] = `
pageJumpText="jump to page"
pageSizeOptions={
Array [
5,
10,
20,
25,
50,
100,

View File

@ -22,7 +22,7 @@ import ReactTable, { CellInfo, Column } from 'react-table';
import { useQueryManager } from '../../hooks';
import { Api, UrlBaser } from '../../singletons';
import { deepGet } from '../../utils';
import { deepGet, SMALL_TABLE_PAGE_SIZE, SMALL_TABLE_PAGE_SIZE_OPTIONS } from '../../utils';
import { Loader } from '../loader/loader';
import './supervisor-statistics-table.scss';
@ -121,11 +121,13 @@ export const SupervisorStatisticsTable = React.memo(function SupervisorStatistic
);
}
const statisticsData = supervisorStatisticsState.data || [];
return (
<ReactTable
data={supervisorStatisticsState.data || []}
showPagination={false}
defaultPageSize={6}
data={statisticsData}
defaultPageSize={SMALL_TABLE_PAGE_SIZE}
pageSizeOptions={SMALL_TABLE_PAGE_SIZE_OPTIONS}
showPagination={statisticsData.length > SMALL_TABLE_PAGE_SIZE}
columns={columns}
noDataText={supervisorStatisticsState.getErrorMessage() || 'No statistics data found'}
/>

View File

@ -245,7 +245,7 @@ ORDER BY
services = services.map(s => {
const loadQueueInfo = loadQueues[s.service];
if (loadQueueInfo) {
s = Object.assign(s, loadQueueInfo);
s = { ...s, ...loadQueueInfo };
}
return s;
});
@ -278,7 +278,7 @@ ORDER BY
services = services.map(s => {
const middleManagerInfo = middleManagersLookup[s.service];
if (middleManagerInfo) {
s = Object.assign(s, middleManagerInfo);
s = { ...s, ...middleManagerInfo };
}
return s;
});