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