import { compose, Dispatch } from 'redux';
import { Paper, StyleRulesCallback, withStyles, WithStyles, Button, Grid, IconButton, CircularProgress } from '@material-ui/core';
import {
- SEARCH_BAR_ADVANCE_FORM_NAME,
+ SEARCH_BAR_ADVANCE_FORM_NAME, SEARCH_BAR_ADVANCE_FORM_PICKER_ID,
searchAdvanceData,
setSearchValueFromAdvancedData
} from '~/store/search-bar/search-bar-actions';
SearchBarDateFromField, SearchBarDateToField, SearchBarPropertiesField,
SearchBarSaveSearchField, SearchBarQuerySearchField
} from '~/views-components/form-fields/search-bar-form-fields';
+import { treePickerActions } from "~/store/tree-picker/tree-picker-actions";
type CssRules = 'container' | 'closeIcon' | 'label' | 'buttonWrapper'
| 'button' | 'circularProgress' | 'searchView' | 'selectGrid';
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
container: {
padding: theme.spacing.unit * 2,
- borderBottom: `1px solid ${theme.palette.grey["200"]}`
+ borderBottom: `1px solid ${theme.palette.grey["200"]}`,
+ position: 'relative',
},
closeIcon: {
position: 'absolute',
// ToDo: maybe we should remove tags
export interface SearchBarAdvancedViewDataProps {
tags: any;
+ saveQuery: boolean;
}
export interface SearchBarAdvancedViewActionProps {
onSubmit: (data: SearchBarAdvanceFormData, dispatch: Dispatch) => {
dispatch<any>(searchAdvanceData(data));
dispatch(reset(SEARCH_BAR_ADVANCE_FORM_NAME));
+ dispatch(treePickerActions.DEACTIVATE_TREE_PICKER_NODE({ pickerId: SEARCH_BAR_ADVANCE_FORM_PICKER_ID }));
},
onChange: (data: SearchBarAdvanceFormData, dispatch: Dispatch, props: any, prevData: SearchBarAdvanceFormData) => {
dispatch<any>(setSearchValueFromAdvancedData(data, prevData));
- }
+ },
}),
withStyles(styles))(
- ({ classes, closeAdvanceView, handleSubmit, submitting, invalid, pristine, tags }: SearchBarAdvancedViewFormProps) =>
+ ({ classes, closeAdvanceView, handleSubmit, submitting, invalid, pristine, tags, saveQuery }: SearchBarAdvancedViewFormProps) =>
<Paper className={classes.searchView}>
<form onSubmit={handleSubmit}>
<Grid container direction="column" justify="flex-start" alignItems="flex-start">
<SearchBarSaveSearchField />
</Grid>
<Grid item xs={4}>
- <SearchBarQuerySearchField />
+ {saveQuery && <SearchBarQuerySearchField />}
</Grid>
</Grid>
<Grid container item xs={12} justify='flex-end'>