Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PXP-9144 ConnectedFilter: allow specifying extra fields to query #129

Merged
merged 5 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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