[ARVADOS-WORKBENCH2] updated: 1.2.0-576-g1514f6a
Git user
git at public.curoverse.com
Tue Oct 9 09:32:27 EDT 2018
Summary of changes:
package.json | 4 +-
src/common/app-info.ts | 9 +
src/index.tsx | 13 +-
src/services/groups-service/groups-service.ts | 16 +-
src/store/app-info/app-info-actions.ts | 22 +
src/store/app-info/app-info-reducer.ts | 19 +
src/store/search-bar/search-bar-actions.ts | 35 +-
src/store/search-bar/search-bar-reducer.ts | 9 +-
src/store/store.ts | 2 +
src/views-components/main-app-bar/main-app-bar.tsx | 14 +-
.../search-bar/search-bar-advanced-view.tsx | 4 +-
.../search-bar/search-bar-autocomplete-view.tsx | 28 +-
.../search-bar/search-bar-basic-view.tsx | 4 +-
.../search-bar/search-bar-view.test.tsx | 98 +-
.../search-bar/search-bar-view.tsx | 25 +-
src/views-components/search-bar/search-bar.tsx | 7 +-
src/views/main-panel/main-panel-root.tsx | 47 +
src/views/main-panel/main-panel.tsx | 88 +-
yarn.lock | 1308 +-------------------
19 files changed, 259 insertions(+), 1493 deletions(-)
create mode 100644 src/common/app-info.ts
create mode 100644 src/store/app-info/app-info-actions.ts
create mode 100644 src/store/app-info/app-info-reducer.ts
create mode 100644 src/views/main-panel/main-panel-root.tsx
via 1514f6a2ae8103f75f08034299115ad751d8a785 (commit)
via 3b0e0736a359c3c44566ac454d9cddd21ec6a490 (commit)
via 84e4588aed7bea1bcf5727ef2eea1a692b4e3bab (commit)
via 21ad1a1cff07ec6e59db3b278fbc580cb5866c7a (commit)
via df9ea1569dd0d4ae1c05bacc8a5e5f7695f4453b (commit)
via d38fcf4f5b9d8a1889b9bdf79ee77a2022ed4b52 (commit)
via b48e2f248f4330aa8fe8977f867854f502bd304f (commit)
via 47440ead99a61a13bc635630e0f4b07d9322edbf (commit)
via ea17d70fbcc3401f4ffd01ec02f3206616261dcf (commit)
via 20cde4f6023a374d00ba401b86b60a257932683c (commit)
via 244bfe2909565499833b7e2ce387adfd81e1cba6 (commit)
via 769a1c77a8a6ff082bdbb40979e1db56039752cb (commit)
via 34f68df51c55f8144bc96d78695070851e6b34f5 (commit)
from 1e2635886e1342a7b29914d3a437313807676466 (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 1514f6a2ae8103f75f08034299115ad751d8a785
Merge: 3b0e073 84e4588
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Tue Oct 9 15:32:13 2018 +0200
merge master
Feature #14313
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --cc src/store/search-bar/search-bar-actions.ts
index 3d6d3fd,2d171e0..2b8ca83
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@@ -17,13 -23,28 +23,38 @@@ export type SearchBarActions = UnionOf<
export const goToView = (currentView: string) => searchBarActions.SET_CURRENT_VIEW(currentView);
-export const searchData = (searchValue: string) =>
+export const saveRecentQuery = (query: string) =>
+ (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ services.searchQueriesService.saveRecentQuery(query);
+ };
+
+export const loadRecentQueries = () =>
+ (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ const recentSearchQueries = services.searchQueriesService.getRecentQueries();
+ return recentSearchQueries || [];
- };
++ };
++
++export const searchData = (searchValue: string) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(searchBarActions.SET_SEARCH_VALUE(searchValue));
+ dispatch(searchBarActions.SET_SEARCH_RESULTS([]));
+ if (searchValue) {
+ const filters = getFilters('name', searchValue);
+ const { items } = await services.groupsService.contents('', {
- filters,
++ filters,
+ limit: 5,
+ recursive: true
+ });
+ dispatch(searchBarActions.SET_SEARCH_RESULTS(items));
+ }
+ };
+
-
+ const getFilters = (filterName: string, searchValue: string): string => {
+ return new FilterBuilder()
+ .addIsA("uuid", [ResourceKind.PROJECT, ResourceKind.COLLECTION, ResourceKind.PROCESS])
+ .addILike(filterName, searchValue, GroupContentsResourcePrefix.COLLECTION)
+ .addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS)
+ .addILike(filterName, searchValue, GroupContentsResourcePrefix.PROJECT)
+ .addEqual('groupClass', GroupClass.PROJECT, GroupContentsResourcePrefix.PROJECT)
+ .getFilters();
-};
++};
diff --cc src/views-components/search-bar/search-bar-advanced-view.tsx
index fe167ba,356eb33..dde2368
--- a/src/views-components/search-bar/search-bar-advanced-view.tsx
+++ b/src/views-components/search-bar/search-bar-advanced-view.tsx
@@@ -5,9 -5,9 +5,9 @@@
import * as React from 'react';
import { Paper, StyleRulesCallback, withStyles, WithStyles, List, Button } from '@material-ui/core';
import { SearchView } from '~/store/search-bar/search-bar-reducer';
- import { RenderRecentQueries } from '~/views-components/search-bar/search-bar-view';
+ import { RecentQueriesItem } from '~/views-components/search-bar/search-bar-view';
-type CssRules = 'list';
+type CssRules = 'list' | 'searchView';
const styles: StyleRulesCallback<CssRules> = theme => {
return {
@@@ -26,9 -23,9 +26,9 @@@ interface SearchBarAdvancedViewProps
export const SearchBarAdvancedView = withStyles(styles)(
({ classes, setView }: SearchBarAdvancedViewProps & WithStyles<CssRules>) =>
- <Paper>
+ <Paper className={classes.searchView}>
<List component="nav" className={classes.list}>
- <RenderRecentQueries text='ADVANCED VIEW' />
+ <RecentQueriesItem text='ADVANCED VIEW' />
</List>
<Button onClick={() => setView(SearchView.BASIC)}>Back</Button>
</Paper>
diff --cc src/views-components/search-bar/search-bar-autocomplete-view.tsx
index faeabb1,c4b2457..affaf53
--- a/src/views-components/search-bar/search-bar-autocomplete-view.tsx
+++ b/src/views-components/search-bar/search-bar-autocomplete-view.tsx
@@@ -3,30 -3,38 +3,42 @@@
// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { Paper, StyleRulesCallback, withStyles, WithStyles, List, ListItem, ListItemText } from '@material-ui/core';
-import { ArvadosTheme } from '~/common/custom-theme';
+import { Paper, StyleRulesCallback, withStyles, WithStyles, List } from '@material-ui/core';
- import { RenderRecentQueries } from '~/views-components/search-bar/search-bar-view';
+ import { RecentQueriesItem } from '~/views-components/search-bar/search-bar-view';
+ import { GroupContentsResource } from '~/services/groups-service/groups-service';
+ import Highlighter from "react-highlight-words";
-type CssRules = 'list';
+type CssRules = 'list' | 'searchView';
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
- list: {
- padding: 0
- }
-});
+const styles: StyleRulesCallback<CssRules> = theme => {
+ return {
+ list: {
- padding: '0px'
++ padding: 0
+ },
+ searchView: {
+ borderRadius: `0 0 ${theme.spacing.unit / 4}px ${theme.spacing.unit / 4}px`
+ }
+ };
+};
- interface SearchBarAutocompleteViewProps {
+ export interface SearchBarAutocompleteViewDataProps {
+ searchResults?: GroupContentsResource[];
+ searchValue?: string;
}
+ type SearchBarAutocompleteViewProps = SearchBarAutocompleteViewDataProps & WithStyles<CssRules>;
+
export const SearchBarAutocompleteView = withStyles(styles)(
- ({ classes }: SearchBarAutocompleteViewProps & WithStyles<CssRules>) =>
- ({ classes, searchResults, searchValue }: SearchBarAutocompleteViewProps ) =>
- <Paper>
- {searchResults && <List component="nav" className={classes.list}>
++ ({ classes, searchResults, searchValue }: SearchBarAutocompleteViewProps) =>
+ <Paper className={classes.searchView}>
- <List component="nav" className={classes.list}>
- <RenderRecentQueries text='AUTOCOMPLETE VIEW' />
- </List>
++ {searchResults && <List component="nav" className={classes.list}>
+ {searchResults.map((item: GroupContentsResource) => {
+ return <RecentQueriesItem key={item.uuid} text={getFormattedText(item.name, searchValue)} />;
+ })}
+ </List>}
</Paper>
- );
+ );
+
+ const getFormattedText = (textToHighlight: string, searchString = '') => {
+ return <Highlighter searchWords={[searchString]} autoEscape={true} textToHighlight={textToHighlight} />;
+ };
diff --cc src/views-components/search-bar/search-bar-basic-view.tsx
index b874631,c2bca73..7f90ecd
--- a/src/views-components/search-bar/search-bar-basic-view.tsx
+++ b/src/views-components/search-bar/search-bar-basic-view.tsx
@@@ -49,7 -47,8 +49,7 @@@ export const SearchBarBasicView = withS
</List>
<div className={classes.searchQueryList}>Recent search queries</div>
<List component="nav" className={classes.list}>
- {recentQueries().map((query, index) => <RenderRecentQueries key={query + index} text={query} />)}
- <RecentQueriesItem text="cos" />
- <RecentQueriesItem text="testtest" />
++ {recentQueries().map((query, index) => <RecentQueriesItem key={query + index} text={query} />)}
</List>
<div className={classes.advanced} onClick={() => setView(SearchView.ADVANCED)}>Advanced search</div>
</Paper>
diff --cc src/views-components/search-bar/search-bar-view.tsx
index b4d98f8,f26cb7e..b2575a8
--- a/src/views-components/search-bar/search-bar-view.tsx
+++ b/src/views-components/search-bar/search-bar-view.tsx
@@@ -19,11 -19,12 +19,12 @@@ import { RemoveIcon } from '~/component
import { SearchView } from '~/store/search-bar/search-bar-reducer';
import { SearchBarBasicView } from '~/views-components/search-bar/search-bar-basic-view';
import { SearchBarAdvancedView } from '~/views-components/search-bar/search-bar-advanced-view';
- import { SearchBarAutocompleteView } from '~/views-components/search-bar/search-bar-autocomplete-view';
+ import { SearchBarAutocompleteView, SearchBarAutocompleteViewDataProps } from '~/views-components/search-bar/search-bar-autocomplete-view';
+ import { ArvadosTheme } from '~/common/custom-theme';
-type CssRules = 'container' | 'input' | 'searchBar';
+type CssRules = 'container' | 'containerSearchViewOpened' | 'input' | 'searchBar';
- const styles: StyleRulesCallback<CssRules> = theme => {
+ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => {
return {
container: {
position: 'relative',
@@@ -150,9 -144,11 +151,11 @@@ export const SearchBarView = withStyles
case SearchView.ADVANCED:
return <SearchBarAdvancedView setView={this.props.onSetView} />;
case SearchView.AUTOCOMPLETE:
- return <SearchBarAutocompleteView />;
+ return <SearchBarAutocompleteView
+ searchResults={this.props.searchResults}
+ searchValue={this.props.searchValue} />;
default:
- return <SearchBarBasicView setView={this.props.onSetView} />;
+ return <SearchBarBasicView setView={this.props.onSetView} recentQueries={this.props.loadQueries} />;
}
}
diff --cc src/views-components/search-bar/search-bar.tsx
index e9ebc7c,df8808c..98440fd
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@@ -5,9 -5,8 +5,9 @@@
import { connect } from 'react-redux';
import { RootState } from '~/store/store';
import { Dispatch } from 'redux';
- import { goToView, searchBarActions } from '~/store/search-bar/search-bar-actions';
+ import { goToView, searchData, searchBarActions } from '~/store/search-bar/search-bar-actions';
import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
+import { saveRecentQuery, loadRecentQueries } from '~/store/search-bar/search-bar-actions';
const mapStateToProps = ({ searchBar }: RootState) => {
return {
@@@ -17,11 -18,10 +19,12 @@@
};
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())
+ closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW()),
+ saveQuery: (query: string) => dispatch<any>(saveRecentQuery(query)),
+ loadQueries: () => dispatch<any>(loadRecentQueries())
});
export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);
commit 3b0e0736a359c3c44566ac454d9cddd21ec6a490
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Tue Oct 9 15:24:55 2018 +0200
tests
Feature #14313
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/views-components/search-bar/search-bar-view.test.tsx b/src/views-components/search-bar/search-bar-view.test.tsx
index de1e961..d533049 100644
--- a/src/views-components/search-bar/search-bar-view.test.tsx
+++ b/src/views-components/search-bar/search-bar-view.test.tsx
@@ -23,44 +23,20 @@ describe("<SearchBar />", () => {
describe("on submit", () => {
it("calls onSearch with initial value passed via props", () => {
- const searchBar = mount(<SearchBarView value="initial value"
- onSearch={onSearch}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("form").simulate("submit");
expect(onSearch).toBeCalledWith("initial value");
});
it("calls onSearch with current value", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
searchBar.find("form").simulate("submit");
expect(onSearch).toBeCalledWith("current value");
});
it("calls onSearch with new value passed via props", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
searchBar.setProps({ value: "new value" });
searchBar.find("form").simulate("submit");
@@ -68,16 +44,7 @@ describe("<SearchBar />", () => {
});
it("cancels timeout set on input value change", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- debounce={1000}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
searchBar.find("form").simulate("submit");
jest.runTimersToTime(1000);
@@ -89,15 +56,7 @@ describe("<SearchBar />", () => {
describe("on input value change", () => {
it("calls onSearch after default timeout", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
expect(onSearch).not.toBeCalled();
jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
@@ -105,16 +64,7 @@ describe("<SearchBar />", () => {
});
it("calls onSearch after the time specified in props has passed", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- debounce={2000}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
jest.runTimersToTime(1000);
expect(onSearch).not.toBeCalled();
@@ -123,16 +73,7 @@ describe("<SearchBar />", () => {
});
it("calls onSearch only once after no change happened during the specified time", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- debounce={1000}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
jest.runTimersToTime(500);
searchBar.find("input").simulate("change", { target: { value: "changed value" } });
@@ -141,16 +82,7 @@ describe("<SearchBar />", () => {
});
it("calls onSearch again after the specified time has passed since previous call", () => {
- const searchBar = mount(<SearchBarView value=""
- onSearch={onSearch}
- debounce={1000}
- currentView=''
- open={true}
- onSetView={jest.fn()}
- openView={jest.fn()}
- closeView={jest.fn()}
- saveQuery={jest.fn()}
- loadQueries={() => ['test']} />);
+ const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
jest.runTimersToTime(500);
searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
@@ -164,3 +96,17 @@ describe("<SearchBar />", () => {
});
});
});
+
+const mockSearchProps = () => ({
+ value: "current value",
+ onSearch: jest.fn(),
+ debounce: 1000,
+ currentView: '',
+ open: true,
+ onSetView: jest.fn(),
+ openView: jest.fn(),
+ loseView: jest.fn(),
+ closeView: jest.fn(),
+ saveQuery: jest.fn(),
+ loadQueries: () => ['test']
+});
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list