diff --git a/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/EntityStixCoreRelationshipsSelection.js b/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/EntityStixCoreRelationshipsSelection.js new file mode 100644 index 000000000000..0a1fc2dcb14c --- /dev/null +++ b/opencti-platform/opencti-front/src/private/components/common/stix_core_relationships/EntityStixCoreRelationshipsSelection.js @@ -0,0 +1,166 @@ +import React, { Component } from 'react'; +import { compose } from 'ramda'; +import { withStyles } from '@material-ui/core/styles'; +import * as PropTypes from 'prop-types'; +import Grid from '@material-ui/core/Grid'; +import Drawer from '@material-ui/core/Drawer'; +import Select from '@material-ui/core/Select'; +import Input from '@material-ui/core/Input'; +import Chip from '@material-ui/core/Chip'; +import MenuItem from '@material-ui/core/MenuItem'; +import inject18n from '../../../../components/i18n'; +import EntityStixCoreRelationships from './EntityStixCoreRelationships'; + +const styles = (theme) => ({ + container: { + marginTop: 15, + }, + bottomNav: { + zIndex: 1000, + padding: '10px 200px 10px 205px', + backgroundColor: theme.palette.navBottom.background, + display: 'flex', + }, + chips: { + display: 'flex', + flexWrap: 'wrap', + }, + chip: { + margin: theme.spacing(1) / 4, + }, +}); + +class EntityStixCoreRelationshipsSelection extends Component { + constructor(props) { + super(props); + + const { targetStixCoreRelationshipTypes } = props; + const defaultRelationshipType = targetStixCoreRelationshipTypes[0]; + + this.state = { + openToType: false, + selectedRelationshipType: defaultRelationshipType, + }; + } + + handleOpenToType() { + this.setState({ openToType: true }); + } + + handleCloseToType() { + this.setState({ openToType: false }); + } + + handleChangeRelationshipType(event) { + const { value } = event.target; + + return this.setState({ openToType: false, selectedRelationshipType: value }); + } + + renderMenuItems() { + const { targetStixCoreRelationshipTypes } = this.props; + + return targetStixCoreRelationshipTypes.map( + (relationshipType) => this.renderMenuItem(relationshipType), + ); + } + + renderMenuItem(relationshipType) { + return ( + + ); + } + + getRelationshipTypeLabel(relationshipType) { + const { t } = this.props; + + return t(`relationship_${relationshipType}`); + } + + renderSelectedValue(relationshipType) { + const { classes } = this.props; + + return ( +