Skip to content

Commit

Permalink
fix(cve-toolbar): showAll should be optional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jiridostal committed Dec 13, 2018
1 parent afeb831 commit c337e53
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class SystemDetail extends React.Component {
header={header}
dataSelector={sCveTableBySystem}
fetchResource={params => fetchCveListBySystem({ ...params, system: this.props.affectedSystemId })}
showAllCheckbox={false}
/>
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ class VulnerabilitiesCveTableToolbar extends React.Component {
{ value: '8to10', label: '8 - 10', disabled: false }
];
let DateOptions = [{ value: 'All', label: 'All', disabled: false }, { value: 'Other', label: 'Other', disabled: false }];
let showAll = (
<React.Fragment>
<br />
<Checkbox
label="Display CVEs that don't affect any of my systems"
isChecked={this.state.toolbarConfig.showAll}
onChange={state => this.changeCheckboxValue(state)}
aria-label="controlled checkbox example"
id="check-1"
/>
</React.Fragment>
);
return (
<React.Fragment>
<Toolbar className="cvetable-toolbar">
Expand Down Expand Up @@ -114,14 +126,7 @@ class VulnerabilitiesCveTableToolbar extends React.Component {
<ToolbarItem>0 Results</ToolbarItem>
</ToolbarGroup>
</Toolbar>
<br />
<Checkbox
label="Display CVEs that don't affect any of my systems"
isChecked={this.state.toolbarConfig.showAll}
onChange={state => this.changeCheckboxValue(state)}
aria-label="controlled checkbox example"
id="check-1"
/>
{!this.props.showAllCheckbox || showAll}
</React.Fragment>
);
}
Expand All @@ -131,7 +136,8 @@ VulnerabilitiesCveTableToolbar.propTypes = {
CVETable: dataShape,
fetchData: propTypes.func,
applyToolbarConfig: propTypes.func,
apply: propTypes.func
apply: propTypes.func,
showAllCheckbox: propTypes.bool
};

export default routerParams(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class VulnerabilitiesCves extends React.Component {
<React.Fragment>
<Stack gutter="lg">
<StackItem>
<VulnerabilitiesCveTableToolbar apply={this.apply} />
<VulnerabilitiesCveTableToolbar apply={this.apply} showAllCheckbox={this.props.showAllCheckbox} />
</StackItem>
<StackItem>
<VulnerabilitiesCveTable header={this.props.header} cves={cves} apply={this.apply} />
Expand Down Expand Up @@ -73,15 +73,17 @@ VulnerabilitiesCves.defaultProps = {
{ title: 'Publish date', key: 'public_date', width: 10 }
],
fetchResource: fetchCveListByAccount,
dataSelector: sCveTableByAccount
dataSelector: sCveTableByAccount,
showAllCheckbox: true
};

VulnerabilitiesCves.propTypes = {
CVETable: dataShape,
fetchData: propTypes.func,
fetchResource: propTypes.func,
header: propTypes.array,
dataSelector: propTypes.func
dataSelector: propTypes.func,
showAllCheckbox: propTypes.bool
};

export default routerParams(
Expand Down

0 comments on commit c337e53

Please sign in to comment.