[ARVADOS-WORKBENCH2] updated: 1.2.0-597-g0cd5438
Git user
git at public.curoverse.com
Thu Oct 11 05:48:49 EDT 2018
Summary of changes:
src/services/search-service/search-service.ts | 2 +-
src/services/services.ts | 6 ++---
src/store/search-bar/search-bar-actions.ts | 26 ++++++++++++++--------
src/store/search-bar/search-bar-reducer.ts | 2 +-
.../form-fields/search-bar-form-fields.tsx | 2 +-
.../search-bar/search-bar-advanced-view.tsx | 8 +++++--
.../search-bar/search-bar-view.tsx | 6 ++---
src/views-components/search-bar/search-bar.tsx | 7 +++---
8 files changed, 36 insertions(+), 23 deletions(-)
via 0cd5438961771ca3887c67c1ef70d814ea9d27f7 (commit)
from e5696ae072134453e8a0845a4cc58288e3b3163c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit 0cd5438961771ca3887c67c1ef70d814ea9d27f7
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Thu Oct 11 11:48:33 2018 +0200
cr changes
Feature #14308
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/services/search-service/search-service.ts b/src/services/search-service/search-service.ts
index c394da5..8a218bd 100644
--- a/src/services/search-service/search-service.ts
+++ b/src/services/search-service/search-service.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-export class SearchQueriesService {
+export class SearchService {
private recentQueries: string[] = this.getRecentQueries();
private savedQueries: string[] = this.getSavedQueries();
diff --git a/src/services/services.ts b/src/services/services.ts
index 205d16c..806fcae 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -22,7 +22,7 @@ import { ContainerService } from './container-service/container-service';
import { LogService } from './log-service/log-service';
import { ApiActions } from "~/services/api/api-actions";
import { WorkflowService } from "~/services/workflow-service/workflow-service";
-import { SearchQueriesService } from '~/services/search-service/search-service';
+import { SearchService } from '~/services/search-service/search-service';
export type ServiceRepository = ReturnType<typeof createServices>;
@@ -49,7 +49,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
const collectionFilesService = new CollectionFilesService(collectionService);
const favoriteService = new FavoriteService(linkService, groupsService);
const tagService = new TagService(linkService);
- const searchQueriesService = new SearchQueriesService();
+ const searchService = new SearchService();
return {
ancestorsService,
@@ -65,7 +65,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
linkService,
logService,
projectService,
- searchQueriesService,
+ searchService,
tagService,
userService,
webdavClient,
diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index 0a6a9a0..a076552 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -36,30 +36,38 @@ export const SEARCH_BAR_ADVANCE_FORM_NAME = 'searchBarAdvanceFormName';
export const goToView = (currentView: string) => searchBarActions.SET_CURRENT_VIEW(currentView);
export const saveRecentQuery = (query: string) =>
- (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- services.searchQueriesService.saveRecentQuery(query);
- };
+ (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) =>
+ services.searchService.saveRecentQuery(query);
+
export const loadRecentQueries = () =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- const recentSearchQueries = services.searchQueriesService.getRecentQueries();
+ const recentSearchQueries = services.searchService.getRecentQueries();
return recentSearchQueries || [];
};
export const saveQuery = (query: string) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- services.searchQueriesService.saveQuery(query);
- dispatch(searchBarActions.SET_SAVED_QUERIES(services.searchQueriesService.getSavedQueries()));
+ services.searchService.saveQuery(query);
+ dispatch(searchBarActions.SET_SAVED_QUERIES(services.searchService.getSavedQueries()));
};
export const deleteSavedQuery = (id: number) =>
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
- services.searchQueriesService.deleteSavedQuery(id);
- const savedSearchQueries = services.searchQueriesService.getSavedQueries();
- dispatch(searchBarActions.SET_SAVED_QUERIES(services.searchQueriesService.getSavedQueries()));
+ services.searchService.deleteSavedQuery(id);
+ const savedSearchQueries = services.searchService.getSavedQueries();
+ dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries));
return savedSearchQueries || [];
};
+export const openSearchView = () =>
+ (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(searchBarActions.OPEN_SEARCH_VIEW());
+ const savedSearchQueries = services.searchService.getSavedQueries();
+ dispatch(searchBarActions.SET_SAVED_QUERIES(savedSearchQueries));
+ };
+
+
export const searchData = (searchValue: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
diff --git a/src/store/search-bar/search-bar-reducer.ts b/src/store/search-bar/search-bar-reducer.ts
index 26ebb9e..ce2a77c 100644
--- a/src/store/search-bar/search-bar-reducer.ts
+++ b/src/store/search-bar/search-bar-reducer.ts
@@ -24,7 +24,7 @@ const initialState: SearchBar = {
open: false,
searchResults: [],
searchValue: '',
- savedQueries: JSON.parse(localStorage.getItem('savedQueries') || '[]') as string[]
+ savedQueries: ['']
};
export const searchBarReducer = (state = initialState, action: SearchBarActions): SearchBar =>
diff --git a/src/views-components/form-fields/search-bar-form-fields.tsx b/src/views-components/form-fields/search-bar-form-fields.tsx
index 2691132..b7f3978 100644
--- a/src/views-components/form-fields/search-bar-form-fields.tsx
+++ b/src/views-components/form-fields/search-bar-form-fields.tsx
@@ -64,7 +64,7 @@ export const SearchBarSaveSearchField = () =>
<FormControlLabel
control={
<Checkbox
- checked={false}
+ checked={true}
value="true"
color="primary"
/>
diff --git a/src/views-components/search-bar/search-bar-advanced-view.tsx b/src/views-components/search-bar/search-bar-advanced-view.tsx
index 93bd0a6..c956ca0 100644
--- a/src/views-components/search-bar/search-bar-advanced-view.tsx
+++ b/src/views-components/search-bar/search-bar-advanced-view.tsx
@@ -16,7 +16,7 @@ import {
SearchBarSaveSearchField, SearchBarQuerySearchField
} from '~/views-components/form-fields/search-bar-form-fields';
-type CssRules = 'form' | 'container' | 'closeIcon' | 'label' | 'buttonWrapper' | 'button' | 'circularProgress';
+type CssRules = 'form' | 'container' | 'closeIcon' | 'label' | 'buttonWrapper' | 'button' | 'circularProgress' | 'searchView';
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
form: {
@@ -50,6 +50,10 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
left: 0,
right: 0,
margin: 'auto'
+ },
+ searchView: {
+ color: theme.palette.common.black,
+ borderRadius: `0 0 ${theme.spacing.unit / 4}px ${theme.spacing.unit / 4}px`
}
});
@@ -75,7 +79,7 @@ export const SearchBarAdvancedView = compose(
}),
withStyles(styles))(
({ classes, setView, handleSubmit, invalid, submitting, pristine }: SearchBarAdvancedViewProps) =>
- <Paper>
+ <Paper className={classes.searchView}>
<form onSubmit={handleSubmit} className={classes.form}>
<Grid container direction="column" justify="flex-start" alignItems="flex-start">
<Grid item xs={12} container className={classes.container}>
diff --git a/src/views-components/search-bar/search-bar-view.tsx b/src/views-components/search-bar/search-bar-view.tsx
index 7680516..54c4731 100644
--- a/src/views-components/search-bar/search-bar-view.tsx
+++ b/src/views-components/search-bar/search-bar-view.tsx
@@ -62,12 +62,12 @@ interface SearchBarActionProps {
onSearch: (value: string) => any;
debounce?: number;
onSetView: (currentView: string) => void;
- openView: () => void;
closeView: () => void;
saveRecentQuery: (query: string) => void;
loadRecentQueries: () => string[];
saveQuery: (query: string) => void;
deleteSavedQuery: (id: number) => void;
+ openSearchView: () => void;
}
type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles<CssRules>;
@@ -117,7 +117,7 @@ export const SearchBarView = withStyles(styles)(
timeout: number;
render() {
- const { classes, currentView, openView, closeView, isPopoverOpen } = this.props;
+ const { classes, currentView, openSearchView, closeView, isPopoverOpen } = this.props;
return <ClickAwayListener onClickAway={() => closeView()}>
<Paper className={isPopoverOpen ? classes.containerSearchViewOpened : classes.container} >
<form onSubmit={this.handleSubmit} className={classes.searchBar}>
@@ -128,7 +128,7 @@ export const SearchBarView = withStyles(styles)(
value={this.state.value}
fullWidth={true}
disableUnderline={true}
- onClick={() => openView()}
+ onClick={() => openSearchView()}
endAdornment={
<InputAdornment position="end">
<Tooltip title='Search'>
diff --git a/src/views-components/search-bar/search-bar.tsx b/src/views-components/search-bar/search-bar.tsx
index eaca7fa..d6c1adf 100644
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@ -12,7 +12,8 @@ import {
deleteSavedQuery,
saveRecentQuery,
loadRecentQueries,
- saveQuery
+ saveQuery,
+ openSearchView
} from '~/store/search-bar/search-bar-actions';
import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
@@ -29,12 +30,12 @@ const mapStateToProps = ({ searchBar }: RootState) => {
const mapDispatchToProps = (dispatch: Dispatch) => ({
onSearch: (valueSearch: string) => dispatch<any>(searchData(valueSearch)),
onSetView: (currentView: string) => dispatch(goToView(currentView)),
- openView: () => dispatch<any>(searchBarActions.OPEN_SEARCH_VIEW()),
closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW()),
saveRecentQuery: (query: string) => dispatch<any>(saveRecentQuery(query)),
loadRecentQueries: () => dispatch<any>(loadRecentQueries()),
saveQuery: (query: string) => dispatch<any>(saveQuery(query)),
- deleteSavedQuery: (id: number) => dispatch<any>(deleteSavedQuery(id))
+ deleteSavedQuery: (id: number) => dispatch<any>(deleteSavedQuery(id)),
+ openSearchView: () => dispatch<any>(openSearchView())
});
export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list