ConservationMetrics / guardianconnector-views

A Nuxt.js tool that reads data from a SQL database and renders it on different views (map, gallery, alerts dashboard)
MIT License
3 stars 0 forks source link

Add DataFilter component to allow for basic filtering of data on Views #6

Closed rudokemper closed 1 year ago

rudokemper commented 1 year ago

Closes #3.

This PR:

  1. Adds a DataFilter component which takes a prop filterField and matches it with data keys to populate the values of a dropdown. Dropdown selection invokes an emitFilter() method which then filters the data on the parent component (e.g. Map, Gallery).
  2. Allows the DataFilter component can be enabled using an environmental var FRONT_END_FILTERING and uses an additional env var FRONT_END_FILTER_FIELD as the filterField key.
  3. Adds DataFilter to Map and Gallery components.

I considered having two dropdowns: one to select a column (key), and the other to select values (similar to what Terrastories does). However, I felt that this required more validation with our users, so I opted for this initial approach for now which will be a great value add for Mapeo maps or other datasets where there is one primary key.