monitoring: Restrict problem badges
The code should be placed somewhere else in the future. refs #9009
This commit is contained in:
parent
4dc2eb9f4a
commit
3425b71b4d
|
@ -3,7 +3,10 @@
|
|||
|
||||
namespace Icinga\Module\Monitoring\Web\Menu;
|
||||
|
||||
use Icinga\Web\Menu as Menu;
|
||||
use Icinga\Authentication\Manager;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\Filterable;
|
||||
use Icinga\Web\Menu;
|
||||
use Icinga\Module\Monitoring\Backend\MonitoringBackend;
|
||||
use Icinga\Web\Menu\MenuItemRenderer;
|
||||
|
||||
|
@ -13,16 +16,36 @@ class MonitoringMenuItemRenderer extends MenuItemRenderer
|
|||
|
||||
protected $columns = array();
|
||||
|
||||
/**
|
||||
* Apply a restriction on the given data view
|
||||
*
|
||||
* @param string $restriction The name of restriction
|
||||
* @param Filterable $filterable The filterable to restrict
|
||||
*
|
||||
* @return Filterable The filterable
|
||||
*/
|
||||
protected static function applyRestriction($restriction, Filterable $filterable)
|
||||
{
|
||||
$restrictions = Filter::matchAny();
|
||||
foreach (Manager::getInstance()->getRestrictions($restriction) as $filter) {
|
||||
$restrictions->addFilter(Filter::fromQueryString($filter));
|
||||
}
|
||||
$filterable->applyFilter($restrictions);
|
||||
return $filterable;
|
||||
}
|
||||
|
||||
protected static function summary($column = null)
|
||||
{
|
||||
if (self::$summary === null) {
|
||||
self::$summary = MonitoringBackend::instance()->select()->from(
|
||||
$summary = MonitoringBackend::instance()->select()->from(
|
||||
'statusSummary',
|
||||
array(
|
||||
'hosts_down_unhandled',
|
||||
'services_critical_unhandled'
|
||||
)
|
||||
)->getQuery()->fetchRow();
|
||||
);
|
||||
static::applyRestriction('monitoring/filter/objects', $summary);
|
||||
self::$summary = $summary->fetchRow();
|
||||
}
|
||||
|
||||
if ($column === null) {
|
||||
|
|
Loading…
Reference in New Issue