18584: Fixes error when creating a collection with selected files.
[arvados-workbench2.git] / src / store / details-panel / details-panel-reducer.ts
index 091b2fa2cf1adcfa55f19454fdae2f37d9fef7d9..6c32551cbf6926f9975e4bca40d1728295c54d05 100644 (file)
@@ -7,16 +7,19 @@ import { detailsPanelActions, DetailsPanelAction } from "./details-panel-action"
 export interface DetailsPanelState {
     resourceUuid: string;
     isOpened: boolean;
+    tabNr: number;
 }
 
 const initialState = {
     resourceUuid: '',
-    isOpened: false
+    isOpened: false,
+    tabNr: 0
 };
 
 export const detailsPanelReducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) =>
     detailsPanelActions.match(action, {
         default: () => state,
         LOAD_DETAILS_PANEL: resourceUuid => ({ ...state, resourceUuid }),
-        TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened })
+        OPEN_DETAILS_PANEL: tabNr => ({ ...state, isOpened: true, tabNr }),
+        TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened }),
     });