parent
06a44119de
commit
878ef05896
|
@ -154,15 +154,15 @@ class Monitoring_HostsController extends Controller
|
|||
$this->view->problemObjects = $this->hostList->getProblemObjects();
|
||||
|
||||
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/hosts/acknowledge-problem')
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->filterFromResult());
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter());
|
||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->filterFromResult());
|
||||
->setQueryString($this->hostList->getUnhandledObjects()->objectsFilter());
|
||||
$this->view->downtimeLink = Url::fromPath('monitoring/hosts/schedule-downtime')
|
||||
->setQueryString($this->hostList->getProblemObjects()->filterFromResult());
|
||||
->setQueryString($this->hostList->getProblemObjects()->objectsFilter());
|
||||
$this->view->acknowledgedObjects = $this->hostList->getAcknowledgedObjects();
|
||||
$this->view->objectsInDowntime = $this->hostList->getObjectsInDowntime();
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/downtimes')
|
||||
->setQueryString($this->hostList->getObjectsInDowntime()->filterFromResult());
|
||||
->setQueryString($this->hostList->getObjectsInDowntime()->objectsFilter(array('host' => 'downtime_host')));
|
||||
|
||||
$this->view->commentsLink = Url::fromRequest()->setPath('monitoring/list/comments');
|
||||
$this->view->baseFilter = $this->hostList->getFilter();
|
||||
|
|
|
@ -191,15 +191,16 @@ class Monitoring_ServicesController extends Controller
|
|||
$this->view->unhandledObjects = $this->serviceList->getUnhandledObjects();
|
||||
$this->view->problemObjects = $this->serviceList->getProblemObjects();
|
||||
$this->view->acknowledgeUnhandledLink = Url::fromPath('monitoring/services/acknowledge-problem')
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->filterFromResult()->toQueryString());
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeUnhandledLink = Url::fromPath('monitoring/services/schedule-downtime')
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->filterFromResult()->toQueryString());
|
||||
->setQueryString($this->serviceList->getUnhandledObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->downtimeLink = Url::fromPath('monitoring/services/schedule-downtime')
|
||||
->setQueryString($this->serviceList->getProblemObjects()->filterFromResult()->toQueryString());
|
||||
->setQueryString($this->serviceList->getProblemObjects()->objectsFilter()->toQueryString());
|
||||
$this->view->acknowledgedObjects = $acknowledgedObjects;
|
||||
$this->view->objectsInDowntime = $this->serviceList->getObjectsInDowntime();
|
||||
$this->view->inDowntimeLink = Url::fromPath('monitoring/list/downtimes')
|
||||
->setQueryString($this->serviceList->getObjectsInDowntime()->filterFromResult()->toQueryString());
|
||||
->setQueryString($this->serviceList->getObjectsInDowntime()
|
||||
->objectsFilter(array('host' => 'downtime_host', 'service' => 'downtime_service'))->toQueryString());
|
||||
$this->view->commentsLink = Url::fromRequest()
|
||||
->setPath('monitoring/list/comments');
|
||||
$this->view->baseFilter = $this->serviceList->getFilter();
|
||||
|
|
|
@ -78,11 +78,11 @@ class HostList extends ObjectList
|
|||
*
|
||||
* @return array An
|
||||
*/
|
||||
public function filterFromResult()
|
||||
public function objectsFilter($columns = array('host' => 'host'))
|
||||
{
|
||||
$filterExpression = array();
|
||||
foreach ($this as $host) {
|
||||
$filterExpression[] = Filter::where('host', $host->getName());
|
||||
$filterExpression[] = Filter::where($columns['host'], $host->getName());
|
||||
}
|
||||
return FilterOr::matchAny($filterExpression);
|
||||
}
|
||||
|
|
|
@ -194,12 +194,16 @@ abstract class ObjectList implements Countable, IteratorAggregate
|
|||
$list = new $class($this->backend);
|
||||
$list->objects = $objects;
|
||||
$list->count = count($objects);
|
||||
$list->filter = $list->filterFromResult();
|
||||
$list->filter = $list->objectsFilter();
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Filter
|
||||
* Create a filter that matches exactly the elements of this object list
|
||||
*
|
||||
* @param array $columns Override default column names.
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
abstract function filterFromResult();
|
||||
abstract function objectsFilter($columns = array());
|
||||
}
|
||||
|
|
|
@ -119,15 +119,17 @@ class ServiceList extends ObjectList
|
|||
/**
|
||||
* Returns a Filter that matches all hosts in this HostList
|
||||
*
|
||||
* @return Filter
|
||||
* @param array $columns Override filter column names
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
public function filterFromResult()
|
||||
public function objectsFilter($columns = array('host' => 'host', 'service' => 'service'))
|
||||
{
|
||||
$filterExpression = array();
|
||||
foreach ($this as $service) {
|
||||
$filterExpression[] = Filter::matchAll(
|
||||
Filter::where('host', $service->getHost()->getName()),
|
||||
Filter::where('service', $service->getName())
|
||||
Filter::where($columns['host'], $service->getHost()->getName()),
|
||||
Filter::where($columns['service'], $service->getName())
|
||||
);
|
||||
}
|
||||
return FilterOr::matchAny($filterExpression);
|
||||
|
|
Loading…
Reference in New Issue