SET_SEARCH_RESULTS: ofType<GroupContentsResource[]>(),
SET_SEARCH_VALUE: ofType<string>(),
SET_SAVED_QUERIES: ofType<SearchBarAdvanceFormData[]>(),
SET_SEARCH_RESULTS: ofType<GroupContentsResource[]>(),
SET_SEARCH_VALUE: ofType<string>(),
SET_SAVED_QUERIES: ofType<SearchBarAdvanceFormData[]>(),
- UPDATE_SAVED_QUERY: ofType<SearchBarAdvanceFormData[]>()
+ SET_RECENT_QUERIES: ofType<string[]>(),
+ UPDATE_SAVED_QUERY: ofType<SearchBarAdvanceFormData[]>(),
+ SET_SELECTED_ITEM: ofType<string>(),
+ MOVE_UP: ofType<{}>(),
+ MOVE_DOWN: ofType<{}>(),
+ SELECT_FIRST_ITEM: ofType<{}>()
export const loadRecentQueries = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
export const loadRecentQueries = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const recentSearchQueries = services.searchService.getRecentQueries();
- return recentSearchQueries || [];
+ const recentQueries = services.searchService.getRecentQueries();
+ dispatch(searchBarActions.SET_RECENT_QUERIES(recentQueries));
+ return recentQueries;
const currentView = getState().searchBar.currentView;
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
const currentView = getState().searchBar.currentView;
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
- dispatch(searchBarActions.SET_SEARCH_RESULTS([]));
- dispatch<any>(searchGroups(searchValue));
- if (currentView === SearchView.BASIC) {
- dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
- dispatch(navigateToSearchResults);
+ if (searchValue.length > 0) {
+ dispatch<any>(searchGroups(searchValue, 5, {}));
+ if (currentView === SearchView.BASIC) {
+ dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
+ dispatch(navigateToSearchResults);
+ }
dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC));
dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
dispatch(navigateToSearchResults);
};
dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC));
dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
dispatch(navigateToSearchResults);
};
const saveQuery = (data: SearchBarAdvanceFormData) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const saveQuery = (data: SearchBarAdvanceFormData) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- dispatch(searchBarActions.UPDATE_SAVED_QUERY(savedSearchQueries));
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Query has been sucessfully updated', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+ dispatch(searchBarActions.UPDATE_SAVED_QUERY(savedQueries));
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Query has been successfully updated', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
- dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries));
- dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Query has been sucessfully saved', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
+ dispatch(searchBarActions.SET_SAVED_QUERIES(savedQueries));
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Query has been successfully saved', hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.ADVANCED));
dispatch(searchBarActions.SET_SEARCH_VALUE(data.searchQuery));
dispatch<any>(initialize(SEARCH_BAR_ADVANCE_FORM_NAME, data));
dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.ADVANCED));
dispatch(searchBarActions.SET_SEARCH_VALUE(data.searchQuery));
dispatch<any>(initialize(SEARCH_BAR_ADVANCE_FORM_NAME, data));
export const openSearchView = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
export const openSearchView = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const savedSearchQueries = services.searchService.getSavedQueries();
dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries));
const savedSearchQueries = services.searchService.getSavedQueries();
dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries));
- (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const isOpen = getState().searchBar.open;
- if (isOpen) {
- dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
- dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC));
- }
+ (dispatch: Dispatch<any>) => {
+ dispatch(searchBarActions.SET_SELECTED_ITEM(''));
+ dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
-export const closeAdvanceView = () =>
- (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+export const closeAdvanceView = () =>
+ (dispatch: Dispatch<any>) => {
dispatch(searchBarActions.SET_SEARCH_VALUE(''));
dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC));
};
export const navigateToItem = (uuid: string) =>
dispatch(searchBarActions.SET_SEARCH_VALUE(''));
dispatch(searchBarActions.SET_CURRENT_VIEW(SearchView.BASIC));
};
export const navigateToItem = (uuid: string) =>
-export const changeData = (searchValue: string) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+export const changeData = (searchValue: string) =>
+ (dispatch: Dispatch, getState: () => RootState) => {
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
const currentView = getState().searchBar.currentView;
const searchValuePresent = searchValue.length > 0;
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
const currentView = getState().searchBar.currentView;
const searchValuePresent = searchValue.length > 0;
dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
dispatch(searchBarActions.SET_SEARCH_RESULTS([]));
dispatch(searchBarActions.CLOSE_SEARCH_VIEW());
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
dispatch(searchBarActions.SET_SEARCH_RESULTS([]));
dispatch(navigateToSearchResults);
};
const debounceStartSearch = debounce((dispatch: Dispatch) => dispatch<any>(startSearch()), DEFAULT_SEARCH_DEBOUNCE);
dispatch(navigateToSearchResults);
};
const debounceStartSearch = debounce((dispatch: Dispatch) => dispatch<any>(startSearch()), DEFAULT_SEARCH_DEBOUNCE);
-const startSearch = () =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+const startSearch = () =>
+ (dispatch: Dispatch, getState: () => RootState) => {
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const currentView = getState().searchBar.currentView;
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
const currentView = getState().searchBar.currentView;
-export const getFilters = (filterName: string, searchValue: string, resourceKind?: ResourceKind): string => {
+export const getFilters = (filterName: string, searchValue: string, props: any): string => {
+ const { resourceKind, dateTo, dateFrom } = props;
return new FilterBuilder()
.addIsA("uuid", buildUuidFilter(resourceKind))
.addILike(filterName, searchValue, GroupContentsResourcePrefix.COLLECTION)
.addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS)
.addILike(filterName, searchValue, GroupContentsResourcePrefix.PROJECT)
return new FilterBuilder()
.addIsA("uuid", buildUuidFilter(resourceKind))
.addILike(filterName, searchValue, GroupContentsResourcePrefix.COLLECTION)
.addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS)
.addILike(filterName, searchValue, GroupContentsResourcePrefix.PROJECT)
dispatch<any>(initUserProject(SEARCH_BAR_ADVANCE_FORM_PICKER_ID));
};
export const changeAdvanceFormProperty = (property: string, value: PropertyValues[] | string = '') =>
dispatch<any>(initUserProject(SEARCH_BAR_ADVANCE_FORM_PICKER_ID));
};
export const changeAdvanceFormProperty = (property: string, value: PropertyValues[] | string = '') =>
dispatch(change(SEARCH_BAR_ADVANCE_FORM_NAME, property, value));
};
export const updateAdvanceFormProperties = (propertyValues: PropertyValues) =>
dispatch(change(SEARCH_BAR_ADVANCE_FORM_NAME, property, value));
};
export const updateAdvanceFormProperties = (propertyValues: PropertyValues) =>
- };
\ No newline at end of file
+ };
+
+export const moveUp = () =>
+ (dispatch: Dispatch) => {
+ dispatch(searchBarActions.MOVE_UP());
+ };
+
+export const moveDown = () =>
+ (dispatch: Dispatch) => {
+ dispatch(searchBarActions.MOVE_DOWN());
+ };