Skip to content

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Jul 9, 2025

Scope and purpose

On the way to using forms to validate All! The! Things! in the frontend there was a lot of mysterious things happening.

I think this is the most brutal code I've yet to write for argus. It fixes (and therefore masks) A LOT of sins/problems/design mistakes/beginner errors in the frontend. It's like fixing a misbehaving machine by hitting it with a hammer in just the right way then following up with duct tape and WD40.

This incidentally fixes any future occurrences of #1509 in a too brutal way: There's no alert that there is a problem in the site settings, the problem is just masked. Alerting about the error is left to a future PR.

Example problems now fixed:

  • Page size and timeframe disappearing on auto-refresh or changing page.
  • Paging when using the querystring tag duplicated the get-parameters from the filterbox.
  • Timeframe is reset to none when
    • changing page size
    • changing the filters in the filter box

There are no "look" changes, only "feel" changes (though there may still be duplicated params in the url, it just doesn't matter anymore.)

Lots of debug logging added, I'm considering adding another level TRACE (5) for these (or remove them) but that'll be in a final PR when everything else is done.

Best read commit by commit.

Contributor Checklist

Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to Argus can be found in the
Development docs.

  • Added a changelog fragment for towncrier
  • Added/amended tests for new/changed code
  • Linted/formatted the code with ruff and djLint, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See our how-to
  • If applicable: Created new issues if this PR does not fix the issue completely/there is further work to be done

@hmpf hmpf requested review from a team and jorund1 July 9, 2025 08:05
@hmpf hmpf self-assigned this Jul 9, 2025
@hmpf hmpf added frontend Affects frontend UX UX design help needed/Improves user experience labels Jul 9, 2025
@hmpf hmpf moved this from 📋 Backlog to ❓ Ready for review in Argus development, public Jul 9, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2025

Codecov Report

❌ Patch coverage is 50.94340% with 52 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.65%. Comparing base (624527f) to head (c04c05a).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
src/argus/htmx/incident/views.py 48.38% 48 Missing ⚠️
src/argus/htmx/incident/filter.py 69.23% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1512      +/-   ##
==========================================
- Coverage   79.46%   78.65%   -0.82%     
==========================================
  Files         121      121              
  Lines        5425     5504      +79     
==========================================
+ Hits         4311     4329      +18     
- Misses       1114     1175      +61     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hmpf hmpf added nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) and removed nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) labels Jul 9, 2025
@hmpf hmpf marked this pull request as ready for review July 9, 2025 13:32
@hmpf hmpf force-pushed the cleanup-get-parameters-1 branch 3 times, most recently from c3aa92a to 5a06a26 Compare July 10, 2025 09:27
@hmpf hmpf changed the title Cleanup get parameters 1 Clean up incident list GET parameters, step 1 Jul 10, 2025
@hmpf hmpf force-pushed the cleanup-get-parameters-1 branch from 5a06a26 to 441369a Compare July 10, 2025 10:34
@hmpf hmpf force-pushed the cleanup-get-parameters-1 branch from 441369a to 119f3b2 Compare July 10, 2025 12:49
@hmpf hmpf mentioned this pull request Jul 10, 2025
6 tasks
Copy link
Contributor

@jorund1 jorund1 left a comment

Choose a reason for hiding this comment

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

Here's what I got from testing the bugs on master branch versus PR branch:

Timeframe disappearing on auto-refresh or changing page.

  • Occurs on master branch
  • Does not occur on PR branch

Page size disappearing on auto-refresh or changing page.

  • Does not occur on master branch
  • Does not occur on PR branch

Paging when using the querystring tag duplicated the get-parameters from the filterbox.

  • Does not occur on master branch
  • Occurs on PR branch (in URL bar, automatic refresh requests, and page-change requests. Deduplicated in backend)

Timeframe is reset to none when changing page size or changing the filters in the filter box

  • Occurs on master branch
  • Does not occur on PR branch

The duplicated get-parameters in the URL bar as well as how to handle the possibility of adding the same filter multiple times in the UI (e.g. when using custom incident table columns that is filterable and that filters something that is being filtered already) will need a follow-up PR.

@github-project-automation github-project-automation bot moved this from ❓ Ready for review to 👍 Reviewer approved in Argus development, public Jul 14, 2025
Copy link
Contributor

@johannaengland johannaengland left a comment

Choose a reason for hiding this comment

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

Test name nitpicking

And I would like to have docstrings for the new methods, since they are not self explanatory to me



@tag("unit")
class dedupe_querydict_Test(TestCase):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the name like this? This goes against all other test names we have so far

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I realized that it is easier for my brain to match the thing being tested to the test when it is spelled the same way in the test class name.

@lunkwill42 lunkwill42 added the blocked Another thing/issue has to be resolved before tackling this label Aug 4, 2025
@hmpf
Copy link
Contributor Author

hmpf commented Aug 6, 2025

The duplicated get-parameters in the URL bar as well as how to handle the possibility of adding the same filter multiple times in the UI (e.g. when using custom incident table columns that is filterable and that filters something that is being filtered already) will need a follow-up PR.

I suspect a lot of this would no longer be needed if all the GET-parameters that works on the table swapped out all the GET parameters in addition to the table, that is: all of <main>, not just <table id="table" ..>.

@hmpf hmpf force-pushed the cleanup-get-parameters-1 branch 2 times, most recently from 162247d to d213ade Compare August 8, 2025 10:44
@hmpf hmpf force-pushed the cleanup-get-parameters-1 branch from d213ade to 9af6c5e Compare August 8, 2025 10:44
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Another thing/issue has to be resolved before tackling this frontend Affects frontend UX UX design help needed/Improves user experience

Projects

Status: 👍 Reviewer approved

Development

Successfully merging this pull request may close these issues.

5 participants