Skip to content

Commit

Permalink
fix(System CVE table): Fix sorting when canSelect is false (#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
leSamo authored Mar 21, 2022
1 parent 03c8a70 commit aaffdd9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Components/SmartComponents/SystemCves/SystemCveTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const SystemCvesTableWithContext = ({ context, header, entity, canSelect }) => {
return ({ ...cve, isOpen: current && current.isOpen });
}) : [];

const sortingHeader = [{ key: 'collapse' }, ...canSelect ? [{ key: 'checkbox' }] : [], ...header];

return (
!cves.isLoading ? (
<Fragment>
Expand All @@ -66,14 +68,14 @@ const SystemCvesTableWithContext = ({ context, header, entity, canSelect }) => {
actionResolver={(!isEmpty && canEditPairStatus) &&
((rowData, rowIndex) => systemCveTableRowActions(methods, entity, rowIndex.rowIndex))}
sortBy={!isEmpty
? createSortBy([{ key: 'collapse' }, { key: 'checkbox' }, ...header], cves.meta.sort) : undefined}
? createSortBy(sortingHeader, cves.meta.sort) : undefined}
onCollapse={!isEmpty ? (event, rowKey, isOpen) => handleOnCollapse(event, rowKey, isOpen) : undefined}
onSort={!isEmpty ?
(event, key, direction) =>
handleSortColumn(
key,
direction,
[{ key: 'collapse' }, { key: 'checkbox' }, ...header],
sortingHeader,
cves.meta.sort,
methods.apply
) : undefined
Expand Down

0 comments on commit aaffdd9

Please sign in to comment.