From: Janicki Artur Date: Tue, 16 Oct 2018 08:25:40 +0000 (+0200) Subject: change code after CR X-Git-Tag: 1.3.0~63^2 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/80fb3b40df59f68ddfee58b1b45272093ece2af5?ds=sidebyside change code after CR Feature #13827 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- diff --git a/src/index.tsx b/src/index.tsx index c8dba0d2..0fc72217 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -115,6 +115,7 @@ const initListener = (history: History, store: RootStore, services: ServiceRepos initWebSocket(config, services.authService, store); await store.dispatch(loadWorkbench()); addRouteChangeHandlers(history, store); + // ToDo: move to searchBar component store.dispatch(initAdvanceFormProjectsTree()); } }; diff --git a/src/models/search-bar.ts b/src/models/search-bar.ts index c118fd57..4df5c38f 100644 --- a/src/models/search-bar.ts +++ b/src/models/search-bar.ts @@ -17,8 +17,8 @@ export type SearchBarAdvanceFormData = { } & PropertyValues; export interface PropertyValues { - propertyKey: string; - propertyValue: string; + key: string; + value: string; } export enum ClusterObjectType { diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts index da688935..4ecf0ff4 100644 --- a/src/store/search-bar/search-bar-actions.ts +++ b/src/store/search-bar/search-bar-actions.ts @@ -99,16 +99,16 @@ const getFilters = (filterName: string, searchValue: string): string => { }; export const initAdvanceFormProjectsTree = () => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(initUserProject(SEARCH_BAR_ADVANCE_FORM_PICKER_ID)); }; export const changeAdvanceFormProperty = (property: string, value: PropertyValues[] | string = '') => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(change(SEARCH_BAR_ADVANCE_FORM_NAME, property, value)); }; export const updateAdvanceFormProperties = (propertyValues: PropertyValues) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { dispatch(arrayPush(SEARCH_BAR_ADVANCE_FORM_NAME, 'properties', propertyValues)); }; \ No newline at end of file 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 4159775b..fbb2cbac 100644 --- a/src/views-components/form-fields/search-bar-form-fields.tsx +++ b/src/views-components/form-fields/search-bar-form-fields.tsx @@ -62,13 +62,13 @@ export const SearchBarDataToField = () => export const SearchBarKeyField = () => ; export const SearchBarValueField = () => ; diff --git a/src/views-components/search-bar/search-bar-advanced-properties-view.tsx b/src/views-components/search-bar/search-bar-advanced-properties-view.tsx index 5e2acb75..01fc6a1a 100644 --- a/src/views-components/search-bar/search-bar-advanced-properties-view.tsx +++ b/src/views-components/search-bar/search-bar-advanced-properties-view.tsx @@ -18,12 +18,9 @@ import { ArvadosTheme } from '~/common/custom-theme'; import { SearchBarKeyField, SearchBarValueField } from '~/views-components/form-fields/search-bar-form-fields'; import { Chips } from '~/components/chips/chips'; -type CssRules = 'root' | 'label' | 'button'; +type CssRules = 'label' | 'button'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ - root: { - - }, label: { color: theme.palette.grey["500"], fontSize: '0.8125rem', @@ -55,7 +52,7 @@ type SearchBarAdvancedPropertiesViewProps = SearchBarAdvancedPropertiesViewDataP const selector = formValueSelector(SEARCH_BAR_ADVANCE_FORM_NAME); const mapStateToProps = (state: RootState) => { return { - propertyValues: selector(state, 'propertyKey', 'propertyValue') + propertyValues: selector(state, 'key', 'value') }; }; @@ -65,18 +62,16 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ }, addProp: (propertyValues: PropertyValues) => { dispatch(updateAdvanceFormProperties(propertyValues)); - dispatch(changeAdvanceFormProperty('propertyKey')); - dispatch(changeAdvanceFormProperty('propertyValue')); + dispatch(changeAdvanceFormProperty('key')); + dispatch(changeAdvanceFormProperty('value')); }, getAllFields: (fields: any) => { return fields.getAll() || []; } }); -export const SearchBarAdvancedPropertiesView = - connect(mapStateToProps, mapDispatchToProps) - - (withStyles(styles)( +export const SearchBarAdvancedPropertiesView = connect(mapStateToProps, mapDispatchToProps)( + withStyles(styles)( ({ classes, fields, propertyValues, setProps, addProp, getAllFields }: SearchBarAdvancedPropertiesViewProps) => Properties @@ -99,7 +94,7 @@ export const SearchBarAdvancedPropertiesView = `${field.propertyKey}: ${field.propertyValue}`} /> + getLabel={(field: PropertyValues) => `${field.key}: ${field.value}`} /> ) 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 4ffcbccd..1a836a0f 100644 --- a/src/views-components/search-bar/search-bar-advanced-view.tsx +++ b/src/views-components/search-bar/search-bar-advanced-view.tsx @@ -79,7 +79,6 @@ export const SearchBarAdvancedView = compose( reduxForm({ form: SEARCH_BAR_ADVANCE_FORM_NAME, onSubmit: (data: SearchBarAdvanceFormData, dispatch: Dispatch) => { - console.log('data: ', data); dispatch(saveQuery(data)); dispatch(reset(SEARCH_BAR_ADVANCE_FORM_NAME)); }