Add Configurable Sortcontrols - #404
Open
gbin2265 wants to merge 1 commit into
Open
Conversation
This was referenced Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
To avoid having to modify the source code every time additional
SortControlsneed to be added—not only in theicingadb-webmodule, but also in modules such as Kubernetes and others—I would like to propose the following change.The information below describes how to add additional
SortControlsto different modules that make use ofipl-web.; Extra sort options for list views built on ipl-web.
;
; Location: /etc/icingaweb2/sortcontrols.ini
; Ownership: root:icingaweb2, mode 0660 (must be readable by the web server user)
;
; One section per sort option. The section name is only an identifier and must be
; unique within this file; it is never shown in the UI. Prefixing it with the view
; keeps related options together.
;
; type Comma separated list of views this option applies to. The first segment is
; always the MODULE name, not the web path -- a URL like
; https://host/icingaweb2/notifications/incidents is module "notifications",
; controller "incidents", so the value is "notifications/incidents".
; Two segments mean module and controller, three mean module, controller and
; action (icingadb/host/services).
; sort The full sort spec, exactly as it would appear in the ?sort= URL parameter.
; Multiple columns are allowed, separated by commas.
; title Label shown in the "Sort By" dropdown. Optional; defaults to the sort spec.
; Not translatable, since it does not end up in the .po catalogs.
;
; Options appear in the dropdown in the order they are listed here, after the ones
; that ship with the module. Columns must exist on the model backing the view; a typo
; does not break the page on load, only when someone actually selects the option.
;
;
; WHICH VIEWS WORK DEPENDS ON WHICH PATCH IS INSTALLED
;
; icingadb-web patch -- covers the Icinga DB views only (the first block below).
; ipl-web patch -- covers every view here, plus any other ipl-web based module.
;
; Entries for a view whose module is not patched are silently ignored: no error, no
; log line, the option simply does not appear. Keep that in mind when debugging.
;
;
; ICINGA DB WEB 1.4.0
;
; Object lists
; icingadb/hostgroups Model/Hostgroupsummary.php
; icingadb/servicegroups Model/ServicegroupSummary.php
; icingadb/hosts Model/Host.php + HostState.php
; icingadb/services Model/Service.php + ServiceState.php
; icingadb/services/grid same, but a separate action with its own set
;
; Host and service lists inside a single group
; icingadb/hostgroup Model/Host.php
; icingadb/servicegroup Model/Service.php
;
; Service list inside a host
; icingadb/host/services Model/Service.php
;
; Dependency lists -- these use Model/DependencyNode.php, so their columns are
; unqualified (name, severity, state) instead of dotted. Do not copy specs from
; the other views here without adapting them.
; icingadb/host/parents
; icingadb/host/children
; icingadb/service/parents
; icingadb/service/children
; icingadb/redundancygroup/members
; icingadb/redundancygroup/children
;
; History and notifications -- one built-in option each, so the most to gain here
; icingadb/history Model/History.php
; icingadb/host/history Model/History.php
; icingadb/service/history Model/History.php
; icingadb/notifications Model/NotificationHistory.php
;
; Comments and downtimes -- icingadb/downtimes already ships with ten options and
; is the best in-tree example of how dotted relation columns are written
; icingadb/comments Model/Comment.php
; icingadb/downtimes Model/Downtime.php
;
; Contacts
; icingadb/contacts Model/User.php
; icingadb/contactgroups Model/Usergroup.php
;
;
; ICINGA NOTIFICATIONS WEB (ipl-web patch required)
;
; Checked against v0.3.0. Note this module uses its own contacts and contact groups,
; unrelated to icingadb/contacts. Built-in options are listed because they are few:
;
; notifications/events event.time desc
; notifications/incidents incident.severity desc + incident.started_at,
; incident.started_at desc, incident.recovered_at
; notifications/schedules schedule.name, changed_at
; notifications/channels name, type, changed_at
; notifications/sources name, type, changed_at
; notifications/event-rules name, changed_at
; notifications/contacts full_name, changed_at
; notifications/contact-groups name, changed_at
;
; notifications/events offers a single option, so it is the thinnest view of the lot.
;
;
; OTHER ipl-web MODULES (ipl-web patch required)
;
; Kubernetes, Director, x509, reporting and the like are covered as well, but their
; view names are not listed here because they vary per version. Open the view, read
; the module and controller off the URL, and use that as the type.
;
; Not covered by either patch: the Icinga Web 2 core views (users, groups, roles,
; navigation, announcements, health). Those use the older SortBox widget.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Icinga DB -- host groups
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[hostgroups_hst_down_unhandled]
type = "icingadb/hostgroups"
sort = "hosts_down_unhandled desc,hosts_pending desc"
title = "Hst Down Unhandled"
[hostgroups_hst_down_handled]
type = "icingadb/hostgroups"
sort = "hosts_down_handled desc,hosts_pending desc"
title = "Hst Down Handled"
[hostgroups_hst_pending]
type = "icingadb/hostgroups"
sort = "hosts_pending desc"
title = "Hst Pending"
[hostgroups_srv_warning_unhandled]
type = "icingadb/hostgroups"
sort = "services_warning_unhandled desc"
title = "Srv Unhandled Warning"
[hostgroups_srv_critical_unhandled]
type = "icingadb/hostgroups"
sort = "services_critical_unhandled desc"
title = "Srv Unhandled Critial"
[hostgroups_srv_unknown_unhandled]
type = "icingadb/hostgroups"
sort = "services_unknown_unhandled desc"
title = "Srv Unhandled Unknown"
[hostgroups_srv_critical_warning_unhandled]
type = "icingadb/hostgroups"
sort = "services_critical_unhandled desc,services_warning_unhandled desc"
title = "Srv Unhandled Critial,Warning"
[hostgroups_srv_total]
type = "icingadb/hostgroups"
sort = "services_total desc"
title = "Srv Total Services"
[hostgroups_srv_ok]
type = "icingadb/hostgroups"
sort = "services_ok desc"
title = "Srv Ok"
[hostgroups_srv_pending]
type = "icingadb/hostgroups"
sort = "services_pending desc"
title = "Srv Pending"
[hostgroups_srv_warning_handled]
type = "icingadb/hostgroups"
sort = "services_warning_handled desc"
title = "Srv Handled Warning"
[hostgroups_srv_unknown_handled]
type = "icingadb/hostgroups"
sort = "services_unknown_handled desc"
title = "Srv Handled Unknown"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Icinga DB -- service groups
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[servicegroups_srv_warning_unhandled]
type = "icingadb/servicegroups"
sort = "services_warning_unhandled desc"
title = "Srv Unhandled Warning"
[servicegroups_srv_critical_unhandled]
type = "icingadb/servicegroups"
sort = "services_critical_unhandled desc"
title = "Srv Unhandled Critial"
[servicegroups_srv_unknown_unhandled]
type = "icingadb/servicegroups"
sort = "services_unknown_unhandled desc"
title = "Srv Unhandled Unknown"
[servicegroups_srv_critical_warning_unhandled]
type = "icingadb/servicegroups"
sort = "services_critical_unhandled desc,services_warning_unhandled desc"
title = "Srv Unhandled Critial,Warning"
[servicegroups_srv_total]
type = "icingadb/servicegroups"
sort = "services_total desc"
title = "Srv Total Services"
[servicegroups_srv_ok]
type = "icingadb/servicegroups"
sort = "services_ok desc"
title = "Srv Ok"
[servicegroups_srv_pending]
type = "icingadb/servicegroups"
sort = "services_pending desc"
title = "Srv Pending"
[servicegroups_srv_warning_handled]
type = "icingadb/servicegroups"
sort = "services_warning_handled desc"
title = "Srv Handled Warning"
[servicegroups_srv_unknown_handled]
type = "icingadb/servicegroups"
sort = "services_unknown_handled desc"
title = "Srv Handled Unknown"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Icinga Notifications -- examples, disabled
;
; These need the ipl-web patch; with the icingadb-web patch they are ignored.
; Checked against Notifications Web v0.3.0. To enable, remove the leading ';'
; from the section header and its three keys.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Model/Event.php: time, object_id, type, severity, message, username, mute, mute_reason
;
;[notifications_evt_severity]
;type = "notifications/events"
;sort = "event.severity desc,event.time desc"
;title = "Severity"
;
;[notifications_evt_type]
;type = "notifications/events"
;sort = "event.type,event.time desc"
;title = "Event Type"
;
;[notifications_evt_oldest]
;type = "notifications/events"
;sort = "event.time"
;title = "Received On (oldest first)"
; Model/Incident.php: object_id, started_at, recovered_at, severity
;
;[notifications_inc_open_longest]
;type = "notifications/incidents"
;sort = "incident.started_at"
;title = "Open Longest"
;
;[notifications_inc_recovered_recent]
;type = "notifications/incidents"
;sort = "incident.recovered_at desc"
;title = "Recently Recovered"
; Channels, sources and event rules all sort on plain name / type / changed_at
;
;[notifications_chn_recently_changed]
;type = "notifications/channels,notifications/sources,notifications/event-rules"
;sort = "changed_at desc"
;title = "Recently Changed"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Icinga for Kubernetes -- examples, disabled
;
; These need the ipl-web patch; with the icingadb-web patch they are ignored.
; Checked against the current main branch, so verify the columns against your own
; version before enabling. To enable, remove the leading ';' from the section header
; and its three keys.
;
; Kubernetes controllers extend a shared ListController that fills getSortColumns(),
; so patching this module on its own is a one-place change if you prefer that over
; the ipl-web patch.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Model/Pod.php: namespace, name, node_name, ip, phase, icinga_state, restart_policy,
; cpu_limits, cpu_requests, memory_limits, memory_requests, qos, created
;
;[kubernetes_pod_state]
;type = "kubernetes/pods"
;sort = "pod.icinga_state,pod.name"
;title = "State"
;
;[kubernetes_pod_memory_limits]
;type = "kubernetes/pods"
;sort = "pod.memory_limits desc"
;title = "Memory Limits"
;
;[kubernetes_pod_cpu_limits]
;type = "kubernetes/pods"
;sort = "pod.cpu_limits desc"
;title = "CPU Limits"
; Model/Deployment.php: namespace, name, desired_replicas, actual_replicas,
; ready_replicas, unavailable_replicas, icinga_state, created
;
;[kubernetes_deploy_unavailable]
;type = "kubernetes/deployments"
;sort = "deployment.unavailable_replicas desc,deployment.name"
;title = "Unavailable Replicas"
;
;[kubernetes_deploy_state]
;type = "kubernetes/deployments"
;sort = "deployment.icinga_state,deployment.name"
;title = "State"
; Model/Node.php: name, ready, unschedulable, cpu_capacity, memory_capacity,
; pod_capacity, kubelet_version, icinga_state, created
;
;[kubernetes_node_not_ready]
;type = "kubernetes/nodes"
;sort = "node.ready,node.name"
;title = "Not Ready First"
;
;[kubernetes_node_kubelet]
;type = "kubernetes/nodes"
;sort = "node.kubelet_version,node.name"
;title = "Kubelet Version"