diff --git a/modules/monitoring/application/controllers/ListController.php b/modules/monitoring/application/controllers/ListController.php index c0d8ad03b..45c3b1c9b 100644 --- a/modules/monitoring/application/controllers/ListController.php +++ b/modules/monitoring/application/controllers/ListController.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Monitoring\Controllers; +use Icinga\Web\Form; use Zend_Form; use Icinga\Data\Filter\Filter; use Icinga\Module\Monitoring\Backend; @@ -669,6 +670,19 @@ class ListController extends Controller $this->applyRestriction('monitoring/filter/objects', $query); $this->filterQuery($query); $filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null; + + $this->view->problemToggle = $problemToggle = new Form(['method' => 'GET']); + $problemToggle->setUidDisabled(); + $problemToggle->setTokenDisabled(); + $problemToggle->setAttrib('class', 'filter-toggle inline icinga-controls'); + $problemToggle->addElement('checkbox', 'problems', [ + 'disableHidden' => true, + 'autosubmit' => true, + 'value' => $filter !== null, + 'label' => $this->translate('Problems Only'), + 'decorators' => ['ViewHelper', ['Label', ['placement' => 'APPEND']]] + ]); + if ($this->params->get('flipped', false)) { $pivot = $query ->pivot( diff --git a/modules/monitoring/application/views/scripts/list/servicegrid.phtml b/modules/monitoring/application/views/scripts/list/servicegrid.phtml index e1c3cf942..d0ed4bc49 100644 --- a/modules/monitoring/application/views/scripts/list/servicegrid.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegrid.phtml @@ -6,6 +6,7 @@ use Icinga\Web\Url; if (! $this->compact): ?>
tabs ?> + problemToggle ?>
sortBox ?>
diff --git a/modules/monitoring/public/css/service-grid.less b/modules/monitoring/public/css/service-grid.less index a5e45ab04..2501afb1f 100644 --- a/modules/monitoring/public/css/service-grid.less +++ b/modules/monitoring/public/css/service-grid.less @@ -60,3 +60,16 @@ vertical-align: middle; width: 1.5em; } + +form.filter-toggle { + label:not(.toggle-switch) { + display: inline-block; + vertical-align: top; + margin-left: .5em; + color: @gray-light; + } + + input[type="checkbox"]:checked ~ label { + color: inherit; + } +} \ No newline at end of file