ObjectsController: introduce quick search

This commit is contained in:
Thomas Gelf 2016-03-20 15:09:58 +01:00
parent d7142b307a
commit 33d323286e
1 changed files with 53 additions and 1 deletions

View File

@ -99,7 +99,59 @@ abstract class ObjectsController extends ActionController
$this->view->title = $this->translate('Icinga ' . ucfirst($ltype) . 's');
$table = $this->loadTable($table)->setConnection($this->db());
$this->view->filterEditor = $table->getFilterEditor($this->getRequest());
$filterEditor = $table->getFilterEditor($this->getRequest());
$filter = $filterEditor->getFilter();
if ($filter->isEmpty()) {
if ($this->params->get('modifyFilter')) {
$this->view->addLink .= ' ' . $this->view->qlink(
$this->translate('Show unfiltered'),
$this->getRequest()->getUrl()->setParams(array()),
null,
array(
'class' => 'icon-cancel',
'data-base-target' => '_self',
)
);
} else {
$this->view->addLink .= ' ' . $this->view->qlink(
$this->translate('Filter'),
$this->getRequest()->getUrl()->with('modifyFilter', true),
null,
array(
'class' => 'icon-search',
'data-base-target' => '_self',
)
);
}
} else {
$this->view->addLink .= ' ' . $this->view->qlink(
$this->shorten($filter, 32),
$this->getRequest()->getUrl()->with('modifyFilter', true),
null,
array(
'class' => 'icon-search',
'data-base-target' => '_self',
)
);
$this->view->addLink .= ' ' . $this->view->qlink(
$this->translate('Show unfiltered'),
$this->getRequest()->getUrl()->setParams(array()),
null,
array(
'class' => 'icon-cancel',
'data-base-target' => '_self',
)
);
}
if ($this->params->get('modifyFilter')) {
$this->view->filterEditor = $filterEditor;
}
if ($this->getRequest()->isApiRequest()) {
$objects = array();