Fix multiselect views of hosts and services

I've broke this with #9472.
This commit is contained in:
Johannes Meyer 2015-06-24 15:11:33 +02:00
parent b741845d54
commit 20fd3d6758
4 changed files with 16 additions and 9 deletions

View File

@ -117,7 +117,7 @@ class Monitoring_HostsController extends Controller
$this->view->removeAckForm = $removeAckForm;
}
$hostStates = (object)$this->hostList->getStateSummary();
$hostStates = $this->hostList->getStateSummary();
$this->setAutorefreshInterval(15);
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check');

View File

@ -84,7 +84,6 @@ class Monitoring_ServicesController extends Controller
$this->view->objects = $this->serviceList;
$this->view->stats = $this->serviceList->getServiceStateSummary();
$this->view->serviceStates = true;
$this->view->hostStates = $this->serviceList->getHostStateSummary();
$this->_helper->viewRenderer('partials/command/objects-command-form', null, true);
return $form;
}
@ -145,7 +144,6 @@ class Monitoring_ServicesController extends Controller
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/services/add-comment');
$this->view->deleteCommentLink = Url::fromRequest()->setPath('monitoring/services/delete-comment');
$this->view->stats = $this->serviceList->getServiceStateSummary();
$this->view->hostStats = $this->serviceList->getHostStateSummary();
$this->view->objects = $this->serviceList;
$this->view->unhandledObjects = $this->serviceList->getUnhandledObjects();
$this->view->problemObjects = $this->serviceList->getProblemObjects();

View File

@ -3,8 +3,10 @@
namespace Icinga\Module\Monitoring\Object;
use Icinga\Data\DataArray\ArrayDatasource;
use Icinga\Data\Filter\Filter;
use Icinga\Data\Filter\FilterOr;
use Icinga\Data\SimpleQuery;
use Icinga\Util\String;
/**
@ -33,7 +35,7 @@ class HostList extends ObjectList
/**
* Create a state summary of all hosts that can be consumed by hostssummary.phtml
*
* @return object The summary
* @return SimpleQuery
*/
public function getStateSummary()
{
@ -48,7 +50,8 @@ class HostList extends ObjectList
$hostStates['hosts_total'] = count($this);
return (object)$hostStates;
$ds = new ArrayDatasource(array((object) $hostStates));
return $ds->select();
}
/**

View File

@ -3,8 +3,10 @@
namespace Icinga\Module\Monitoring\Object;
use Icinga\Data\DataArray\ArrayDatasource;
use Icinga\Data\Filter\Filter;
use Icinga\Data\Filter\FilterOr;
use Icinga\Data\SimpleQuery;
use Icinga\Util\String;
/**
@ -37,27 +39,31 @@ class ServiceList extends ObjectList
/**
* Create a state summary of all services that can be consumed by servicesummary.phtml
*
* @return object The summary
* @return SimpleQuery
*/
public function getServiceStateSummary()
{
if (! $this->serviceStateSummary) {
$this->initStateSummaries();
}
return (object)$this->serviceStateSummary;
$ds = new ArrayDatasource(array((object) $this->serviceStateSummary));
return $ds->select();
}
/**
* Create a state summary of all hosts that can be consumed by hostsummary.phtml
*
* @return object The summary
* @return SimpleQuery
*/
public function getHostStateSummary()
{
if (! $this->hostStateSummary) {
$this->initStateSummaries();
}
return (object)$this->hostStateSummary;
$ds = new ArrayDatasource(array((object) $this->hostStateSummary));
return $ds->select();
}
/**