Unverified Commit 38c3734d authored by Jim Ehrismann's avatar Jim Ehrismann Committed by GitHub
Browse files

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


* the select all checkbox should not select disabled items
Signed-off-by: default avatarJim Ehrismann <jehrismann@mirantis.com>

* remove improper bullet-proofing
Signed-off-by: default avatarJim Ehrismann <jehrismann@mirantis.com>

* added default for customizeTableRowProps
Signed-off-by: default avatarJim Ehrismann <jehrismann@mirantis.com>
parent f18d8618
Showing with 8 additions and 5 deletions
+8 -5
......@@ -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) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment