diff --git a/changelog.d/1938.added.md b/changelog.d/1938.added.md new file mode 100644 index 000000000..c5f956cec --- /dev/null +++ b/changelog.d/1938.added.md @@ -0,0 +1 @@ +Added a kiosk mode to the main view, providing a minimal version of the incident list suitable for passive Argus usage. diff --git a/docs/user-manual.rst b/docs/user-manual.rst index 4abc4883c..f5641e880 100644 --- a/docs/user-manual.rst +++ b/docs/user-manual.rst @@ -187,6 +187,15 @@ Change how often the incidents table gets refreshed 3. Select how often you want the incidents to be updated. +Use kiosk mode +-------------- + +Kiosk mode is a read-only view of the incidents table intended for display +screens such as NOC monitors, which frees up more vertical space by simplifying the interface. +It can be accessed via the ``Kiosk`` button in the filter toolbar, or directly at **/incidents/kiosk/**. + +To exit kiosk mode, you can press the ``Exit kiosk`` button in the filter toolbar. + Decide which incidents are shown in the table --------------------------------------------- diff --git a/src/argus/htmx/incident/urls.py b/src/argus/htmx/incident/urls.py index c33247357..8e34aeb01 100644 --- a/src/argus/htmx/incident/urls.py +++ b/src/argus/htmx/incident/urls.py @@ -6,6 +6,7 @@ app_name = "htmx" urlpatterns = [ path("", views.incident_list, name="incident-list"), + path("kiosk/", views.incident_list_kiosk, name="incident-list-kiosk"), path("/", views.incident_detail, name="incident-detail"), path("update//", views.incident_update, name="incident-update"), path("filter/", views.filter_form, name="incident-filter"), diff --git a/src/argus/htmx/incident/views.py b/src/argus/htmx/incident/views.py index d48322238..1e1c695e8 100644 --- a/src/argus/htmx/incident/views.py +++ b/src/argus/htmx/incident/views.py @@ -18,6 +18,7 @@ QueryDict, ) from django.shortcuts import render, get_object_or_404 +from django.urls import reverse from django.utils.timezone import now as tznow from django.views.decorators.http import require_POST, require_GET @@ -46,6 +47,7 @@ User = get_user_model() LOG = logging.getLogger(__name__) +KIOSK_URL_NAME = "htmx:incident-list-kiosk" # Map request trigger to parameters for incidents update @@ -266,7 +268,7 @@ def search_tags(request): @require_GET -def incident_list(request: HtmxHttpRequest) -> HttpResponse: +def incident_list(request: HtmxHttpRequest, kiosk_mode: bool = False) -> HttpResponse: LOG = logging.getLogger(__name__ + ".incident_list") LOG.debug("GET at start: %s", request.GET) request.GET = dedupe_querydict(request.GET) @@ -275,6 +277,8 @@ def incident_list(request: HtmxHttpRequest) -> HttpResponse: preferences = request.user.get_preferences_context() column_layout_name = preferences["argus_htmx"]["incidents_table_column_name"] columns = get_incident_table_columns(column_layout_name) + if kiosk_mode: + columns = [c for c in columns if c.name != "row_select"] # Handle sorting sort_form = SortForm(request.GET) @@ -345,6 +349,14 @@ def incident_list(request: HtmxHttpRequest) -> HttpResponse: else: base_template = "htmx/incident/_base.html" + incident_list_url = reverse(KIOSK_URL_NAME if kiosk_mode else "htmx:incident-list") + + kiosk_filter_name = None + if kiosk_mode and not request.htmx: + selected_filter_id = request.session.get("selected_filter") + if selected_filter_id: + kiosk_filter_name = Filter.objects.filter(id=selected_filter_id).values_list("name", flat=True).first() + LOG.debug("GET at end: %s", request.GET) context = { "columns": columns, @@ -358,5 +370,13 @@ def incident_list(request: HtmxHttpRequest) -> HttpResponse: "page": page, "last_page_num": last_page_num, "second_to_last_page": last_page_num - 1, + "kiosk_mode": kiosk_mode, + "kiosk_filter_name": kiosk_filter_name, + "incident_list_url": incident_list_url, } return render(request, "htmx/incident/incident_list.html", context=context) + + +@require_GET +def incident_list_kiosk(request: HtmxHttpRequest) -> HttpResponse: + return incident_list(request, kiosk_mode=True) diff --git a/src/argus/htmx/templates/htmx/base.html b/src/argus/htmx/templates/htmx/base.html index 8a369b713..6d683452e 100644 --- a/src/argus/htmx/templates/htmx/base.html +++ b/src/argus/htmx/templates/htmx/base.html @@ -27,6 +27,8 @@ {% endcomment %} {% endblock navlinks %} + {% block navbar_kiosk %} + {% endblock navbar_kiosk %} diff --git a/src/argus/htmx/templates/htmx/incident/_incident_table_autorefresh.html b/src/argus/htmx/templates/htmx/incident/_incident_table_autorefresh.html index 009a3ef82..28039b293 100644 --- a/src/argus/htmx/templates/htmx/incident/_incident_table_autorefresh.html +++ b/src/argus/htmx/templates/htmx/incident/_incident_table_autorefresh.html @@ -1,8 +1,8 @@ {# djlint:off #} {% with preferences.argus_htmx.update_interval as update_interval %} {% if update_interval != 'never' %} - hx-get="{% url 'htmx:incident-list' %}" - hx-vals='{"page": "{{ page.number }}"}' + hx-get="{{ incident_list_url }}" + hx-vals='{"page": "{{ page.number }}"{% if kiosk_mode %}, "sort": "{{ current_sort }}", "sort_order": "{{ current_sort_order }}"{% endif %}' hx-target="this" hx-swap="outerHTML" hx-trigger="every {{ update_interval }}s" diff --git a/src/argus/htmx/templates/htmx/incident/_incident_table_footer.html b/src/argus/htmx/templates/htmx/incident/_incident_table_footer.html index b929b0346..5623910d4 100644 --- a/src/argus/htmx/templates/htmx/incident/_incident_table_footer.html +++ b/src/argus/htmx/templates/htmx/incident/_incident_table_footer.html @@ -1,21 +1,23 @@ - - -
- {% block refresh_info %} - {% include "htmx/incident/_incident_list_refresh_info.html" %} - {% endblock refresh_info %} - {% include "./_incident_table_paginator.html" %} -
- - + {% if not kiosk_mode %} + + +
+ {% block refresh_info %} + {% include "htmx/incident/_incident_list_refresh_info.html" %} + {% endblock refresh_info %} + {% include "./_incident_table_paginator.html" %} +
+ + + {% endif %}