Skip to content

Commit

Permalink
fix: Fix row actions kebab not showing (#1451)
Browse files Browse the repository at this point in the history
* fix: Fix row actions kebab not showing

* Update snapshots
  • Loading branch information
leSamo authored Dec 22, 2021
1 parent 64ff02d commit 5cda81d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/Components/SmartComponents/SystemCves/SystemCveTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CVETableContext } from './SystemCves';
import messages from '../../../Messages';

const SystemCvesTableWithContext = ({ context, header, entity, canSelect }) => {
const { cves, methods, selectedCves, expandedRows, canEditStatus } = context;
const { cves, methods, selectedCves, expandedRows, canEditPairStatus } = context;

// TODO Material for refatoring when we'll introduce "manage column"
if (!cves?.meta?.patch_access) {
Expand Down Expand Up @@ -62,7 +62,7 @@ const SystemCvesTableWithContext = ({ context, header, entity, canSelect }) => {
cells={header}
rows={isEmpty ? noCves() : rows}
onSelect={(canSelect && !isEmpty) ? handleOnSelect : undefined}
actionResolver={(!isEmpty && canEditStatus) &&
actionResolver={(!isEmpty && canEditPairStatus) &&
((rowData, rowIndex) => systemCveTableRowActions(methods, entity, rowIndex.rowIndex))}
sortBy={!isEmpty
? createSortBy([{ key: 'collapse' }, { key: 'checkbox' }, ...header], cves.meta.sort) : undefined}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const SystemCveToolbarWithContext = ({
methods.openCves(isOpen, expandedRows, !isAllExpanded);
};

const { cves, parameters, methods, selectedCves, selectedRowsRawData, isAllExpanded, canEditStatus } = context;
const { cves, parameters, methods, selectedCves, selectedRowsRawData, isAllExpanded, canEditPairStatus } = context;
const { filter, advisory } = parameters;
const selectedCvesCount = selectedCves?.length ?? 0;
const remediableCves = selectedRowsRawData.filter(cves => cves.attributes.remediation === ANSIBLE_REMEDIATION);
Expand All @@ -55,7 +55,7 @@ const SystemCveToolbarWithContext = ({
}), [selectedCves, cves, parameters, methods]);

const actions = ['',
...canEditStatus ?
...canEditPairStatus ?
[{
label: intl.formatMessage(messages.editStatus),
onClick: () => methods.showStatusModal(selectedRowsRawData, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const mockContext = {
systems_affected: 1
}
}],

canEditPairStatus: true,
isAllExpanded: false,
methods: {
apply: jest.fn(),
Expand Down Expand Up @@ -115,7 +115,6 @@ const props = {
canExport: true,
canSelect: true,
canManageColumns: true,
canEditStatus: true,
customAction: <React.Fragment />
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,13 @@ exports[`SystemCvesTableToolbar Should render without errors 1`] = `
}
>
<injectIntl(SystemCveToolbar)
canEditStatus={true}
canExport={true}
canManageColumns={true}
canSelect={true}
customAction={<React.Fragment />}
entity="CVE-2019-6454"
>
<SystemCveToolbar
canEditStatus={true}
canExport={true}
canManageColumns={true}
canSelect={true}
Expand Down Expand Up @@ -96,12 +94,12 @@ exports[`SystemCvesTableToolbar Should render without errors 1`] = `
>
<SystemCveToolbarWithContext
apply={[Function]}
canEditStatus={true}
canExport={true}
canManageColumns={true}
canSelect={true}
context={
Object {
"canEditPairStatus": true,
"canEditStatus": true,
"canRemediate": true,
"cves": Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const SystemDetails = ({ entity, isOptOut, optOutSystemHandler, loaded, rbacPerm
showHeaderLabel
setPageTitle
canExport={canExport}
canEditStatus={canEditPairStatus}
canEditPairStatus={canEditPairStatus}
/>;
}
} else {
Expand Down

0 comments on commit 5cda81d

Please sign in to comment.