-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathInsightsSystemRule.js
62 lines (56 loc) · 2.33 KB
/
InsightsSystemRule.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React, { Fragment } from 'react';
import { Text, TextContent, TextVariants, Tooltip } from '@patternfly/react-core';
import PropType from 'prop-types';
import { FormattedMessage } from 'react-intl';
import { InsightsReportCard } from '@redhat-cloud-services/frontend-components-inventory-insights';
import { CSAwIcon } from '../../PresentationalComponents/CSAwIcon/CSAwIcon';
import Label from '../../PresentationalComponents/Snippets/Label';
import messages from '../../../Messages';
export const InsightsSystemRule = ({ rule, cve }) => {
return (
<Fragment>
{ !rule ? <InsightsNoSystemRule cve={cve}/> :
<Fragment>
<TextContent className="icon-with-label">
<Text component={TextVariants.h3} style={{ paddingLeft: 'var(--pf-global--spacer--lg)' }}>
<Label>
<Tooltip content={<FormattedMessage {...messages.rulesIconTooltip} />}>
<CSAwIcon />
</Tooltip>
</Label>
<span className="rule-name">{rule.rule.description || rule.rule.rule_id}</span>
</Text>
</TextContent>
<InsightsReportCard report={rule} />
</Fragment>
}
</Fragment>
);
};
InsightsSystemRule.propTypes = {
rule: PropType.shape({
rule: PropType.object,
details: PropType.object,
resulotion: PropType.object
}).isRequired,
cve: PropType.string
};
export const InsightsNoSystemRule = ({ cve }) => {
return (
<TextContent className="icon-with-label">
<Text component={TextVariants.p}>
<FormattedMessage {...messages.exposedSystemNoRules} values={{ cve }} />
</Text>
<Text component={TextVariants.p}>
<FormattedMessage {...messages.exposedSystemNoRulesInfo}/> <CSAwIcon/>
<br/>
<a target="_blank" rel="noopener noreferrer" href="https://access.redhat.com/articles/2968471">
<FormattedMessage {...messages.exposedSystemNoRulesInfoLink} />
</a>
</Text>
</TextContent>
);
};
InsightsNoSystemRule.propTypes = {
cve: PropType.string
};