monitoring: Add restrictable filter columns to the status summary
refs #9009
This commit is contained in:
parent
2b3acc99e2
commit
45d883dcf1
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
class Test
|
||||
{
|
||||
protected $filters = array();
|
||||
|
||||
public function work()
|
||||
{
|
||||
foreach ($this->getFilters() as $key => &$value) {
|
||||
$value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function &getFilters()
|
||||
{
|
||||
return $this->filters;
|
||||
}
|
||||
}
|
||||
|
||||
$x = new Test();
|
||||
$b =& $x->getFilters();
|
||||
$b[1] = 0;
|
||||
var_dump($b, $x->getFilters());die;
|
|
@ -96,4 +96,31 @@ class StatusSummary extends DataView
|
|||
'services_unknown_not_checked_on_problem_hosts'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilterColumns()
|
||||
{
|
||||
return array(
|
||||
'host', 'host_alias', 'host_display_name', 'host_name',
|
||||
'hostgroup', 'hostgroup_alias', 'hostgroup_name',
|
||||
'service', 'service_description', 'service_display_name',
|
||||
'servicegroup', 'servicegroup_alias', 'servicegroup_name'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isValidFilterTarget($column)
|
||||
{
|
||||
if ($column[0] === '_'
|
||||
&& preg_match('/^_(?:host|service)_/', $column)
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
return in_array($column, $this->getFilterColumns());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue