Add filter scope preview to planned maintenance form#1770
Add filter scope preview to planned maintenance form#1770
Conversation
Test results 6 files 894 suites 1m 50s ⏱️ Results for commit 5907b9f. ♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
36163ff to
9e96035
Compare
9e96035 to
c6d2050
Compare
cf09123 to
fc2e571
Compare
|
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... |
|
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". |
| 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"] |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
| open_incidents = Incident.objects.open() | ||
| total_open = open_incidents.count() |
There was a problem hiding this comment.
What if nothing is open? There might be a procedure "manually mark as closed when seen".
There was a problem hiding this comment.
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"
|
|
||
| // 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" %}'; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Fair point, it doesn't really have a high maintenance burden as long as they are co-located.
2591ea9 to
450c458
Compare
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. |
450c458 to
5907b9f
Compare
|



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