autorefresh even for search results, nicer headers

This commit is contained in:
Thomas Gelf 2014-03-04 13:25:58 +00:00
parent 915a024030
commit 635cdcbbc5

View File

@ -18,21 +18,23 @@ class SearchController extends ActionController
{ {
public function indexAction() public function indexAction()
{ {
$this->setAutorefreshInterval(10);
$search = $this->_request->getParam('q'); $search = $this->_request->getParam('q');
$dashboard = Widget::create('dashboard')->createPane('Search'); $dashboard = Widget::create('dashboard')->createPane('Search');
$pane = $dashboard->getPane('Search'); $pane = $dashboard->getPane('Search');
$pane->addComponent('Hosts', Url::fromPath('monitoring/list/hosts', array( $suffix = strlen($search) ? ': ' . rtrim($search, '*') . '*' : '';
$pane->addComponent('Hosts' . $suffix, Url::fromPath('monitoring/list/hosts', array(
'host_name' => $search . '*', 'host_name' => $search . '*',
'sort' => 'host_severity', 'sort' => 'host_severity',
'limit' => 10, 'limit' => 10,
))); )));
$pane->addComponent('Services', Url::fromPath('monitoring/list/services', array( $pane->addComponent('Services' . $suffix, Url::fromPath('monitoring/list/services', array(
'service_description' => '*' . $search . '*', 'service_description' => $search . '*',
'sort' => 'service_severity', 'sort' => 'service_severity',
'limit' => 10, 'limit' => 10,
))); )));
$pane->addComponent('Hostgroups', Url::fromPath('monitoring/list/hostgroups', array( $pane->addComponent('Hostgroups' . $suffix, Url::fromPath('monitoring/list/hostgroups', array(
'hostgroup' => '*' . $search . '*', 'hostgroup' => $search . '*',
'limit' => 10, 'limit' => 10,
))); )));
$dashboard->activate('Search'); $dashboard->activate('Search');