Do not search with empty search string, add servicegroups
This commit is contained in:
parent
ac90ccfd22
commit
ad0432f3be
|
@ -20,6 +20,10 @@ class SearchController extends ActionController
|
||||||
{
|
{
|
||||||
$this->setAutorefreshInterval(10);
|
$this->setAutorefreshInterval(10);
|
||||||
$search = $this->_request->getParam('q');
|
$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');
|
$dashboard = Widget::create('dashboard')->createPane('Search');
|
||||||
$pane = $dashboard->getPane('Search');
|
$pane = $dashboard->getPane('Search');
|
||||||
$suffix = strlen($search) ? ': ' . rtrim($search, '*') . '*' : '';
|
$suffix = strlen($search) ? ': ' . rtrim($search, '*') . '*' : '';
|
||||||
|
@ -37,6 +41,10 @@ class SearchController extends ActionController
|
||||||
'hostgroup' => $search . '*',
|
'hostgroup' => $search . '*',
|
||||||
'limit' => 10,
|
'limit' => 10,
|
||||||
)));
|
)));
|
||||||
|
$pane->addComponent('Servicegroups' . $suffix, Url::fromPath('monitoring/list/servicegroups', array(
|
||||||
|
'servicegroup' => $search . '*',
|
||||||
|
'limit' => 10,
|
||||||
|
)));
|
||||||
$dashboard->activate('Search');
|
$dashboard->activate('Search');
|
||||||
$this->view->dashboard = $dashboard;
|
$this->view->dashboard = $dashboard;
|
||||||
$this->view->tabs = $dashboard->getTabs();
|
$this->view->tabs = $dashboard->getTabs();
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
<?= $this->tabs ?>
|
<?= $this->tabs ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if ($this->dashboard): ?>
|
||||||
<div class="content dashboard">
|
<div class="content dashboard">
|
||||||
<?= $this->dashboard ?>
|
<?= $this->dashboard ?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="content">
|
||||||
|
<strong><?= $this->hint ?></strong>
|
||||||
|
</div>
|
||||||
|
<?php endif ?>
|
||||||
|
|
Loading…
Reference in New Issue