+interface CollectionInfoDataProps {
+ currentCollection: CollectionResource | undefined;
+}
+
+interface CollectionInfoDispatchProps {
+ editCollection: (collection: CollectionResource | undefined) => void;
+}
+
+const ciMapStateToProps = (state: RootState): CollectionInfoDataProps => {
+ return {
+ currentCollection: getResource<CollectionResource>(state.detailsPanel.resourceUuid)(state.resources),
+ };
+};
+
+const ciMapDispatchToProps = (dispatch: Dispatch): CollectionInfoDispatchProps => ({
+ editCollection: (collection: CollectionResource) =>
+ dispatch<any>(openCollectionUpdateDialog({
+ uuid: collection.uuid,
+ name: collection.name,
+ description: collection.description,
+ properties: collection.properties,
+ storageClassesDesired: collection.storageClassesDesired,
+ })),
+});
+
+type CollectionInfoProps = CollectionInfoDataProps & CollectionInfoDispatchProps & WithStyles<CssRules>;
+
+const CollectionInfo = withStyles(styles)(
+ connect(ciMapStateToProps, ciMapDispatchToProps)(
+ ({ currentCollection, editCollection, classes }: CollectionInfoProps) =>
+ currentCollection !== undefined
+ ? <div>
+ <Button
+ className={classes.editButton} variant='contained'
+ data-cy='details-panel-edit-btn' color='primary' size='small'
+ onClick={() => editCollection(currentCollection)}>
+ <RenameIcon className={classes.editIcon} /> Edit
+ </Button>
+ <CollectionDetailsAttributes classes={classes} twoCol={false} item={currentCollection} />
+ </div>
+ : <div />
+ )
+);
+