initWebSocket(config, services.authService, store);
await store.dispatch(loadWorkbench());
addRouteChangeHandlers(history, store);
+ // ToDo: move to searchBar component
store.dispatch(initAdvanceFormProjectsTree());
}
};
} & PropertyValues;
export interface PropertyValues {
- propertyKey: string;
- propertyValue: string;
+ key: string;
+ value: string;
}
export enum ClusterObjectType {
};
export const initAdvanceFormProjectsTree = () =>
- async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch<any>(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
export const SearchBarKeyField = () =>
<Field
- name='propertyKey'
+ name='key'
component={TextField}
label="Key" />;
export const SearchBarValueField = () =>
<Field
- name='propertyValue'
+ name='value'
component={TextField}
label="Value" />;
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<CssRules> = (theme: ArvadosTheme) => ({
- root: {
-
- },
label: {
color: theme.palette.grey["500"],
fontSize: '0.8125rem',
const selector = formValueSelector(SEARCH_BAR_ADVANCE_FORM_NAME);
const mapStateToProps = (state: RootState) => {
return {
- propertyValues: selector(state, 'propertyKey', 'propertyValue')
+ propertyValues: selector(state, 'key', 'value')
};
};
},
addProp: (propertyValues: PropertyValues) => {
dispatch<any>(updateAdvanceFormProperties(propertyValues));
- dispatch<any>(changeAdvanceFormProperty('propertyKey'));
- dispatch<any>(changeAdvanceFormProperty('propertyValue'));
+ dispatch<any>(changeAdvanceFormProperty('key'));
+ dispatch<any>(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) =>
<Grid container item xs={12} spacing={16}>
<Grid item xs={2} className={classes.label}>Properties</Grid>
<Chips values={getAllFields(fields)}
deletable
onChange={setProps}
- getLabel={(field: PropertyValues) => `${field.propertyKey}: ${field.propertyValue}`} />
+ getLabel={(field: PropertyValues) => `${field.key}: ${field.value}`} />
</Grid>
</Grid>
)
reduxForm<SearchBarAdvanceFormData, SearchBarAdvancedViewActionProps>({
form: SEARCH_BAR_ADVANCE_FORM_NAME,
onSubmit: (data: SearchBarAdvanceFormData, dispatch: Dispatch) => {
- console.log('data: ', data);
dispatch<any>(saveQuery(data));
dispatch(reset(SEARCH_BAR_ADVANCE_FORM_NAME));
}