-
Notifications
You must be signed in to change notification settings - Fork 32
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
Make filter options customisable #515
Conversation
Affected libs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things to address and that's it, very good work!
[ngClass]=" | ||
(isOpen ? 'block' : 'hidden') + | ||
' ' + | ||
(filter.fieldName === 'publisher' || filter.fieldName === 'format' | ||
? 'sm:block' | ||
: '') | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think we should show the two first fields when the block is collapsed, instead of hardcoding field names
- the logic for building the full class attribute would maybe be better in the TS file, and it would be easier to test as well
switch (filter) { | ||
case 'organisation': | ||
return { | ||
fieldName: 'publisher', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't do any mapping with field names here, only the fields service has this power :)
conf/default.toml
Outdated
# available filters: 'organisation', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'spatial', 'license' | ||
custom_filters = ['organisation', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'spatial', 'license'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# available filters: 'organisation', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'spatial', 'license' | |
custom_filters = ['organisation', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'spatial', 'license'] | |
# The advanced search filters available to the user can be customized with this setting. | |
# The following fields can be used for filtering: 'publisher', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'isSpatial', 'license' | |
# advanced_filters = ['publisher', 'format', 'publicationYear', 'topic', 'spatial', 'license'] |
Note: since this is an optional key, it should be commented out in the toml file and the default value should be written in the app (datahub in this case).
case 'organisation': | ||
return { | ||
fieldName: 'publisher', | ||
title: 'search.filters.byOrganisation', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use marker
for i18n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment without doing a review.
A proposal of the new configuration inputs should be provided in the description of the PR.
The configuration is quite sensitive as it has to be human manageable.
I suggest that everyone time we touch the configuration schema, we propose the change within the PR, so we can discuss it even though we are not looking at the code.
Thanks 🤗
@fgravin I updated the description of the PR. Let me know if there is something to change/add. |
Great thanks. |
That might be doable yes, if the need arise we could do it! E.g. filter on uuid, title, links etc. |
I think that it should not happen, shouldn't it ? |
Hmm, I would say an error in the config should break everything because the configuration is expected to be valid at runtime. At load time we check if every required configuration setting is there, but we cannot know yet if one of the filters is invalid or not. If an invalid field is specified then an error is thrown in the console, the only issue here is that the application still loads and kind of look normal, so an administrator might not realize that they made a mistake in the config. The best solution IMO would be to have a strong error message showing up like: "WARNING: the configuration is invalid, the application cannot run" or something like that. |
ef00df1
to
8361bdd
Compare
8361bdd
to
c59ab35
Compare
Proposal: Make filter customizable through default.toml. Once this PR is merged, one will be able to decide which advanced filters to include in the application. This can be done by specifiying the "advanced_filters" in the default.toml, like so:
advanced_filters = ['publisher', 'format', 'publicationYear', 'topic', 'isSpatial', 'license']
if
advanced_filters
are no specified by the user(admin), the one above will be used.These are the possible filters: 'publisher', 'format', 'publicationYear', 'standard', 'inspireKeyword', 'topic', 'isSpatial', 'license'
Screenshots:
with all filters:
customised version: