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,15 +20,26 @@ class Monitoring_ListController extends ModuleActionController
public function hostsAction() public function hostsAction()
{ {
$this->view->hosts = $this->backend->select()->from('status', array( Benchmark::measure("hostsAction::query()");
$this->view->hosts = $this->backend->select()->from(
'status',
array(
'host_icon_image',
'host_name', 'host_name',
'host_state', 'host_state',
'host_address',
'host_acknowledged', 'host_acknowledged',
'host_output', 'host_output',
'host_in_downtime', 'host_in_downtime',
'is_flapping',
'state_type',
'host_handled', 'host_handled',
'host_last_state_change' '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);
@ -40,13 +52,12 @@ class Monitoring_ListController extends ModuleActionController
} }
} }
} }
$this->view->hosts->applyRequest($this->_request);
$this->view->hosts->getQuery()->group('hs.host_object_id'); $this->view->hosts->getQuery()->group('host_id');
if ($this->_getParam('dump') === 'sql') { if ($this->_getParam('dump') === 'sql') {
echo '<pre>' . htmlspecialchars(wordwrap($this->view->hosts->getQuery()->dump())) . '</pre>'; echo '<pre>' . htmlspecialchars(wordwrap($this->view->hosts->getQuery()->dump())) . '</pre>';
exit; exit;
} }
// TODO: Get rid of "preserve" // TODO: Get rid of "preserve"
$preserve = array(); $preserve = array();
if ($this->_getParam('sort')) { if ($this->_getParam('sort')) {