11import { PureComponent } from 'react' ;
22
33import List from '@material-ui/core/List' ;
4- import Typography from '@material-ui/core/Typography' ;
54import { Route , Switch , generatePath } from 'react-router-dom' ;
65import { compose } from 'redux' ;
76
87import AccessControlDialog from '../components/access/AccessControlDialog' ;
98import CollectionEntityAdd from '../components/collection/CollectionEntityAdd' ;
9+ import CollectionEntityRemove from '../components/collection/CollectionEntityRemove' ;
1010import CollectionExport from '../components/collection/CollectionExport' ;
1111import CollectionFolderMap from '../components/collection/CollectionFolderMap' ;
1212import CollectionRemove from '../components/collection/CollectionRemove' ;
1313import CollectionRename from '../components/collection/CollectionRename' ;
1414import DrawerContainer from '../components/ui/DrawerContainer' ;
1515import ListItemLink from '../components/ui/ListItemLink' ;
16- import Menu , { MenuItem } from '../components/ui/Menu' ;
1716import TitleHeader from '../components/ui/TitleHeader' ;
1817import withTabs from '../hoc/withTabs' ;
1918import withUI from '../hoc/withUI' ;
@@ -48,6 +47,7 @@ const COLLECTION_EXPORT_DIALOG = 'COLLECTION_EXPORT_DIALOG';
4847const COLLECTION_RENAME_DIALOG = 'COLLECTION_RENAME_DIALOG' ;
4948const COLLECTION_ENTITY_ADD_DIALOG = 'COLLECTION_ENTITY_ADD_DIALOG' ;
5049const COLLECTION_FOLDERMAP_DIALOG = 'COLLECTION_FOLDERMAP_DIALOG' ;
50+ const REMOVE_COLLECTION_ENTITY_GENERIC_DIALOG = 'REMOVE_COLLECTION_ENTITY_GENERIC_DIALOG' ;
5151const ACCESSGRAPH_TAB = 'ACCESSGRAPH_TAB' ;
5252const METADATAGRAPH_TAB = 'METADATAGRAPH_TAB' ;
5353const SEQUENCE_TAB = 'SEQUENCE_TAB' ;
@@ -210,7 +210,7 @@ class Collection extends PureComponent {
210210 }
211211
212212 render ( ) {
213- const { onChangeTab, tabValue, collectionId, history, onOpen } = this . props ;
213+ const { onChangeTab, tabValue, collectionId, history } = this . props ;
214214 const { collectionName } = this . state ;
215215 const titleComponent = ( props ) => (
216216 < TitleHeader
@@ -222,25 +222,41 @@ class Collection extends PureComponent {
222222 entityId = { collectionId }
223223 entityType = "collection"
224224 addAccessControl = { COLLECTION_ACCESSCONTROL_ADD_DIALOG }
225- exportModal = { COLLECTION_EXPORT_DIALOG }
226225 titleChip = { collectionName }
227- actionComponent = {
228- < Menu >
229- < MenuItem onClick = { ( ) => onOpen ( { modalName : COLLECTION_ENTITY_ADD_DIALOG } ) } >
230- < Typography > Add Entity</ Typography >
231- </ MenuItem >
232- < MenuItem onClick = { ( ) => onOpen ( { modalName : COLLECTION_RENAME_DIALOG } ) } >
233- < Typography > Rename</ Typography >
234- </ MenuItem >
235- < MenuItem onClick = { ( ) => onOpen ( { modalName : COLLECTION_FOLDERMAP_DIALOG } ) } >
236- < Typography > Map To Folder</ Typography >
237- </ MenuItem >
238- < MenuItem onClick = { ( ) => onOpen ( { modalName : COLLECTION_REMOVE_DIALOG } ) } >
239- < Typography color = "secondary" > Delete Collection</ Typography >
240- </ MenuItem >
241- </ Menu >
242- }
243226 { ...props }
227+ menuList = { [
228+ {
229+ label : 'Add Entity' ,
230+ modalName : COLLECTION_ENTITY_ADD_DIALOG ,
231+ } ,
232+ {
233+ label : 'Rename' ,
234+ modalName : COLLECTION_RENAME_DIALOG ,
235+ } ,
236+ {
237+ label : 'Map To Folder' ,
238+ modalName : COLLECTION_FOLDERMAP_DIALOG ,
239+ } ,
240+ {
241+ label : 'Add Access Control' ,
242+ modalName : COLLECTION_ACCESSCONTROL_ADD_DIALOG ,
243+ } ,
244+ {
245+ label : 'Export' ,
246+ modalName : COLLECTION_EXPORT_DIALOG ,
247+ } ,
248+ ...( props ?. menuList || [ ] ) ,
249+ {
250+ label : 'Remove Entity' ,
251+ modalName : REMOVE_COLLECTION_ENTITY_GENERIC_DIALOG ,
252+ color : 'secondary' ,
253+ } ,
254+ {
255+ label : 'Delete Collection' ,
256+ modalName : COLLECTION_REMOVE_DIALOG ,
257+ color : 'secondary' ,
258+ } ,
259+ ] }
244260 />
245261 ) ;
246262 return (
@@ -290,6 +306,11 @@ class Collection extends PureComponent {
290306 onSuccess = { ( response ) => history . push ( `/job/${ response . data . jobId } /` ) }
291307 collectionId = { collectionId }
292308 />
309+ < CollectionEntityRemove
310+ dialogName = { REMOVE_COLLECTION_ENTITY_GENERIC_DIALOG }
311+ onSuccess = { this . onRefresh }
312+ collectionId = { collectionId }
313+ />
293314 </ >
294315 ) ;
295316 }
0 commit comments