search-results-view
[arvados-workbench2.git] / src / store / search-bar / search-bar-reducer.ts
index 97e22d7e1e8e0152b874d0bd501cf4769e8a6cd6..7e119d21dc4d83715a2d54048a25af7b158d1e0b 100644 (file)
@@ -3,10 +3,14 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { searchBarActions, SearchBarActions } from '~/store/search-bar/search-bar-actions';
+import { GroupContentsResource } from '~/services/groups-service/groups-service';
 
 interface SearchBar {
     currentView: string;
     open: boolean;
+    searchResults: GroupContentsResource[];
+    searchValue: string;
+    savedQueries: string[];
 }
 
 export enum SearchView {
@@ -17,7 +21,10 @@ export enum SearchView {
 
 const initialState: SearchBar = {
     currentView: SearchView.BASIC,
-    open: false
+    open: false,
+    searchResults: [],
+    searchValue: '',
+    savedQueries: []
 };
 
 export const searchBarReducer = (state = initialState, action: SearchBarActions): SearchBar =>
@@ -25,5 +32,8 @@ export const searchBarReducer = (state = initialState, action: SearchBarActions)
         SET_CURRENT_VIEW: currentView => ({ ...state, currentView }),
         OPEN_SEARCH_VIEW: () => ({ ...state, open: true }),
         CLOSE_SEARCH_VIEW: () => ({ ...state, open: false }),
+        SET_SEARCH_RESULTS: (searchResults) => ({ ...state, searchResults }),
+        SET_SEARCH_VALUE: (searchValue) => ({ ...state, searchValue }),
+        SET_SAVED_QUERIES: savedQueries => ({ ...state, savedQueries }),
         default: () => state
     });
\ No newline at end of file