From aaffdd956489dde35d02e9b269bd3cc7922688be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20Olek=C5=A1=C3=A1k?= Date: Mon, 21 Mar 2022 09:13:57 -0400 Subject: [PATCH] fix(System CVE table): Fix sorting when canSelect is false (#1586) --- src/Components/SmartComponents/SystemCves/SystemCveTable.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Components/SmartComponents/SystemCves/SystemCveTable.js b/src/Components/SmartComponents/SystemCves/SystemCveTable.js index e1c6f7f60..eefd518c7 100644 --- a/src/Components/SmartComponents/SystemCves/SystemCveTable.js +++ b/src/Components/SmartComponents/SystemCves/SystemCveTable.js @@ -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 ? ( @@ -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