azavea / pfb-network-connectivity

PFB Bicycle Network Connectivity
Other
40 stars 10 forks source link

Add filter to Neighborhoods list #806

Closed kevinearldenny closed 3 years ago

kevinearldenny commented 3 years ago

Add filter to Neighborhoods list component

Overview

Added a filter to the table in the Neighborhood list, repurposing the code from the filter that already existed on the Analysis Results table. Allow for users to filter by neighborhood name, state and country.

Demo

image

Notes

This filter operates more as a search - only exact matches are returned. For example, if you type 'Phila'... no results are returned, but if you type 'Philadelphia' the expected result is returned.

Testing Instructions

Checklist

Resolves #787

kevinearldenny commented 3 years ago

After a little further investigation here, it seems like the Job search might be leveraging this filter - we might need another one of these filters to be created as well.

KlaasH commented 3 years ago

You're right, I should have looked closer at the results I was getting from search on the neighborhoods endpoint. I thought it was working because it returned results, but it was just ignoring the parameter and returning everything.

So yeah, seems like we need a class like that for Neighborhood, with similar search field/filter_search method (which will also mean removing the filter_fields property from NeighborhoodViewSet and putting the list in the FilterSet's Meta class).

kevinearldenny commented 3 years ago

@KlaasH I've implemented the working filters for Label, State and Country on my most recent commit. Filters should be working as expected on all fields.