-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add not vulnerable box to CVE detail header (#1784)
* feat: Add not vulnerable box to CVE detail header * Add not vulnerable system expandible section * Update snapshots * PR review fixes
- Loading branch information
Showing
14 changed files
with
186 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
src/Components/PresentationalComponents/CSAwRuleBox/NotVulnerableBox.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
Text, | ||
TextContent, | ||
TextVariants, | ||
SplitItem, | ||
Split, | ||
Card, | ||
CardBody, | ||
ExpandableSection | ||
} from '@patternfly/react-core'; | ||
import { useDispatch } from 'react-redux'; | ||
import { Link } from 'react-router-dom'; | ||
import { useIntl } from 'react-intl'; | ||
import messages from '../../../Messages'; | ||
import './CSAwRuleBox.scss'; | ||
import NotVulnerableLabel from '../Snippets/NotVulnerableLabel'; | ||
import { changeExposedSystemsParameters } from '../../../Store/Actions/Actions'; | ||
import { ONLY_NON_VULNERABLE_SYSTEMS } from '../../../Helpers/constants'; | ||
|
||
const NotVulnerableBox = ({ synopsis, notVulnerableSystemCount }) => { | ||
const dispatch = useDispatch(); | ||
const intl = useIntl(); | ||
|
||
const handleExposedSystemFilter = () => { | ||
dispatch(changeExposedSystemsParameters({ rule: ONLY_NON_VULNERABLE_SYSTEMS })); | ||
}; | ||
|
||
return ( | ||
notVulnerableSystemCount > 0 && | ||
<Card className="card-box" ouiaId="not-vulnerable-box"> | ||
<ExpandableSection toggleText={ | ||
<Split> | ||
<SplitItem className="pf-u-mr-xl"> | ||
<TextContent> | ||
<Text component={TextVariants.h4}> | ||
<NotVulnerableLabel className="pf-u-mr-sm" /> | ||
{intl.formatMessage(messages.notVulnerableBoxTitle)} | ||
</Text> | ||
</TextContent> | ||
</SplitItem> | ||
<SplitItem id="filter-affected-systems-split"> | ||
<TextContent> | ||
<Text | ||
id="filter-affected-systems" | ||
onClick={event => { | ||
handleExposedSystemFilter(); | ||
event.stopPropagation(); | ||
}} | ||
component={TextVariants.small} | ||
> | ||
<Link | ||
to={`/cves/${synopsis}`} | ||
> | ||
{ | ||
intl.formatMessage( | ||
messages.filterByAffectedSystems, | ||
{ | ||
count: notVulnerableSystemCount | ||
} | ||
) | ||
} | ||
</Link> | ||
</Text> | ||
</TextContent> | ||
</SplitItem> | ||
</Split> | ||
}> | ||
<CardBody className="rule-card-body"> | ||
{intl.formatMessage(messages.notVulnerableDescription, { multiple: true })} | ||
</CardBody> | ||
</ExpandableSection> | ||
</Card> | ||
); | ||
}; | ||
|
||
NotVulnerableBox.propTypes = { | ||
synopsis: PropTypes.string, | ||
notVulnerableSystemCount: PropTypes.number | ||
}; | ||
|
||
export default NotVulnerableBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.