Skip to content

Commit

Permalink
PXP-9144 ConnectedFilter: allow specifying extra fields to query (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre authored Dec 10, 2021
1 parent 9abcfc0 commit b10c23d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 60 deletions.
71 changes: 14 additions & 57 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gen3/guppy",
"version": "0.14.0",
"version": "0.14.3",
"description": "Server that support GraphQL queries on data from elasticsearch",
"main": "src/server/server.js",
"directories": {
Expand Down
5 changes: 4 additions & 1 deletion src/components/ConnectedFilter/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ class ConnectedFilter extends React.Component {
super(props);

const filterConfigsFields = getAllFieldsFromFilterConfigs(props.filterConfig.tabs);
const allFields = props.accessibleFieldCheckList
let allFields = props.accessibleFieldCheckList
? _.union(filterConfigsFields, props.accessibleFieldCheckList)
: filterConfigsFields;
allFields = _.union(allFields, this.props.extraAggsFields);

this.initialTabsOptions = {};
let initialFilter = this.props.adminAppliedPreFilters;
Expand Down Expand Up @@ -315,6 +316,7 @@ ConnectedFilter.propTypes = {
searchFields: PropTypes.arrayOf(PropTypes.string),
})),
}).isRequired,
extraAggsFields: PropTypes.arrayOf(PropTypes.string),
guppyConfig: PropTypes.shape({
path: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
Expand All @@ -341,6 +343,7 @@ ConnectedFilter.propTypes = {
};

ConnectedFilter.defaultProps = {
extraAggsFields: [],
onFilterChange: () => {},
onReceiveNewAggsData: () => {},
className: '',
Expand Down
3 changes: 2 additions & 1 deletion src/components/Utils/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ export const getGQLFilter = (filterObj) => {
// This filter only has a combine setting so far. We can ignore it.
return;
} else {
throw new Error(`Invalid filter object ${filterValues}`);
console.error(filterValues);
throw new Error('Invalid filter object');
}
if (fieldSplitted.length > 1) { // nested field
fieldSplitted.pop();
Expand Down

0 comments on commit b10c23d

Please sign in to comment.