Create incident list update interval preference #1174
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR creates a preference
argus_htmx.update_interval
. The preference can be managed through the settings:ARGUS_INCIDENTS_UPDATE_INTERVALS
ARGUS_INCIDENTS_UPDATE_INTERVAL_DEFAULT
The default values are
["never", 5, 30, 60]
with values in seconds. The default default is 30."never"
is a special value that disables auto refreshIn the UI, a user can change their preference at the bottom of the incident list table in the refresh info block. There already was a dropdown for the page size. The behaviour of the update interval dropdown is however, different. Where page_size adds the page_size as a query param and does a partial page reload. Due to the internals of how htmx handles "every xs" triggers, it is not feasible to do a partial reload when changing the update_interval. See also bigskysoftware/htmx#3170. We therefore need to do a full page refresh when changing the update interval. This also means that we cannot send the update_interval as a query param like we do with page_size. When triggering an HX-Refresh, the client sends refreshes the current page (with current query params). The update_interval is not yet part of the query params, so now it won't pick up the change... I therefore opted to make it a non-param setting, like with date_format.
Other things:
load
trigger from filterbox. On page load, the incidents should already be correctly filtered, so this resulted in an additional, unnecessary request.hx-include
for refreshing the incident list to.incident-list-param
so that we have a single way to include certain parameters in the refresh. Just add that class to any form or input that needs to be included