Modified ListController hostfields

This is a preliminary change to get the required fields, although
the views and queries will heavily change during the sprint, so
it's work in progress

refs #4179
This commit is contained in:
Jannis Moßhammer 2013-07-12 13:53:11 +02:00
parent a0f96379a9
commit 8598743cc1
1 changed files with 27 additions and 16 deletions

View File

@ -3,6 +3,7 @@
use Icinga\Web\ModuleActionController; use Icinga\Web\ModuleActionController;
use Icinga\Web\Hook; use Icinga\Web\Hook;
use Icinga\Monitoring\Backend; use Icinga\Monitoring\Backend;
use Icinga\Application\Benchmark;
class Monitoring_ListController extends ModuleActionController class Monitoring_ListController extends ModuleActionController
{ {
@ -19,16 +20,27 @@ class Monitoring_ListController extends ModuleActionController
public function hostsAction() public function hostsAction()
{ {
$this->view->hosts = $this->backend->select()->from('status', array( Benchmark::measure("hostsAction::query()");
'host_name', $this->view->hosts = $this->backend->select()->from(
'host_state', 'status',
'host_acknowledged', array(
'host_output', 'host_icon_image',
'host_in_downtime', 'host_name',
'host_handled', 'host_state',
'host_last_state_change' 'host_address',
)); 'host_acknowledged',
'host_output',
'host_in_downtime',
'is_flapping',
'state_type',
'host_handled',
'host_last_state_change',
'notifications_enabled',
'problems'
// 'host_comment_count'
)
);
if ($search = $this->_getParam('search')) { if ($search = $this->_getParam('search')) {
$this->_setParam('search', null); $this->_setParam('search', null);
if (strpos($search, '=') === false) { if (strpos($search, '=') === false) {
@ -40,13 +52,12 @@ class Monitoring_ListController extends ModuleActionController
} }
} }
} }
$this->view->hosts->applyRequest($this->_request);
$this->view->hosts->getQuery()->group('hs.host_object_id');
if ($this->_getParam('dump') === 'sql') {
echo '<pre>' . htmlspecialchars(wordwrap($this->view->hosts->getQuery()->dump())) . '</pre>';
exit;
}
$this->view->hosts->getQuery()->group('host_id');
if ($this->_getParam('dump') === 'sql') {
echo '<pre>' . htmlspecialchars(wordwrap($this->view->hosts->getQuery()->dump())) . '</pre>';
exit;
}
// TODO: Get rid of "preserve" // TODO: Get rid of "preserve"
$preserve = array(); $preserve = array();
if ($this->_getParam('sort')) { if ($this->_getParam('sort')) {