Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 52 additions & 52 deletions clients/ui/frontend/src/shared/components/table/TableBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
const selectAllRef = React.useRef(null);
const showPagination = enablePagination;

const pagination = (variant: 'top' | 'bottom') => (
const pagination = (variant: 'bottom') => (
<Pagination
isCompact
{...(!disableItemCount && { itemCount })}
Expand Down Expand Up @@ -214,57 +214,57 @@
const renderRows = () =>
loading
? // compute the number of items in the upcoming page
new Array(
itemCount === 0
? skeletonRowCount || rowHeightsRef.current?.length || MIN_PAGE_SIZE
: Math.max(0, Math.min(perPage, itemCount - perPage * (page - 1))),
)
.fill(undefined)
.map((_, i) => {
// Set the height to the last known row height or otherwise the same height as the first row.
// When going to a previous page, the number of rows may be greater than the current.
new Array(

Check failure on line 217 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
itemCount === 0

Check failure on line 218 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
? skeletonRowCount || rowHeightsRef.current?.length || MIN_PAGE_SIZE

Check failure on line 219 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
: Math.max(0, Math.min(perPage, itemCount - perPage * (page - 1))),

Check failure on line 220 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
)

Check failure on line 221 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
.fill(undefined)

Check failure on line 222 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
.map((_, i) => {

Check failure on line 223 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`
// Set the height to the last known row height or otherwise the same height as the first row.

Check failure on line 224 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Replace `··········` with `············`
// When going to a previous page, the number of rows may be greater than the current.

Check failure on line 225 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Insert `··`

const getRow = () => (
<Tr
key={`skeleton-${i}`}
{...skeletonRowProps}
style={{
...(skeletonRowProps.style || {}),
height: rowHeightsRef.current?.[i] || rowHeightsRef.current?.[0],
}}
>
{columns.map((col) => (
<Td
key={col.field}
// assign classes to reserve space
className={
col.field === CHECKBOX_FIELD_ID || col.field === EXPAND_FIELD_ID
? 'pf-c-table__toggle'
: col.field === KEBAB_FIELD_ID
? 'pf-c-table__action'
: undefined
}
>
{
// render placeholders to reserve space
col.field === EXPAND_FIELD_ID || col.field === KEBAB_FIELD_ID ? (
<div style={{ width: 46 }} />
) : col.field === CHECKBOX_FIELD_ID ? (
<div style={{ width: 13 }} />
) : (
<Skeleton width="50%" />
)
}
</Td>
))}
</Tr>
);
return disableRowRenderSupport ? (
<Tbody key={`skeleton-tbody-${i}`}>{getRow()}</Tbody>
) : (
getRow()
);
})
const getRow = () => (

Check failure on line 227 in clients/ui/frontend/src/shared/components/table/TableBase.tsx

View workflow job for this annotation

GitHub Actions / test-and-build

Replace `··········` with `············`
<Tr
key={`skeleton-${i}`}
{...skeletonRowProps}
style={{
...(skeletonRowProps.style || {}),
height: rowHeightsRef.current?.[i] || rowHeightsRef.current?.[0],
}}
>
{columns.map((col) => (
<Td
key={col.field}
// assign classes to reserve space
className={
col.field === CHECKBOX_FIELD_ID || col.field === EXPAND_FIELD_ID
? 'pf-c-table__toggle'
: col.field === KEBAB_FIELD_ID
? 'pf-c-table__action'
: undefined
}
>
{
// render placeholders to reserve space
col.field === EXPAND_FIELD_ID || col.field === KEBAB_FIELD_ID ? (
<div style={{ width: 46 }} />
) : col.field === CHECKBOX_FIELD_ID ? (
<div style={{ width: 13 }} />
) : (
<Skeleton width="50%" />
)
}
</Td>
))}
</Tr>
);
return disableRowRenderSupport ? (
<Tbody key={`skeleton-tbody-${i}`}>{getRow()}</Tbody>
) : (
getRow()
);
})
: data.map((row, rowIndex) => rowRenderer(row, rowIndex));

const table = (
Expand Down Expand Up @@ -299,7 +299,7 @@
align={{ default: 'alignEnd' }}
className="pf-v6-u-pr-lg"
>
{pagination('top')}

</ToolbarItem>
)}
</ToolbarContent>
Expand Down
Loading