Metadata control extension - 'Clear selection' menu item is displayed for read-only mode
@@ -1394,11 +1394,6 @@ export default class Metadata extends React.Component {
if (selectedItems.length === 0) {
return null;
}
- if (
- roleModel.writeAllowed(this.props.folder.value) &&
- !this.props.readOnly &&
- roleModel.isManager.entities(this)
- ) {
const Actions = {
delete: 'delete-selected-items',
clearSelection: 'clear-selection',
@@ -1417,28 +1412,41 @@ export default class Metadata extends React.Component {
break;
}
};
- const menu = (
- <Menu
- onClick={triggerMenuItem}
- style={{width: 150}}
- >
+ const menuItems = [(
<Menu.Item
key={Actions.clearSelection}
>
Clear selection
</Menu.Item>
+ )];
+ if (
+ roleModel.writeAllowed(this.props.folder.value) &&
+ !this.props.readOnly &&
+ roleModel.isManager.entities(this)
+ ) {
+ menuItems.push((
<Menu.Item
key={Actions.copySelection}
>
Copy
</Menu.Item>
- <Menu.Divider />
+ ));
+ menuItems.push((<Menu.Divider key="divider" />));
+ menuItems.push((
<Menu.Item
key={Actions.delete}
style={{color: 'red'}}
>
Delete
</Menu.Item>
+ ));
+ }
+ const menu = (
+ <Menu
+ onClick={triggerMenuItem}
+ style={{width: 150}}
+ >
+ {menuItems}
</Menu>
);
return (
@@ -1465,19 +1473,6 @@ export default class Metadata extends React.Component {
</Dropdown>
</Button.Group>
);
- }
- return (
- <Button
- size="small"
- onClick={this.handleClickShowSelectedItems}
- >
- {
- selectedItemsAreShowing
- ? 'Show all metadata items'
- : `Show ${selectedItemsString}`
- }
- </Button>
- );
};
const renderRunButton = () => {
if (
