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 filtering from columns #1020

Merged
merged 5 commits into from
Dec 3, 2024
Merged

Conversation

elfjes
Copy link
Collaborator

@elfjes elfjes commented Dec 2, 2024

moved from Uninett/argus-htmx-frontend#144

Allow specifiying when a column may be "filterable" (by specifying the IncidentTableColumn.filter_field). This means:

  • a button will be attached to the column header
  • clicking that button will display an input element
  • typing into this element (ie change event) will fire an htmx request with the specified filter_field as the query param to filter incidents

image
image

TODO:

  • create the ui elements and activate this element when IncidentTableColumn.filter_field is set
  • wrap the column headers in a form and send this form as htmx request on change event
    • include filter-box form fields in the request
  • prefill input value based on current values

Limitations:

  • only support simple text input for now

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 81.97%. Comparing base (1eb2c3a) to head (19bc747).
Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/argus/htmx/incidents/utils.py 30.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1020      +/-   ##
==========================================
+ Coverage   77.50%   81.97%   +4.47%     
==========================================
  Files         132      132              
  Lines        4868     4866       -2     
==========================================
+ Hits         3773     3989     +216     
+ Misses       1095      877     -218     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@hmpf hmpf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you write a test that shows the use of filter_field? The doc-string is a bit vague. You just need to show how the customization-blob for the column looks like. Or you could figure out some other way to show how to use it.

Copy link

sonarqubecloud bot commented Dec 2, 2024

def setUp(self):
request = RequestFactory().get("/incidents")
request.user = PersonUserFactory()
request.htmx = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For other reviewers: request.htmx is explicitly set because we skip the middleware when we build a request directly like this.

@hmpf hmpf added the frontend Affects frontend label Dec 3, 2024
@hmpf hmpf self-requested a review December 3, 2024 09:38
@hmpf hmpf merged commit db56538 into Uninett:master Dec 3, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Affects frontend
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants