X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d9ee24d0f78a21603e2276d0d3142d4db40a831b..59cc1b248e39a17bbf46449add178d957b167b9a:/src/views/subprocess-panel/subprocess-panel.tsx?ds=sidebyside

diff --git a/src/views/subprocess-panel/subprocess-panel.tsx b/src/views/subprocess-panel/subprocess-panel.tsx
index 4717f2d7..cf1de9af 100644
--- a/src/views/subprocess-panel/subprocess-panel.tsx
+++ b/src/views/subprocess-panel/subprocess-panel.tsx
@@ -5,24 +5,37 @@
 import { Dispatch } from "redux";
 import { connect } from "react-redux";
 import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-menu/context-menu-actions';
-import { SubprocessPanelRoot, SubprocessActionProps } from '~/views/subprocess-panel/subprocess-panel-root';
+import { SubprocessPanelRoot, SubprocessPanelActionProps, SubprocessPanelDataProps } from '~/views/subprocess-panel/subprocess-panel-root';
 import { ResourceKind } from '~/models/resource';
+import { RootState } from "~/store/store";
+import { navigateTo } from "~/store/navigation/navigation-action";
+import { loadDetailsPanel } from "~/store/details-panel/details-panel-action";
+import { getProcess } from "~/store/processes/process";
 
-const mapDispatchToProps = (dispatch: Dispatch): SubprocessActionProps => ({
-    onContextMenu: (event, resourceUuid) => {
-        const kind = resourceKindToContextMenuKind(resourceUuid);
-        if (kind) {
+const mapDispatchToProps = (dispatch: Dispatch): SubprocessPanelActionProps => ({
+    onContextMenu: (event, resourceUuid, isAdmin) => {
+        const menuKind = resourceKindToContextMenuKind(resourceUuid, isAdmin);
+        const resource = getProcess(resourceUuid);
+        if (menuKind && resource) {
             dispatch<any>(openContextMenu(event, {
-                name: '',
+                name: resource.name,
                 uuid: resourceUuid,
                 ownerUuid: '',
                 kind: ResourceKind.PROCESS,
-                menuKind: kind
+                menuKind
             }));
         }
     },
-    onItemClick: (resourceUuid: string) => { return; },
-    onItemDoubleClick: uuid => { return; }
+    onItemClick: (uuid: string) => {
+        dispatch<any>(loadDetailsPanel(uuid));
+    },
+    onItemDoubleClick: uuid => {
+        dispatch<any>(navigateTo(uuid));
+    }
+});
+
+const mapStateToProps = (state: RootState): SubprocessPanelDataProps => ({
+    isAdmin: state.auth.user ? state.auth.user.isAdmin : false
 });
 
-export const SubprocessPanel = connect(mapDispatchToProps)(SubprocessPanelRoot);
\ No newline at end of file
+export const SubprocessPanel = connect(mapStateToProps, mapDispatchToProps)(SubprocessPanelRoot);
\ No newline at end of file
