X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/0cd5438961771ca3887c67c1ef70d814ea9d27f7..375bef1554bb6c85068608b7c8f6c69622c04323:/src/store/search-bar/search-bar-actions.ts diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts index a076552829..2f30e02dc9 100644 --- a/src/store/search-bar/search-bar-actions.ts +++ b/src/store/search-bar/search-bar-actions.ts @@ -10,6 +10,7 @@ import { ServiceRepository } from '~/services/services'; import { FilterBuilder } from "~/services/api/filter-builder"; import { ResourceKind } from '~/models/resource'; import { GroupClass } from '~/models/group'; +import { SearchView } from '~/store/search-bar/search-bar-reducer'; export const searchBarActions = unionize({ SET_CURRENT_VIEW: ofType(), @@ -26,8 +27,10 @@ export interface SearchBarAdvanceFormData { type?: GroupContentsResource; cluster?: string; project?: string; + inTrash: boolean; dataFrom: string; dataTo: string; + saveQuery: boolean; searchQuery: string; } @@ -46,10 +49,12 @@ export const loadRecentQueries = () => return recentSearchQueries || []; }; -export const saveQuery = (query: string) => +export const saveQuery = (data: SearchBarAdvanceFormData) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - services.searchService.saveQuery(query); - dispatch(searchBarActions.SET_SAVED_QUERIES(services.searchService.getSavedQueries())); + if (data.saveQuery && data.searchQuery) { + services.searchService.saveQuery(data.searchQuery); + dispatch(searchBarActions.SET_SAVED_QUERIES(services.searchService.getSavedQueries())); + } }; export const deleteSavedQuery = (id: number) => @@ -63,6 +68,7 @@ export const deleteSavedQuery = (id: number) => export const openSearchView = () => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(searchBarActions.OPEN_SEARCH_VIEW()); + dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC)); const savedSearchQueries = services.searchService.getSavedQueries(); dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries)); };