■ ■ ■ ■ ■ ■
opencti-platform/opencti-front/src/private/components/techniques/data_components/DataComponentEditionContainer.js
1 | | - | import React, { Component } from 'react'; |
2 | | - | import PropTypes from 'prop-types'; |
3 | | - | import { graphql, createFragmentContainer } from 'react-relay'; |
4 | | - | import { compose } from 'ramda'; |
5 | | - | import withStyles from '@mui/styles/withStyles'; |
6 | | - | import Typography from '@mui/material/Typography'; |
7 | | - | import IconButton from '@mui/material/IconButton'; |
8 | | - | import { Close } from '@mui/icons-material'; |
9 | | - | import inject18n from '../../../../components/i18n'; |
10 | | - | import { SubscriptionAvatars } from '../../../../components/Subscription'; |
11 | | - | import DataComponentEditionOverview from "./DataComponentEditionOverview"; |
12 | | - | |
13 | | - | const styles = (theme) => ({ |
14 | | - | header: { |
15 | | - | backgroundColor: theme.palette.background.nav, |
16 | | - | padding: '20px 20px 20px 60px', |
17 | | - | }, |
18 | | - | closeButton: { |
19 | | - | position: 'absolute', |
20 | | - | top: 12, |
21 | | - | left: 5, |
22 | | - | color: 'inherit', |
23 | | - | }, |
24 | | - | importButton: { |
25 | | - | position: 'absolute', |
26 | | - | top: 15, |
27 | | - | right: 20, |
28 | | - | }, |
29 | | - | container: { |
30 | | - | padding: '10px 20px 20px 20px', |
31 | | - | }, |
32 | | - | appBar: { |
33 | | - | width: '100%', |
34 | | - | zIndex: theme.zIndex.drawer + 1, |
35 | | - | borderBottom: '1px solid #5c5c5c', |
36 | | - | }, |
37 | | - | title: { |
38 | | - | float: 'left', |
39 | | - | }, |
40 | | - | }); |
41 | | - | |
42 | | - | class DataComponentEditionContainer extends Component { |
43 | | - | constructor(props) { |
44 | | - | super(props); |
45 | | - | this.state = { currentTab: 0 }; |
46 | | - | } |
47 | | - | |
48 | | - | handleChangeTab(event, value) { |
49 | | - | this.setState({ currentTab: value }); |
50 | | - | } |
51 | | - | |
52 | | - | render() { |
53 | | - | const { t, classes, handleClose, dataComponent } = this.props; |
54 | | - | const { editContext } = dataComponent; |
55 | | - | return ( |
56 | | - | <div> |
57 | | - | <div className={classes.header}> |
58 | | - | <IconButton |
59 | | - | aria-label="Close" |
60 | | - | className={classes.closeButton} |
61 | | - | onClick={handleClose.bind(this)} |
62 | | - | size="large" |
63 | | - | color="primary" |
64 | | - | > |
65 | | - | <Close fontSize="small" color="primary" /> |
66 | | - | </IconButton> |
67 | | - | <Typography variant="h6" classes={{ root: classes.title }}> |
68 | | - | {t('Update a data component')} |
69 | | - | </Typography> |
70 | | - | <SubscriptionAvatars context={editContext} /> |
71 | | - | <div className="clearfix" /> |
72 | | - | </div> |
73 | | - | <div className={classes.container}> |
74 | | - | <DataComponentEditionOverview |
75 | | - | dataComponent={dataComponent} |
76 | | - | enableReferences={this.props.enableReferences} |
77 | | - | context={editContext} |
78 | | - | handleClose={handleClose.bind(this)} |
79 | | - | /> |
80 | | - | </div> |
81 | | - | </div> |
82 | | - | ); |
83 | | - | } |
84 | | - | } |
85 | | - | |
86 | | - | DataComponentEditionContainer.propTypes = { |
87 | | - | handleClose: PropTypes.func, |
88 | | - | classes: PropTypes.object, |
89 | | - | dataComponent: PropTypes.object, |
90 | | - | theme: PropTypes.object, |
91 | | - | t: PropTypes.func, |
92 | | - | }; |
93 | | - | |
94 | | - | const DataComponentEditionFragment = createFragmentContainer( |
95 | | - | DataComponentEditionContainer, |
96 | | - | { |
97 | | - | dataComponent: graphql` |
98 | | - | fragment DataComponentEditionContainer_dataComponent on DataComponent { |
99 | | - | id |
100 | | - | ...DataComponentEditionOverview_dataComponent |
101 | | - | editContext { |
102 | | - | name |
103 | | - | focusOn |
104 | | - | } |
105 | | - | } |
106 | | - | `, |
107 | | - | }, |
108 | | - | ); |
109 | | - | |
110 | | - | export default compose( |
111 | | - | inject18n, |
112 | | - | withStyles(styles, { withTheme: true }), |
113 | | - | )(DataComponentEditionFragment); |
114 | | - | |