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

remove improper bullet-proofing

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann 2021-02-18 19:24:59 -05:00
parent 3dc1f639b3
commit ec1573dc4c

View File

@ -233,13 +233,6 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
if (!item) return; if (!item) return;
const itemId = item.getId(); const itemId = item.getId();
const customProps = customizeTableRowProps ? customizeTableRowProps(item) : {};
// make sure a disabled item is not in the selected state
if (customProps.disabled) {
store.unselect(item);
}
return ( return (
<TableRow <TableRow
key={itemId} key={itemId}
@ -248,7 +241,7 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
sortItem={item} sortItem={item}
selected={detailsItem && detailsItem.getId() === itemId} selected={detailsItem && detailsItem.getId() === itemId}
onClick={hasDetailsView ? prevDefault(() => onDetails(item)) : undefined} onClick={hasDetailsView ? prevDefault(() => onDetails(item)) : undefined}
{...customProps} {...(customizeTableRowProps ? customizeTableRowProps(item) : {})}
> >
{isSelectable && ( {isSelectable && (
<TableCell <TableCell
@ -405,18 +398,17 @@ export class ItemListLayout extends React.Component<ItemListLayoutProps> {
return; return;
} }
let items = this.items; const enabledItems = customizeTableRowProps
if ( customizeTableRowProps ) { ? this.items.filter(item => !customizeTableRowProps(item).disabled)
items = items.filter((item) => !customizeTableRowProps(item).disabled); : this.items;
}
return ( return (
<TableHead showTopLine nowrap> <TableHead showTopLine nowrap>
{isSelectable && ( {isSelectable && (
<TableCell <TableCell
checkbox checkbox
isChecked={store.isSelectedAll(items)} isChecked={store.isSelectedAll(enabledItems)}
onClick={prevDefault(() => store.toggleSelectionAll(items))} onClick={prevDefault(() => store.toggleSelectionAll(enabledItems))}
/> />
)} )}
{renderTableHeader.map((cellProps, index) => { {renderTableHeader.map((cellProps, index) => {