Skip to content

Commit

Permalink
[frontend] Display external reference of observables
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Hassine committed Feb 23, 2020
1 parent f0e9d6f commit dea6db9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import IconButton from '@material-ui/core/IconButton';
import Button from '@material-ui/core/Button';
import Avatar from '@material-ui/core/Avatar';
import Dialog from '@material-ui/core/Dialog';
import DialogTitle from '@material-ui/core/DialogTitle';
import DialogContent from '@material-ui/core/DialogContent';
import DialogContentText from '@material-ui/core/DialogContentText';
import DialogActions from '@material-ui/core/DialogActions';
import { LinkOff } from '@material-ui/icons';
import { compose } from 'ramda';
import Slide from '@material-ui/core/Slide';
import inject18n from '../../../../components/i18n';
import { truncate } from '../../../../utils/String';
import { commitMutation } from '../../../../relay/environment';
Expand Down Expand Up @@ -52,6 +52,11 @@ const styles = (theme) => ({
},
});

const Transition = React.forwardRef((props, ref) => (
<Slide direction="up" ref={ref} {...props} />
));
Transition.displayName = 'TransitionSlide';

class EntityExternalReferencesLinesContainer extends Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -204,20 +209,10 @@ class EntityExternalReferencesLinesContainer extends Component {
<Dialog
open={this.state.displayDialog}
keepMounted={true}
TransitionComponent={Transition}
onClose={this.handleCloseDialog.bind(this)}
>
<DialogTitle>{t('Confirmation required')}</DialogTitle>
<DialogContent>
{this.state.removeExternalReference != null && (
<DialogContentText>
{t('Removing')} '
{truncate(
this.state.removeExternalReference.node.source_name,
30,
)}
'.
</DialogContentText>
)}
<DialogContentText>
{t('Do you want to remove this external reference?')}
</DialogContentText>
Expand All @@ -228,14 +223,14 @@ class EntityExternalReferencesLinesContainer extends Component {
color="primary"
disabled={this.state.removing}
>
{t('No')}
{t('Cancel')}
</Button>
<Button
onClick={this.handleRemoval.bind(this)}
color="primary"
disabled={this.state.removing}
>
{t('Yes')}
{t('Delete')}
</Button>
</DialogActions>
</Dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import StixObservableEdition from './StixObservableEdition';
import EntityLastReports from '../../reports/EntityLastReports';
import StixObservableIndicators from './StixObservableIndicators';
import Security, { KNOWLEDGE_KNUPDATE } from '../../../../utils/Security';
import EntityExternalReferences from '../../common/external_references/EntityExternalReferences';

const styles = () => ({
container: {
Expand Down Expand Up @@ -44,7 +45,19 @@ class StixObservableComponent extends Component {
<EntityLastReports stixObservableId={stixObservable.id} />
</Grid>
</Grid>
<StixObservableIndicators stixObservable={stixObservable} />
<Grid
container={true}
spacing={3}
classes={{ container: classes.gridContainer }}
style={{ marginTop: 30 }}
>
<Grid item={true} xs={8}>
<StixObservableIndicators stixObservable={stixObservable} />
</Grid>
<Grid item={true} xs={4}>
<EntityExternalReferences entityId={stixObservable.id} />
</Grid>
</Grid>
<Security needs={[KNOWLEDGE_KNUPDATE]}>
<StixObservableEdition stixObservableId={stixObservable.id} />
</Security>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const styles = (theme) => ({
paper: {
height: '100%',
minHeight: '100%',
margin: '10px 0 0 0',
margin: '6px 0 0 0',
padding: '15px 15px 15px 15px',
borderRadius: 6,
},
Expand Down Expand Up @@ -188,7 +188,7 @@ class StixObservableIndicatorsComponent extends Component {
);
const sortedIndicators = sort(indicators);
return (
<div style={{ marginTop: 40 }}>
<div style={{ height: '100%' }}>
<Typography variant="h4" gutterBottom={true} style={{ float: 'left' }}>
{t('Indicators composed with this observable')}
</Typography>
Expand Down

0 comments on commit dea6db9

Please sign in to comment.