merge master
[arvados-workbench2.git] / src / store / context-menu / context-menu-reducer.ts
index b20ad723f23d9aec615ab4700ca48db90be9f840..7ce2b3e75449a705a1627cc4b62457eebc561d8b 100644 (file)
@@ -6,6 +6,7 @@ import { ResourceKind } from "../../models/resource";
 import { contextMenuActions, ContextMenuAction } from "./context-menu-actions";
 
 export interface ContextMenuState {
+    open: boolean;
     position: ContextMenuPosition;
     resource?: ContextMenuResource;
 }
@@ -18,16 +19,18 @@ export interface ContextMenuPosition {
 export interface ContextMenuResource {
     uuid: string;
     kind: string;
+    name: string;
 }
 
 const initialState = {
+    open: false,
     position: { x: 0, y: 0 }
 };
 
 export const contextMenuReducer = (state: ContextMenuState = initialState, action: ContextMenuAction) =>
     contextMenuActions.match(action, {
         default: () => state,
-        OPEN_CONTEXT_MENU: ({resource, position}) => ({ resource, position }),
-        CLOSE_CONTEXT_MENU: () => ({ position: state.position })
+        OPEN_CONTEXT_MENU: ({ resource, position }) => ({ open: true, resource, position }),
+        CLOSE_CONTEXT_MENU: () => ({ ...state, open: false })
     });