Merge pull request #3871 from Icinga/feature/add-servicegrid-problem-toggle-3793
Servicegrid: Add toggle to show problems only or everything
This commit is contained in:
commit
d13cade0f3
|
@ -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;
|
||||
|
@ -671,6 +672,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(
|
||||
|
|
|
@ -6,6 +6,7 @@ use Icinga\Web\Url;
|
|||
if (! $this->compact): ?>
|
||||
<div class="controls">
|
||||
<?= $this->tabs ?>
|
||||
<?= $this->problemToggle ?>
|
||||
<div class="sort-controls-container">
|
||||
<?= $this->sortBox ?>
|
||||
</div>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue