Closed jack-brinkman closed 1 year ago
New filter button with id
prop fallback:
Sounds to me like we should update the vocabulary instead? Having a fallback to the value mostly just masks the error as I understand it - leaving the issue that translations wont work and that we have an unwanted discrepancy between our APIs.
It you really want a label that just takes the verbatim values, then it is possible to overwrite the label to show a formatted version of the value - could be an identity function. But it sounds like something we should solve at a different level?
I think the reality is we are some way away from having a mature stable vocab for event types (as much as we'd like one / need one).
In that case I'd rather we created a custom label type for this, rather than changing behaviour for all labels.
If we do not have a vocabulary, then we should probably just remove it from the filter https://github.com/gbif/gbif-web/blob/31b017ffa15705c06a1a910a379c32316d09a8ae/packages/react-components/src/utils/filterBuilder/commonFilters.js#L557 and use the raw values as labels.
If you want to overwrite it for a specific usecase, then it should be done by
//overwrite vocabulary labels to just use the raw values
const labels = {
eventTypeVocabulary: {
type: 'TRANSFORM',
transform: ({ id }) => id
},
}
and then pass that to the widget as config. Just like you already have custom labels for taxa
If there is no useful vocabulary then I'm fine with removing that from the filter configuration. Is that the case @djtfmartin ? from how we use the filter (as a wildcard suggest) it seems that the vocabulary labels make little sense.
The vocab is incomplete / WIP. Im also not clear how easy it will be to get a published version of it into the GBIF prod registry.
Let us just remove it from the filter then and use the raw values
Labels produced by
labelMaker
display 'unknown' when an error occurs. It might be more helpful if the user is shown theid
prop instead. For instance, if a 'Trial' event is selected using the filter button since there's no corresponding GBIF vocabulary for that event type, the error label is shown, rather than the 'Trial' label: