Skip to content

Commit 450c458

Browse files
committed
Use maintenance column layout preset in filter preview
1 parent aa46a98 commit 450c458

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/argus/htmx/defaults.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
"events",
3030
],
3131
"on maintenance": [
32+
"start_time",
33+
"level",
3234
"source_type",
3335
"source",
36+
"description",
3437
"tags",
35-
"under_maintenance",
3638
],
3739
}
3840
ARGUS_HTMX_FILTER_FUNCTION = "argus.htmx.incident.filter.incident_list_filter"

src/argus/htmx/incident/columns.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
CELL_WRAPPER_TEMPLATE_LINK_TO_DETAILS = "htmx/incident/_incident_table_cell_wrapper_link_to_details.html"
2222

2323
BUILTIN_COLUMN_LAYOUT_NAME = "built-in"
24+
MAINTENANCE_COLUMN_LAYOUT_NAME = "on maintenance"
2425
_DEFAULT_COLUMN_LAYOUT_NAME = "default"
2526

2627

src/argus/htmx/plannedmaintenance/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from django.views.generic import CreateView, DeleteView, DetailView, ListView, UpdateView
1212

1313
from argus.filter.queryset_filters import QuerySetFilter
14-
from argus.htmx.incident.columns import BUILTIN_COLUMNS
14+
from argus.htmx.incident.columns import get_incident_table_columns, MAINTENANCE_COLUMN_LAYOUT_NAME
1515
from argus.htmx.utils import TemplateNameViewMixin
1616
from argus.htmx.widgets import SearchDropdownMultiSelect
1717
from argus.incident.models import Incident
@@ -20,7 +20,6 @@
2020
from argus.util.datetime_utils import LOCAL_INFINITY
2121

2222
FLATPICKR_DATETIME_FORMAT = "%Y-%m-%d %H:%M"
23-
FILTER_PREVIEW_COLUMNS = ["start_time", "level", "source_type", "source", "description", "tags"]
2423
FILTER_PREVIEW_LIMIT = 5
2524

2625

@@ -218,6 +217,7 @@ def filter_preview(request):
218217
matching_count = matching_qs.count()
219218
matching_percent = round(100 * matching_count / total_open) if total_open else 0
220219
incident_list = matching_qs.select_related("source").order_by("-start_time")[:FILTER_PREVIEW_LIMIT]
220+
columns = get_incident_table_columns(MAINTENANCE_COLUMN_LAYOUT_NAME)
221221

222222
return render(
223223
request,
@@ -227,7 +227,7 @@ def filter_preview(request):
227227
"matching_percent": matching_percent,
228228
"total_open": total_open,
229229
"incident_list": incident_list,
230-
"columns": [BUILTIN_COLUMNS[name] for name in FILTER_PREVIEW_COLUMNS],
230+
"columns": columns,
231231
"compact": True,
232232
"dummy_column": True,
233233
},

0 commit comments

Comments
 (0)