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

the select all checkbox should not select disabled items (#2151)

* the select all checkbox should not select disabled items

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>

* remove improper bullet-proofing

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>

* added default for customizeTableRowProps

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann 2021-02-25 09:09:39 -05:00 committed by GitHub
parent f18d8618cd
commit 38c3734d5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -89,7 +89,8 @@ const defaultProps: Partial<ItemListLayoutProps> = {
filterItems: [],
hasDetailsView: true,
onDetails: noop,
virtual: true
virtual: true,
customizeTableRowProps: () => ({} as TableRowProps),
};
interface ItemListLayoutUserSettings {
@ -241,7 +242,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
sortItem={item}
selected={detailsItem && detailsItem.getId() === itemId}
onClick={hasDetailsView ? prevDefault(() => onDetails(item)) : undefined}
{...(customizeTableRowProps ? customizeTableRowProps(item) : {})}
{...customizeTableRowProps(item)}
>
{isSelectable && (
<TableCell
@ -392,19 +393,21 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
}
renderTableHeader() {
const { renderTableHeader, isSelectable, isConfigurable, store } = this.props;
const { customizeTableRowProps, renderTableHeader, isSelectable, isConfigurable, store } = this.props;
if (!renderTableHeader) {
return;
}
const enabledItems = this.items.filter(item => !customizeTableRowProps(item).disabled);
return (
<TableHead showTopLine nowrap>
{isSelectable && (
<TableCell
checkbox
isChecked={store.isSelectedAll(this.items)}
onClick={prevDefault(() => store.toggleSelectionAll(this.items))}
isChecked={store.isSelectedAll(enabledItems)}
onClick={prevDefault(() => store.toggleSelectionAll(enabledItems))}
/>
)}
{renderTableHeader.map((cellProps, index) => {