Skip to content

Commit 54e65d5

Browse files
Remove Extra Pagination
1 parent b231c27 commit 54e65d5

1 file changed

Lines changed: 52 additions & 52 deletions

File tree

clients/ui/frontend/src/shared/components/table/TableBase.tsx

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const TableBase = <T,>({
124124
const selectAllRef = React.useRef(null);
125125
const showPagination = enablePagination;
126126

127-
const pagination = (variant: 'top' | 'bottom') => (
127+
const pagination = (variant: 'bottom') => (
128128
<Pagination
129129
isCompact
130130
{...(!disableItemCount && { itemCount })}
@@ -214,57 +214,57 @@ const TableBase = <T,>({
214214
const renderRows = () =>
215215
loading
216216
? // compute the number of items in the upcoming page
217-
new Array(
218-
itemCount === 0
219-
? skeletonRowCount || rowHeightsRef.current?.length || MIN_PAGE_SIZE
220-
: Math.max(0, Math.min(perPage, itemCount - perPage * (page - 1))),
221-
)
222-
.fill(undefined)
223-
.map((_, i) => {
224-
// Set the height to the last known row height or otherwise the same height as the first row.
225-
// When going to a previous page, the number of rows may be greater than the current.
217+
new Array(
218+
itemCount === 0
219+
? skeletonRowCount || rowHeightsRef.current?.length || MIN_PAGE_SIZE
220+
: Math.max(0, Math.min(perPage, itemCount - perPage * (page - 1))),
221+
)
222+
.fill(undefined)
223+
.map((_, i) => {
224+
// Set the height to the last known row height or otherwise the same height as the first row.
225+
// When going to a previous page, the number of rows may be greater than the current.
226226

227-
const getRow = () => (
228-
<Tr
229-
key={`skeleton-${i}`}
230-
{...skeletonRowProps}
231-
style={{
232-
...(skeletonRowProps.style || {}),
233-
height: rowHeightsRef.current?.[i] || rowHeightsRef.current?.[0],
234-
}}
235-
>
236-
{columns.map((col) => (
237-
<Td
238-
key={col.field}
239-
// assign classes to reserve space
240-
className={
241-
col.field === CHECKBOX_FIELD_ID || col.field === EXPAND_FIELD_ID
242-
? 'pf-c-table__toggle'
243-
: col.field === KEBAB_FIELD_ID
244-
? 'pf-c-table__action'
245-
: undefined
246-
}
247-
>
248-
{
249-
// render placeholders to reserve space
250-
col.field === EXPAND_FIELD_ID || col.field === KEBAB_FIELD_ID ? (
251-
<div style={{ width: 46 }} />
252-
) : col.field === CHECKBOX_FIELD_ID ? (
253-
<div style={{ width: 13 }} />
254-
) : (
255-
<Skeleton width="50%" />
256-
)
257-
}
258-
</Td>
259-
))}
260-
</Tr>
261-
);
262-
return disableRowRenderSupport ? (
263-
<Tbody key={`skeleton-tbody-${i}`}>{getRow()}</Tbody>
264-
) : (
265-
getRow()
266-
);
267-
})
227+
const getRow = () => (
228+
<Tr
229+
key={`skeleton-${i}`}
230+
{...skeletonRowProps}
231+
style={{
232+
...(skeletonRowProps.style || {}),
233+
height: rowHeightsRef.current?.[i] || rowHeightsRef.current?.[0],
234+
}}
235+
>
236+
{columns.map((col) => (
237+
<Td
238+
key={col.field}
239+
// assign classes to reserve space
240+
className={
241+
col.field === CHECKBOX_FIELD_ID || col.field === EXPAND_FIELD_ID
242+
? 'pf-c-table__toggle'
243+
: col.field === KEBAB_FIELD_ID
244+
? 'pf-c-table__action'
245+
: undefined
246+
}
247+
>
248+
{
249+
// render placeholders to reserve space
250+
col.field === EXPAND_FIELD_ID || col.field === KEBAB_FIELD_ID ? (
251+
<div style={{ width: 46 }} />
252+
) : col.field === CHECKBOX_FIELD_ID ? (
253+
<div style={{ width: 13 }} />
254+
) : (
255+
<Skeleton width="50%" />
256+
)
257+
}
258+
</Td>
259+
))}
260+
</Tr>
261+
);
262+
return disableRowRenderSupport ? (
263+
<Tbody key={`skeleton-tbody-${i}`}>{getRow()}</Tbody>
264+
) : (
265+
getRow()
266+
);
267+
})
268268
: data.map((row, rowIndex) => rowRenderer(row, rowIndex));
269269

270270
const table = (
@@ -299,7 +299,7 @@ const TableBase = <T,>({
299299
align={{ default: 'alignEnd' }}
300300
className="pf-v6-u-pr-lg"
301301
>
302-
{pagination('top')}
302+
303303
</ToolbarItem>
304304
)}
305305
</ToolbarContent>

0 commit comments

Comments
 (0)