|
1 | 1 | import type { FC, ReactNode } from 'react'; |
2 | 2 |
|
3 | 3 | import { Bullseye } from '@patternfly/react-core'; |
4 | | -import { Table, Tbody, Td, Thead, Tr } from '@patternfly/react-table'; |
| 4 | +import { InnerScrollContainer, Table, Tbody, Td, Thead, Tr } from '@patternfly/react-table'; |
5 | 5 | import { isEmpty } from '@utils/helpers'; |
6 | 6 |
|
7 | 7 | import { UID } from '../utils/constants'; |
@@ -43,34 +43,36 @@ export const TableView = <T,>({ |
43 | 43 | const columnSignature = visibleColumns.map(({ resourceFieldId: id }) => id).join(); |
44 | 44 |
|
45 | 45 | return ( |
46 | | - <Table aria-label={ariaLabel} variant="compact" isStickyHeader className="table-view"> |
47 | | - <Thead> |
48 | | - <Tr> |
49 | | - <Header {...{ activeSort, dataOnScreen: entities, setActiveSort, visibleColumns }} /> |
50 | | - </Tr> |
51 | | - </Thead> |
52 | | - <Tbody> |
53 | | - {hasChildren && ( |
| 46 | + <InnerScrollContainer> |
| 47 | + <Table aria-label={ariaLabel} variant="compact" isStickyHeader className="table-view"> |
| 48 | + <Thead> |
54 | 49 | <Tr> |
55 | | - <Td colSpan={emptyStateColSpan as number}> |
56 | | - <Bullseye>{children}</Bullseye> |
57 | | - </Td> |
| 50 | + <Header {...{ activeSort, dataOnScreen: entities, setActiveSort, visibleColumns }} /> |
58 | 51 | </Tr> |
59 | | - )} |
60 | | - {!hasChildren && |
61 | | - entities.map((resourceData: T, index) => ( |
62 | | - <Row |
63 | | - key={`${columnSignature}_${String(resourceData?.[uidFieldId as keyof T] ?? index)}`} |
64 | | - resourceData={resourceData} |
65 | | - resourceFields={visibleColumns} |
66 | | - namespace={currentNamespace} |
67 | | - resourceIndex={index} |
68 | | - length={visibleColumns.length} |
69 | | - isExpanded={expandedIds?.includes(toId ? toId(resourceData) : '')} |
70 | | - /> |
71 | | - ))} |
72 | | - </Tbody> |
73 | | - </Table> |
| 52 | + </Thead> |
| 53 | + <Tbody> |
| 54 | + {hasChildren && ( |
| 55 | + <Tr> |
| 56 | + <Td colSpan={emptyStateColSpan as number}> |
| 57 | + <Bullseye>{children}</Bullseye> |
| 58 | + </Td> |
| 59 | + </Tr> |
| 60 | + )} |
| 61 | + {!hasChildren && |
| 62 | + entities.map((resourceData: T, index) => ( |
| 63 | + <Row |
| 64 | + key={`${columnSignature}_${String(resourceData?.[uidFieldId as keyof T] ?? index)}`} |
| 65 | + resourceData={resourceData} |
| 66 | + resourceFields={visibleColumns} |
| 67 | + namespace={currentNamespace} |
| 68 | + resourceIndex={index} |
| 69 | + length={visibleColumns.length} |
| 70 | + isExpanded={expandedIds?.includes(toId ? toId(resourceData) : '')} |
| 71 | + /> |
| 72 | + ))} |
| 73 | + </Tbody> |
| 74 | + </Table> |
| 75 | + </InnerScrollContainer> |
74 | 76 | ); |
75 | 77 | }; |
76 | 78 |
|
|
0 commit comments