Skip to content
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

DwC filter fixups #4222

Merged
merged 9 commits into from
Feb 25, 2025
Merged

Conversation

kleintom
Copy link
Contributor

Fixes:

  • sending a DwC filter result to AD filter or CE filter causes an exception (commit 1)
  • In Filter DwC, puts the dropdown attributes select in alphabetical order, puts the columns in the filter results table in alphabetical order (commit 2)
  • you can now choose whether integer and decimal attributes should be matched with 'Exact' (currently they're always wildcard matched). This seems useful to me, but maybe there's a reason to not do it? (Incidentally I think that means all dwc fields now get an 'Exact' checkbox option.)
    • Reloads the checkbox state on page reload (currently checkbox goes away)
  • fixes exceptions when returning to DwC filter after having sent DwC filter to another filter (commit 8)
  • fixes exceptions when filtering on dwc_occurrence_type or dwc_occurrenc_id (commit 3)
  • "fixes" x-overflow in rows of the Attributes selected table (I was perhaps too quick to switch to grid from table here... please push back if this doesn't bring you joy)

The Attributes file determines the columns order of the filter results table,
the ByAttribute.vue file determines the dropdown select field order of dwc attributes in the DwC Occurrences filter.

The default ByAttribute order comes from the model order of those attributes: in the three cases where that facet is currently used, two were alphabetical, dwc_occurrences was mostly alphabetical except that new attributes migrated after the initial model creation were added at the end out of order.
Logic adjustment:
* Allow integer and decimal types to be Exact (formerly were always only wildcard - ...maybe there was a specific reason for that?)
* Restore 'Exact' checkbox state on page reload (formerly dropped the checkbox and just said 'Empty' after reload)
They're already handled by the Attributes concern - doing it again explicitly in the filter causes two issues:
* duplicates existing query (minor issue)
* more seriously, if you permit array values for your attribute you can cause an exception since the attributes concern code assumes the attribute accessors return not-arrays.
Fixes x-overflow issues with long attribute names and values - maybe there's a way to accomplish this with table...
…S list

The UI list draws from this list, so this removes it at both the UI and the filter level.
…lters

More specifically so that you can return to a dwc filter after having sent it to, e.g., filter AD. Currently going back to DwC from AD throws an exception.
…bute

LOL, this shouldn't make a difference, but Object.js's removeEmptyProperties didn't check for null (it does check for undefined), it turns out `typeof null == 'object'` for historical reasons (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#typeof_null) and then this line checking for an empty object blows up:
`(typeof value === 'object' && !Object.keys(value).length)`

All attributes never selected are by default undefined, so this is better in that sense anyway.
@jlpereira jlpereira merged commit f0aecbb into SpeciesFileGroup:development Feb 25, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants