[ARVADOS-WORKBENCH2] updated: 1.1.4-106-gc4d1ac3

Git user git at public.curoverse.com
Tue Jun 19 07:56:54 EDT 2018


Summary of changes:
 src/components/data-explorer/data-explorer.tsx | 90 +++++++++++++-------------
 1 file changed, 45 insertions(+), 45 deletions(-)

       via  c4d1ac35050791aabbd1665b55248f5e074eb337 (commit)
      from  7364c06cd354952de2d469aa6285b7624864acf7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit c4d1ac35050791aabbd1665b55248f5e074eb337
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Jun 19 13:56:27 2018 +0200

    Remove context actions from data-explorer state
    
    Feature #13634
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx
index 026820b..874c325 100644
--- a/src/components/data-explorer/data-explorer.tsx
+++ b/src/components/data-explorer/data-explorer.tsx
@@ -10,7 +10,7 @@ import MoreVertIcon from "@material-ui/icons/MoreVert";
 import { formatFileSize, formatDate } from '../../common/formatters';
 import { DataItem } from './data-item';
 import { mockAnchorFromMouseEvent } from '../popover/helpers';
-import ContextMenu, { ContextMenuActionGroup } from '../context-menu/context-menu';
+import ContextMenu from '../context-menu/context-menu';
 
 export interface DataExplorerContextActions {
     onAddToFavourite: (dataIitem: DataItem) => void;
@@ -32,44 +32,12 @@ interface DataExplorerState {
     contextMenu: {
         anchorEl?: HTMLElement;
         item?: DataItem;
-        actions: Array<ContextMenuActionGroup<DataItem>>;
     };
 }
 
 class DataExplorer extends React.Component<DataExplorerProps, DataExplorerState> {
     state: DataExplorerState = {
-        contextMenu: {
-            actions: [[{
-                icon: "fas fa-users fa-fw",
-                name: "Share",
-                onClick: this.handleContextAction("onShare")
-            }, {
-                icon: "fas fa-sign-out-alt fa-fw",
-                name: "Move to",
-                onClick: this.handleContextAction("onMoveTo")
-            }, {
-                icon: "fas fa-star fa-fw",
-                name: "Add to favourite",
-                onClick: this.handleContextAction("onAddToFavourite")
-            }, {
-                icon: "fas fa-edit fa-fw",
-                name: "Rename",
-                onClick: this.handleContextAction("onRename")
-            }, {
-                icon: "fas fa-copy fa-fw",
-                name: "Make a copy",
-                onClick: this.handleContextAction("onCopy")
-            }, {
-                icon: "fas fa-download fa-fw",
-                name: "Download",
-                onClick: this.handleContextAction("onDownload")
-            }], [{
-                icon: "fas fa-trash-alt fa-fw",
-                name: "Remove",
-                onClick: this.handleContextAction("onRemove")
-            }
-            ]]
-        },
+        contextMenu: {},
         columns: [{
             name: "Name",
             selected: true,
@@ -103,10 +71,42 @@ class DataExplorer extends React.Component<DataExplorerProps, DataExplorerState>
         }]
     };
 
+    contextMenuActions = [[{
+        icon: "fas fa-users fa-fw",
+        name: "Share",
+        onClick: this.handleContextAction("onShare")
+    }, {
+        icon: "fas fa-sign-out-alt fa-fw",
+        name: "Move to",
+        onClick: this.handleContextAction("onMoveTo")
+    }, {
+        icon: "fas fa-star fa-fw",
+        name: "Add to favourite",
+        onClick: this.handleContextAction("onAddToFavourite")
+    }, {
+        icon: "fas fa-edit fa-fw",
+        name: "Rename",
+        onClick: this.handleContextAction("onRename")
+    }, {
+        icon: "fas fa-copy fa-fw",
+        name: "Make a copy",
+        onClick: this.handleContextAction("onCopy")
+    }, {
+        icon: "fas fa-download fa-fw",
+        name: "Download",
+        onClick: this.handleContextAction("onDownload")
+    }], [{
+        icon: "fas fa-trash-alt fa-fw",
+        name: "Remove",
+        onClick: this.handleContextAction("onRemove")
+    }
+    ]];
+
     render() {
         return <Paper>
             <ContextMenu
                 {...this.state.contextMenu}
+                actions={this.contextMenuActions}
                 onClose={this.closeContextMenu} />
             <Toolbar>
                 <Grid container justify="flex-end">
@@ -156,25 +156,25 @@ class DataExplorer extends React.Component<DataExplorerProps, DataExplorerState>
 
     openItemMenuOnRowClick = (event: React.MouseEvent<HTMLElement>, item: DataItem) => {
         event.preventDefault();
-        this.setContextMenuState({
-            anchorEl: mockAnchorFromMouseEvent(event),
-            item
+        this.setState({
+            contextMenu: {
+                anchorEl: mockAnchorFromMouseEvent(event),
+                item
+            }
         });
     }
 
     openItemMenuOnActionsClick = (event: React.MouseEvent<HTMLElement>, item: DataItem) => {
-        this.setContextMenuState({
-            anchorEl: event.currentTarget,
-            item
+        this.setState({
+            contextMenu: {
+                anchorEl: event.currentTarget,
+                item
+            }
         });
     }
 
     closeContextMenu = () => {
-        this.setContextMenuState({});
-    }
-
-    setContextMenuState = (contextMenu: { anchorEl?: HTMLElement; item?: DataItem; }) => {
-        this.setState(prev => ({ contextMenu: { ...contextMenu, actions: prev.contextMenu.actions } }));
+        this.setState({ contextMenu: {} });
     }
 
     handleContextAction(action: keyof DataExplorerContextActions) {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list