1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Make selecting item in ItemListLayout not scroll to top

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen 2022-02-02 08:22:17 +02:00
parent aa850f8e79
commit 63ea9d49ac
No known key found for this signature in database
GPG Key ID: 8C6CFB2FFFE8F68A

View File

@ -237,7 +237,6 @@ export class ItemListLayoutContent<I extends ItemObject> extends React.Component
store, hasDetailsView, addRemoveButtons = {}, virtual, sortingCallbacks, store, hasDetailsView, addRemoveButtons = {}, virtual, sortingCallbacks,
detailsItem, className, tableProps = {}, tableId, detailsItem, className, tableProps = {}, tableId,
} = this.props; } = this.props;
const { selectedItems } = store;
const selectedItemId = detailsItem && detailsItem.getId(); const selectedItemId = detailsItem && detailsItem.getId();
const classNames = cssNames(className, "box", "grow", ThemeStore.getInstance().activeTheme.type); const classNames = cssNames(className, "box", "grow", ThemeStore.getInstance().activeTheme.type);
@ -258,11 +257,18 @@ export class ItemListLayoutContent<I extends ItemObject> extends React.Component
{this.renderTableHeader()} {this.renderTableHeader()}
{this.renderItems()} {this.renderItems()}
</Table> </Table>
<Observer>
{() => (
<AddRemoveButtons <AddRemoveButtons
onRemove={selectedItems.length ? this.removeItemsDialog : null} onRemove={
removeTooltip={`Remove selected items (${selectedItems.length})`} store.selectedItems.length ? this.removeItemsDialog : null
}
removeTooltip={`Remove selected items (${store.selectedItems.length})`}
{...addRemoveButtons} {...addRemoveButtons}
/> />
)}
</Observer>
</div> </div>
); );
} }