mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
usergroups/: Show search bar control
This commit is contained in:
parent
07f78b507d
commit
5cabd368c2
1 changed files with 22 additions and 3 deletions
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
namespace Icinga\Module\Icingadb\Controllers;
|
||||
|
||||
use GuzzleHttp\Psr7\ServerRequest;
|
||||
use Icinga\Module\Icingadb\Model\Usergroup;
|
||||
use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\ItemList\UsergroupList;
|
||||
use Icinga\Security\SecurityException;
|
||||
|
|
@ -28,6 +30,8 @@ class UsergroupsController extends Controller
|
|||
|
||||
$usergroups = Usergroup::on($db)->with('user');
|
||||
|
||||
$this->handleSearchRequest($usergroups);
|
||||
|
||||
$limitControl = $this->createLimitControl();
|
||||
$paginationControl = $this->createPaginationControl($usergroups);
|
||||
$sortControl = $this->createSortControl(
|
||||
|
|
@ -36,19 +40,34 @@ class UsergroupsController extends Controller
|
|||
'usergroup.display_name' => t('Name')
|
||||
]
|
||||
);
|
||||
$filterControl = $this->createFilterControl($usergroups);
|
||||
$searchBar = $this->createSearchBar($usergroups, [
|
||||
$limitControl->getLimitParam(),
|
||||
$sortControl->getSortParam()
|
||||
]);
|
||||
|
||||
$this->filter($usergroups);
|
||||
$this->filter($usergroups, $searchBar->getFilter());
|
||||
|
||||
yield $this->export($usergroups);
|
||||
|
||||
$this->addControl($paginationControl);
|
||||
$this->addControl($sortControl);
|
||||
$this->addControl($limitControl);
|
||||
$this->addControl($filterControl);
|
||||
$this->addControl($searchBar);
|
||||
|
||||
$this->addContent(new UsergroupList($usergroups));
|
||||
|
||||
if ($searchBar->hasBeenSent()) {
|
||||
$this->sendMultipartUpdate();
|
||||
}
|
||||
|
||||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
||||
public function completeAction()
|
||||
{
|
||||
$suggestions = new ObjectSuggestions();
|
||||
$suggestions->setModel(Usergroup::class);
|
||||
$suggestions->forRequest(ServerRequest::fromGlobals());
|
||||
$this->getDocument()->add($suggestions);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue