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

Allow users to configure filters and set them at runtime via a editable dialog #4393

Merged
merged 4 commits into from
May 27, 2024

Conversation

cmdcolin
Copy link
Collaborator

This allows users to configure a filter in their config.json as an array of jexl strings, or set an array of jexl filters

Fixes #1988

Screenshot showing the runtime dialog

image

The filters are stored on the LinearBasicDisplay model as a prop named jexlFilters, and the state model is used if no config filters are supplied (otherwise config filters are used, which is an empty array by default)

As the UI is currently designed, the user actually types out jexl: when they are hand-editing the UI. this is a small code simplification, but we could remove it and make it automatically prepend this string. Random note regarding that: i am somewhat just discouraged by the limitations of jexl, so we could consider looking at escape routes e.g. trying to create a javascript eval if security concerns can be addressed

@cmdcolin
Copy link
Collaborator Author

note: this was motivated originally by this issue (transcription factor track from UCSC called JASPAR) #2624 which is very feat dense and on the UCSC website, they only display features with score>400 by default. this PR allows us to recapitulate a similar behavior in jbrowse

@cmdcolin cmdcolin force-pushed the filter_branch branch 3 times, most recently from 4f16921 to 95d9fe0 Compare May 21, 2024 01:51
@carolinebridge
Copy link
Contributor

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented May 27, 2024

thanks for checking out. the textbox had readonly mistakenly from copying to another part of the codebase and the submit button is disabled and checks if empty and checks basic jexl syntax and reports an error if there is any e.g. syntax error now

@carolinebridge
Copy link
Contributor

  • add a way to reset the filters on the track from the modal (can't see a way to remove filters applied atm)
  • there's a typo in the modal's example attrivute -> attribute
  • i think i'd like to see some kind of indicator on the track that it has a filter applied to it, perhaps with an onhover showing the filters applied?

@cmdcolin
Copy link
Collaborator Author

add a way to reset the filters on the track from the modal (can't see a way to remove filters applied atm)

not sure what this means, you can edit the textbox?

there's a typo in the modal's example attrivute -> attribute

good catch, i recommended this fix upstream to typos-cli also

i think i'd like to see some kind of indicator on the track that it has a filter applied to it, perhaps with an onhover showing the filters applied?

onhover where?

@cmdcolin
Copy link
Collaborator Author

i see regarding clear filters. I will just allow it to submit now with an empty textbox then

@carolinebridge
Copy link
Contributor

The problem with allowing to submit it with an empty textbox is it errors out because you are "submitting jexl to filter by"

@carolinebridge
Copy link
Contributor

Could add a filter icon beside the track name and have the onhover show the filter applied ;; clicking on icon could open the modal? Hidden when no filters applied

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented May 27, 2024

The problem with allowing to submit it with an empty textbox is it errors out because you are "submitting jexl to filter by"

error with this fixed now

Could add a filter icon beside the track name and have the onhover show the filter applied ;; clicking on icon could open the modal? Hidden when no filters applied

i think the design of the user interface for this is a little tricky. that is not a bad idea. there is also the concept of a "DispayBlurb" that displays in the lower left corner.

I might say that this could go into a follow up PR. it would be valuable, but designing the right UI might take some extra work.

I would also say the idea for fetching all the available fields could also be a follow up PR. it is a good idea, but it is a bit on the tricky side to implement and delive correctly.

@cmdcolin cmdcolin merged commit 06ffa26 into main May 27, 2024
@cmdcolin cmdcolin deleted the filter_branch branch May 27, 2024 21:10
@cmdcolin cmdcolin added the enhancement New feature or request label May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow custom filtering expressions to be applied to state or configuration of tracks
2 participants