13860-process-statuses-filters
[arvados-workbench2.git] / src / store / context-menu / context-menu-actions.ts
index 406239997c68d01905644d47dc5b12299fb95aeb..e6f09542c4fb4a4e2b0cfb9997e2744fd7ca1976 100644 (file)
@@ -67,6 +67,24 @@ export const openSidePanelContextMenu = (event: React.MouseEvent<HTMLElement>, i
         }
     };
 
+export const openProcessContextMenu = (event: React.MouseEvent<HTMLElement>) =>
+    (dispatch: Dispatch, getState: () => RootState) => {
+        const { location } = getState().router;
+        const pathname = location ? location.pathname : '';
+        // ToDo: We get error from matchProcessRoute
+        // const match = matchProcessRoute(pathname); 
+        // console.log('match: ', match);
+        // const uuid = match ? match.params.id : '';
+        const uuid = pathname.split('/').slice(-1)[0];
+        const resource = {
+            uuid,
+            name: '',
+            description: '',
+            kind: ContextMenuKind.PROCESS
+        };
+        dispatch<any>(openContextMenu(event, resource));
+    };
+
 export const resourceKindToContextMenuKind = (uuid: string) => {
     const kind = extractUuidKind(uuid);
     switch (kind) {