diff --git a/libs/ui-lib/lib/common/components/hosts/AITable.tsx b/libs/ui-lib/lib/common/components/hosts/AITable.tsx index d40f2748fd..c22198e3a3 100644 --- a/libs/ui-lib/lib/common/components/hosts/AITable.tsx +++ b/libs/ui-lib/lib/common/components/hosts/AITable.tsx @@ -35,6 +35,7 @@ type TableMemoProps = { variant?: TableProps['variant']; // eslint-disable-next-line actionResolver?: ActionsResolver; + skipScroll?: boolean; }; const TableMemo: React.FC = React.memo( ({ @@ -48,6 +49,7 @@ const TableMemo: React.FC = React.memo( testId, variant, actionResolver, + skipScroll, }) => { const tableActionResolver = React.useCallback( // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access @@ -58,28 +60,27 @@ const TableMemo: React.FC = React.memo( const newProps = { canCollapseAll: false, }; - return ( - - document.body} - {...newProps} - > - - -
-
+ const tableElement = ( + document.body} + {...newProps} + > + + +
); + return skipScroll ? tableElement : {tableElement}; }, ); TableMemo.displayName = 'tableMemo'; @@ -155,6 +156,7 @@ export type AITableProps = ReturnType & { actionResolver?: ActionsResolver; canSelectAll?: boolean; variant?: TableProps['variant']; + skipScroll?: boolean; }; // eslint-disable-next-line const AITable = ({ @@ -177,6 +179,7 @@ const AITable = ({ perPageOptions, canSelectAll, variant, + skipScroll, }: WithTestID & AITableProps) => { const itemIDs = React.useMemo(() => data.map(getDataId), [data, getDataId]); React.useEffect(() => { @@ -331,6 +334,7 @@ const AITable = ({ data-testid={testId} actionResolver={actionResolver} variant={variant} + skipScroll={skipScroll} /> {showPagination && ( diff --git a/libs/ui-lib/lib/common/components/hosts/HostsTable.tsx b/libs/ui-lib/lib/common/components/hosts/HostsTable.tsx index e0900b9bc4..1266b3ce3a 100644 --- a/libs/ui-lib/lib/common/components/hosts/HostsTable.tsx +++ b/libs/ui-lib/lib/common/components/hosts/HostsTable.tsx @@ -62,6 +62,7 @@ type HostsTableProps = ReturnType & hosts: Host[]; skipDisabled?: boolean; children: React.ReactNode; + skipScroll?: boolean; }; const HostsTable = ({ hosts, skipDisabled, ...rest }: HostsTableProps & WithTestID) => { diff --git a/libs/ui-lib/lib/ocm/components/AddHosts/InventoryAddHost.tsx b/libs/ui-lib/lib/ocm/components/AddHosts/InventoryAddHost.tsx index 7d1146ea7a..c23c4b7cfc 100644 --- a/libs/ui-lib/lib/ocm/components/AddHosts/InventoryAddHost.tsx +++ b/libs/ui-lib/lib/ocm/components/AddHosts/InventoryAddHost.tsx @@ -40,7 +40,7 @@ const InventoryAddHosts = ({ cluster }: { cluster?: Cluster }) => { )} - + ); diff --git a/libs/ui-lib/lib/ocm/components/hosts/ClusterHostsTable.tsx b/libs/ui-lib/lib/ocm/components/hosts/ClusterHostsTable.tsx index 3a6023e480..f43752a8f5 100644 --- a/libs/ui-lib/lib/ocm/components/hosts/ClusterHostsTable.tsx +++ b/libs/ui-lib/lib/ocm/components/hosts/ClusterHostsTable.tsx @@ -43,9 +43,10 @@ export function ExpandComponent({ obj: host }: ExpandComponentProps) { export interface ClusterHostsTableProps { cluster: Cluster; skipDisabled?: boolean; + skipScroll?: boolean; } -const ClusterHostsTable = ({ cluster, skipDisabled }: ClusterHostsTableProps) => { +const ClusterHostsTable = ({ cluster, skipDisabled, skipScroll }: ClusterHostsTableProps) => { const { wizardPerPage, setWizardPerPage } = React.useContext(ClusterWizardContext) || {}; const { onEditHost, @@ -99,6 +100,7 @@ const ClusterHostsTable = ({ cluster, skipDisabled }: ClusterHostsTableProps) => content={content} actionResolver={actionResolver} variant={TableVariant.compact} + skipScroll={skipScroll} {...paginationProps} >