■ ■ ■ ■ ■ ■
opencti-platform/opencti-front/src/private/components/techniques/data_components/DataComponentPopover.tsx
| skipped 12 lines |
13 | 13 | | import makeStyles from '@mui/styles/makeStyles'; |
14 | 14 | | import { graphql } from 'react-relay'; |
15 | 15 | | import { Theme } from '@mui/material/styles/createTheme'; |
| 16 | + | import Slide from '@mui/material/Slide'; |
16 | 17 | | import { useFormatter } from '../../../../components/i18n'; |
17 | 18 | | import { commitMutation, QueryRenderer } from '../../../../relay/environment'; |
18 | 19 | | import Loader, { LoaderVariant } from '../../../../components/Loader'; |
19 | | - | import Security, { KNOWLEDGE_KNUPDATE_KNDELETE, } from '../../../../utils/Security'; |
| 20 | + | import Security, { KNOWLEDGE_KNUPDATE_KNDELETE } from '../../../../utils/Security'; |
20 | 21 | | import { dataComponentEditionQuery } from './DataComponentEdition'; |
21 | 22 | | import DataComponentEditionContainer from './DataComponentEditionContainer'; |
22 | | - | import Transition from '../../../../components/Transition'; |
| 23 | + | import { deleteNode } from '../../../../utils/Store'; |
| 24 | + | import { PaginationOptions } from '../../../../components/list_lines'; |
23 | 25 | | |
24 | 26 | | const styles = makeStyles<Theme>((theme) => ({ |
25 | 27 | | container: { |
| skipped 19 lines |
45 | 47 | | `; |
46 | 48 | | |
47 | 49 | | interface DataComponentPopoverProps { |
48 | | - | dataComponentId: string |
| 50 | + | dataComponentId: string, |
| 51 | + | paginationOptions: PaginationOptions, |
49 | 52 | | } |
50 | 53 | | |
51 | | - | const DataComponentPopover: FunctionComponent<DataComponentPopoverProps> = ({ dataComponentId }) => { |
| 54 | + | const DataComponentPopover: FunctionComponent<DataComponentPopoverProps> = ({ dataComponentId, paginationOptions }) => { |
52 | 55 | | const { t } = useFormatter(); |
53 | 56 | | const classes = styles(); |
54 | 57 | | const history = useHistory(); |
| skipped 5 lines |
60 | 63 | | |
61 | 64 | | const handleOpen = (event: React.MouseEvent<HTMLElement>) => { |
62 | 65 | | setAnchorEl(event.currentTarget); |
63 | | - | } |
| 66 | + | }; |
64 | 67 | | |
65 | 68 | | const handleClose = () => { |
66 | 69 | | setAnchorEl(null); |
67 | | - | } |
| 70 | + | }; |
68 | 71 | | |
69 | 72 | | const handleOpenDelete = () => { |
70 | 73 | | setDisplayEdit(true); |
71 | 74 | | handleClose(); |
72 | | - | } |
| 75 | + | }; |
73 | 76 | | |
74 | 77 | | const handleCloseDelete = () => { |
75 | 78 | | setDisplayDelete(false); |
76 | | - | } |
| 79 | + | }; |
77 | 80 | | |
78 | 81 | | const submitDelete = () => { |
79 | 82 | | setDeleting(true); |
| skipped 7 lines |
87 | 90 | | handleClose(); |
88 | 91 | | history.push('/dashboard/techniques/data_component'); |
89 | 92 | | }, |
90 | | - | updater: undefined, |
| 93 | + | updater: (store: any) => deleteNode(store, 'Pagination_dataComponents', paginationOptions, dataComponentId), |
91 | 94 | | optimisticUpdater: undefined, |
92 | 95 | | optimisticResponse: undefined, |
93 | 96 | | onError: undefined, |
94 | 97 | | setSubmitting: undefined, |
95 | 98 | | }); |
96 | | - | } |
| 99 | + | }; |
97 | 100 | | |
98 | 101 | | const handleOpenEdit = () => { |
99 | 102 | | setDisplayEdit(true); |
100 | 103 | | handleClose(); |
101 | | - | } |
| 104 | + | }; |
102 | 105 | | |
103 | 106 | | const handleCloseEdit = () => { |
104 | 107 | | setDisplayEdit(false); |
105 | | - | } |
| 108 | + | }; |
106 | 109 | | |
107 | 110 | | return ( |
108 | 111 | | <div className={classes.container}> |
| skipped 22 lines |
131 | 134 | | <Dialog |
132 | 135 | | open={displayDelete} |
133 | 136 | | keepMounted={true} |
134 | | - | TransitionComponent={Transition} |
135 | 137 | | PaperProps={{ elevation: 1 }} |
136 | 138 | | onClose={handleCloseDelete} |
137 | 139 | | > |
| skipped 44 lines |
182 | 184 | | </Drawer> |
183 | 185 | | </div> |
184 | 186 | | ); |
185 | | - | } |
| 187 | + | }; |
186 | 188 | | |
187 | 189 | | export default DataComponentPopover; |
188 | 190 | | |