Do not search with empty search string, add servicegroups

This commit is contained in:
Thomas Gelf 2014-03-25 12:28:22 +00:00
parent ac90ccfd22
commit ad0432f3be
2 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,10 @@ class SearchController extends ActionController
{
$this->setAutorefreshInterval(10);
$search = $this->_request->getParam('q');
if (! $search) {
$this->view->hint = $this->translate('Ready to search, waiting for your input');
return;
}
$dashboard = Widget::create('dashboard')->createPane('Search');
$pane = $dashboard->getPane('Search');
$suffix = strlen($search) ? ': ' . rtrim($search, '*') . '*' : '';
@ -37,6 +41,10 @@ class SearchController extends ActionController
'hostgroup' => $search . '*',
'limit' => 10,
)));
$pane->addComponent('Servicegroups' . $suffix, Url::fromPath('monitoring/list/servicegroups', array(
'servicegroup' => $search . '*',
'limit' => 10,
)));
$dashboard->activate('Search');
$this->view->dashboard = $dashboard;
$this->view->tabs = $dashboard->getTabs();

View File

@ -2,6 +2,12 @@
<?= $this->tabs ?>
</div>
<?php if ($this->dashboard): ?>
<div class="content dashboard">
<?= $this->dashboard ?>
</div>
<?php else: ?>
<div class="content">
<strong><?= $this->hint ?></strong>
</div>
<?php endif ?>