-
Notifications
You must be signed in to change notification settings - Fork 13
Only show contributed extended fields in embed sidebar search #1794
Conversation
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 was able to this correctly hiding fields from the search form. There is a stray model field and migration that I think we can remove as well as some extra whitesapce that we can avoid by slightly adjusting how we hide the search fields.
src/django/api/models.py
Outdated
@@ -2280,6 +2280,20 @@ class EmbedConfig(models.Model): | |||
blank=False, | |||
default='default', | |||
help_text='The map style for the embedded map') | |||
extended_fields = postgres.ArrayField( |
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 derive the list the list embed fields dynamically in the EmbedConfig serializer so we do not need a database field. We should be able to remove this field and delete the migration without affecting functionality.
Make sure to run ./scripts/manage migrate 0088
to un-apply the migration from your development database before you delete it.
@@ -0,0 +1,19 @@ | |||
# Generated by Django 2.2.24 on 2022-04-06 23:33 |
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 derive the list the list embed fields dynamically in the EmbedConfig serializer so we do not need a database field. We should be able to remove this field and delete the migration without affecting functionality.
Make sure to run ./scripts/manage migrate 0088
to un-apply the migration from your development database before you delete it.
@@ -194,110 +198,160 @@ function FilterSidebarExtendedSearch({ | |||
</div> | |||
</div> | |||
<div className="form__field"> |
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.
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.
Nice catch! I did see some white spaces but didn't connect it with the empty div
This PR is ready for another look. Please run |
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 demoed this in our sprint review and it worked well. Thank you.
Thank you for reviewing! |
In embed_configs endpoint, return a new extended_fields array that includes field names contributed by this specific contributor.
Exclude extended profile fields from search in side bar if the fields are not returned from the endpoint. When no extended fields are contributed, "More Filter" button is hidden from the sidebar search.
189085d
to
c9c44e0
Compare
Overview
In embed mode, we only want the extended profile fields that are contributed by the contributor to appear on the filter sidebar. Perviously, it would be a confusing experience for an Embedded Map if the Embedded Map owner had not contributed Type of Product, but that still appeared as a searchable field on their map.
This PR add extended_fields to embed_configs endpoint and use the returned value to check if the extended profile fields are contributed by the user.
Connects #1561
Demo
Notes
When users contributing facilities with extended fields, we will match the processing type with the associated facility type based on taxonomy (see #1616), which means we may populate the facility type / processing type automatically without explicitly contributing that field.
Testing Instructions
This PR assumes
resetdb
has been run../script/update
./tools/batch-process {list-id}
Checklist
fixup!
commits have been squashed