Skip to content

Add filter scope preview to planned maintenance form#1770

Open
Simrayz wants to merge 5 commits intomainfrom
feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task
Open

Add filter scope preview to planned maintenance form#1770
Simrayz wants to merge 5 commits intomainfrom
feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task

Conversation

@Simrayz
Copy link
Contributor

@Simrayz Simrayz commented Jan 26, 2026

Scope and purpose

Resolves #1765

This PR adds a preview of incidents that are covered by the currently selected filters in the Planned Maintenance form.
This should give a good indication of the extent of the maintenance task, to avoid accidentally generating too many notifications.

Screenshots

image

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
  • Added/changed documentation, including updates to the user manual if feature flow or UI is considerably changed
  • 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
  • If this results in changes in the UI: Added screenshots of the before and after
  • If this results in changes to the database model: Updated the ER diagram

@Simrayz Simrayz added HTMx Views, urls, templates... frontend Affects frontend planned maintenance labels Jan 26, 2026
@Simrayz Simrayz self-assigned this Jan 26, 2026
@Simrayz Simrayz requested a review from a team January 26, 2026 10:34
@github-actions
Copy link

github-actions bot commented Jan 26, 2026

Test results

    6 files    894 suites   1m 50s ⏱️
  704 tests   703 ✅ 1 💤 0 ❌
4 224 runs  4 218 ✅ 6 💤 0 ❌

Results for commit 5907b9f.

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.69%. Comparing base (8f8a393) to head (5907b9f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1770      +/-   ##
==========================================
+ Coverage   82.57%   82.69%   +0.12%     
==========================================
  Files         137      137              
  Lines        6552     6577      +25     
==========================================
+ Hits         5410     5439      +29     
+ Misses       1142     1138       -4     

☔ 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.

@Simrayz Simrayz force-pushed the feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task branch 2 times, most recently from 36163ff to 9e96035 Compare January 26, 2026 12:27
@Simrayz Simrayz force-pushed the feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task branch from 9e96035 to c6d2050 Compare February 16, 2026 11:09
@Simrayz Simrayz marked this pull request as ready for review February 16, 2026 11:10
@Simrayz Simrayz force-pushed the feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task branch 2 times, most recently from cf09123 to fc2e571 Compare February 16, 2026 13:02
@hmpf
Copy link
Contributor

hmpf commented Feb 17, 2026

Please mention somewhere close by the "Filters" box that it is necessary to type at least two letters, I thought something was broken for a second there...

@hmpf
Copy link
Contributor

hmpf commented Feb 17, 2026

Also, it seems it is not possible to control the column layout in the preview via user preferences, and the layout used isn't any of the ones defined locally on my dev-box. Should we add another built in, or alter the "on maintenance"-one? It's what it's for.

If the layout is hard-coded it should use one that can also be used in the dashboard (we could just show the name somewhere on the pm page) or I can guarantee you we will get support-requests ala. "how can I use the layout from the pm page for the dashboard".

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.

See the comments.

@hmpf hmpf requested a review from a team February 17, 2026 09:51
from argus.util.datetime_utils import LOCAL_INFINITY

FLATPICKR_DATETIME_FORMAT = "%Y-%m-%d %H:%M"
FILTER_PREVIEW_COLUMNS = ["start_time", "level", "source_type", "source", "description", "tags"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't hardcode this here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the columns that I feel are necessary to identify and compare incidents in a meaningful way. There is no existing column preset that gives enough information (such as on maintenance)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hardcoded column list has been removed. I extended the "on maintenance" column preset instead, and added a new constant to point to the maintenance column preset name.

Comment on lines +206 to +207
open_incidents = Incident.objects.open()
total_open = open_incidents.count()
Copy link
Contributor

Choose a reason for hiding this comment

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

What if nothing is open? There might be a procedure "manually mark as closed when seen".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added handling of the case where there are no open incidents, which will show a message to the user instead of "Covers 0 open incidents"

Comment on lines 191 to 198

// Filter preview functionality
(() => {
const filterPreview = document.getElementById('filter-preview');
const filtersSelect = document.getElementById('id_filters');
if (!filterPreview || !filtersSelect) return;

const previewUrl = '{% url "htmx:plannedmaintenance-filter-preview" %}';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: would it work to put large scripts like this in a fragment (say, _plannedmaintenance_form.js as a sibling of plannedmaintenace_form.html) and {% include %} it?

Or would that make for a bigger maintenance burden.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair point, it doesn't really have a high maintenance burden as long as they are co-located.

@hmpf hmpf requested a review from a team February 17, 2026 10:16
@Simrayz Simrayz force-pushed the feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task branch 2 times, most recently from 2591ea9 to 450c458 Compare February 17, 2026 14:31
@Simrayz
Copy link
Contributor Author

Simrayz commented Feb 17, 2026

Please mention somewhere close by the "Filters" box that it is necessary to type at least two letters, I thought something was broken for a second there...

Added to the description below the search input. The combobox has the same behaviour as on the front page, requiring at least two characters to search.

@Simrayz Simrayz force-pushed the feat/1765-add-preview-of-the-scope-of-filters-attached-to-a-pm-task branch from 450c458 to 5907b9f Compare February 17, 2026 14:48
@sonarqubecloud
Copy link

@Simrayz Simrayz requested a review from hmpf February 17, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Affects frontend HTMx Views, urls, templates... planned maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Suggestion: Show also the filterblob in planned maintenance detail view so that users know what this filter actually contains

2 participants

Comments