#refs tooltips
[arvados-workbench2.git] / src / views / collection-panel / collection-panel.tsx
index 7621d95a05656c89c167e3be62c44669d6c1b21b..9672f30628de1b3930968588a643a9d844cda57c 100644 (file)
@@ -21,8 +21,7 @@ import { CollectionTagForm } from './collection-tag-form';
 import { deleteCollectionTag } from '~/store/collection-panel/collection-panel-action';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { getResource } from '~/store/resources/resources';
-import { loadCollection } from '../../store/collection-panel/collection-panel-action';
-import { contextMenuActions } from '~/store/context-menu/context-menu-actions';
+import { openContextMenu } from '~/store/context-menu/context-menu-actions';
 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
 
 type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value';
@@ -72,7 +71,6 @@ export const CollectionPanel = withStyles(styles)(
         };
     })(
         class extends React.Component<CollectionPanelProps> {
-
             render() {
                 const { classes, item, tags } = this.props;
                 return <div>
@@ -83,7 +81,9 @@ export const CollectionPanel = withStyles(styles)(
                                 <IconButton
                                     aria-label="More options"
                                     onClick={this.handleContextMenu}>
-                                    <MoreOptionsIcon />
+                                    <Tooltip title="More options">
+                                        <MoreOptionsIcon />
+                                    </Tooltip>
                                 </IconButton>
                             }
                             title={item && item.name}
@@ -135,20 +135,16 @@ export const CollectionPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
-                event.preventDefault();
-                const { uuid, name, description } = this.props.item;
+                const { uuid, ownerUuid, name, description, kind } = this.props.item;
                 const resource = {
                     uuid,
+                    ownerUuid,
                     name,
                     description,
-                    kind: ContextMenuKind.COLLECTION
+                    kind,
+                    menuKind: ContextMenuKind.COLLECTION
                 };
-                this.props.dispatch(
-                    contextMenuActions.OPEN_CONTEXT_MENU({
-                        position: { x: event.clientX, y: event.clientY },
-                        resource
-                    })
-                );
+                this.props.dispatch<any>(openContextMenu(event, resource));
             }
 
             handleDelete = (uuid: string) => () => {
@@ -161,14 +157,6 @@ export const CollectionPanel = withStyles(styles)(
                     hideDuration: 2000
                 }));
             }
-
-            componentDidMount() {
-                const { match, item } = this.props;
-                if (!item && match.params.id) {
-                    this.props.dispatch<any>(loadCollection(match.params.id));
-                }
-            }
-
         }
     )
 );