Skip to content

Commit

Permalink
feat(compliance): RHICOMPL-1532 SystemRulesTable addional toolbar items
Browse files Browse the repository at this point in the history
  • Loading branch information
vkrizan committed Apr 6, 2021
1 parent 2ddcbb6 commit f4db51e
Show file tree
Hide file tree
Showing 3 changed files with 1,133 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ class SystemRulesTable extends React.Component {
sortBy, page, itemsPerPage, selectedToRemediate
} = this.state;
const {
remediationsEnabled, system, loading, columns, handleSelect, selectedFilter
remediationsEnabled, system, loading, columns, handleSelect, selectedFilter,
toolbarItems
} = this.props;
const rules = this.getRules();
const filterChips = this.chipBuilder.chipsFor(this.state.activeFilters);
Expand Down Expand Up @@ -380,6 +381,7 @@ class SystemRulesTable extends React.Component {
/>
</ToolbarItem>
}
{ toolbarItems }
<ToolbarItem>
{ ruleCount } results
</ToolbarItem>
Expand Down Expand Up @@ -424,6 +426,7 @@ SystemRulesTable.propTypes = {
selectedFilter: propTypes.bool,
remediationAvailableFilter: propTypes.bool,
handleSelect: propTypes.func,
toolbarItems: propTypes.node,
columns: propTypes.arrayOf(
propTypes.shape(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import SystemRulesTable from './SystemRulesTable';
import { ToolbarItem } from '@patternfly/react-core';
import { SortByDirection } from '@patternfly/react-table';
import { TITLE_COLUMN } from '../Constants';
import { remediationsResponse, system, profileRules } from '../Fixtures';
Expand Down Expand Up @@ -42,6 +43,19 @@ describe('SystemRulesTable component', () => {
expect(toJson(wrapper)).toMatchSnapshot();
});

it('should render additional toolbar items', () => {
const wrapper = shallow(
<SystemRulesTable
profileRules={ profileRules }
loading={ false }
system={ system }
columns={ columns }
toolbarItems={ <ToolbarItem>Additional</ToolbarItem> }
/>
);
expect(toJson(wrapper)).toMatchSnapshot();
});

it('should render a loading table', () => {
const wrapper = shallow(
<SystemRulesTable
Expand Down
Loading

0 comments on commit f4db51e

Please sign in to comment.