/
ThreatActorIndicators.js
102 lines (97 loc) · 2.82 KB
/
ThreatActorIndicators.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { compose } from 'ramda';
import { Route, withRouter } from 'react-router-dom';
import { createFragmentContainer } from 'react-relay';
import graphql from 'babel-plugin-relay/macro';
import { withStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import inject18n from '../../../../components/i18n';
import ThreatActorPopover from './ThreatActorPopover';
import StixRelation from '../../common/stix_relations/StixRelation';
import EntityIndicators from '../../signatures/indicators/EntityIndicators';
import StixDomainEntityHeader from '../../common/stix_domain_entities/StixDomainEntityHeader';
const styles = () => ({
container: {
margin: 0,
},
containerWithoutPadding: {
margin: 0,
padding: 0,
},
paper: {
height: '100%',
minHeight: '100%',
margin: '5px 0 40px 0',
padding: '15px',
borderRadius: 6,
},
});
class ThreatActorIndicatorsComponent extends Component {
render() {
const { classes, threatActor, location } = this.props;
const link = `/dashboard/threats/threat_actors/${threatActor.id}/indicators`;
return (
<div
className={
location.pathname.includes(
`/dashboard/threats/threat_actors/${threatActor.id}/indicators/relations/`,
)
? classes.containerWithoutPadding
: classes.container
}>
<StixDomainEntityHeader
stixDomainEntity={threatActor}
PopoverComponent={<ThreatActorPopover />}
/>
<Route
exact
path="/dashboard/threats/threat_actors/:threatActorId/indicators/relations/:relationId"
render={(routeProps) => (
<StixRelation
entityId={threatActor.id}
{...routeProps}
/>
)}
/>
<Route
exact
path="/dashboard/threats/threat_actors/:threatActorId/indicators"
render={(routeProps) => (
<Paper classes={{ root: classes.paper }} elevation={2}>
<EntityIndicators
entityId={threatActor.id}
relationType="indicates"
entityLink={link}
{...routeProps}
/>
</Paper>
)}
/>
</div>
);
}
}
ThreatActorIndicatorsComponent.propTypes = {
threatActor: PropTypes.object,
location: PropTypes.object,
classes: PropTypes.object,
t: PropTypes.func,
};
const ThreatActorIndicators = createFragmentContainer(
ThreatActorIndicatorsComponent,
{
threatActor: graphql`
fragment ThreatActorIndicators_threatActor on ThreatActor {
id
name
alias
}
`,
},
);
export default compose(
inject18n,
withRouter,
withStyles(styles),
)(ThreatActorIndicators);