From f630826871c8e46bc1ea655b5eec0c6f87d1bf36 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 5 Mar 2021 13:45:36 +0100 Subject: [PATCH] Implement `searchEditorAction` everywhere else --- application/controllers/CommentsController.php | 16 +++++++++++++++- application/controllers/DowntimesController.php | 15 +++++++++++++++ application/controllers/HistoryController.php | 15 +++++++++++++++ application/controllers/HostgroupsController.php | 15 +++++++++++++++ application/controllers/HostsController.php | 15 +++++++++++++++ .../controllers/NotificationsController.php | 15 +++++++++++++++ .../controllers/ServicegroupsController.php | 15 +++++++++++++++ application/controllers/ServicesController.php | 13 ++++++++----- application/controllers/TacticalController.php | 15 +++++++++++++++ application/controllers/UsergroupsController.php | 15 +++++++++++++++ application/controllers/UsersController.php | 15 +++++++++++++++ 11 files changed, 158 insertions(+), 6 deletions(-) diff --git a/application/controllers/CommentsController.php b/application/controllers/CommentsController.php index efb1b211..59372386 100644 --- a/application/controllers/CommentsController.php +++ b/application/controllers/CommentsController.php @@ -13,9 +13,11 @@ use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ContinueWith; use Icinga\Module\Icingadb\Widget\ItemList\CommentList; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Filter\QueryString; use ipl\Web\Url; -use ipl\Web\Widget\ActionLink; class CommentsController extends Controller { @@ -185,4 +187,16 @@ class CommentsController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(Comment::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/DowntimesController.php b/application/controllers/DowntimesController.php index 497f90d7..f5d21c3a 100644 --- a/application/controllers/DowntimesController.php +++ b/application/controllers/DowntimesController.php @@ -13,9 +13,12 @@ use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ContinueWith; use Icinga\Module\Icingadb\Widget\DowntimeList; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimesCommandForm; use ipl\Html\HtmlDocument; use ipl\Html\HtmlString; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Filter\QueryString; use ipl\Web\Url; use ipl\Web\Widget\ActionLink; @@ -194,4 +197,16 @@ class DowntimesController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(Downtime::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/HistoryController.php b/application/controllers/HistoryController.php index 4ed3e692..09dffd56 100644 --- a/application/controllers/HistoryController.php +++ b/application/controllers/HistoryController.php @@ -10,7 +10,10 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ItemList\HistoryList; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; use ipl\Sql\Sql; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Url; class HistoryController extends Controller @@ -121,4 +124,16 @@ class HistoryController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(History::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/HostgroupsController.php b/application/controllers/HostgroupsController.php index 3d86b6bc..e016935c 100644 --- a/application/controllers/HostgroupsController.php +++ b/application/controllers/HostgroupsController.php @@ -11,6 +11,9 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ItemList\HostgroupList; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Url; class HostgroupsController extends Controller @@ -96,4 +99,16 @@ class HostgroupsController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(Hostgroupsummary::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/HostsController.php b/application/controllers/HostsController.php index 85c05591..4275c4e4 100644 --- a/application/controllers/HostsController.php +++ b/application/controllers/HostsController.php @@ -18,7 +18,10 @@ use Icinga\Module\Icingadb\Widget\Detail\ObjectsDetail; use Icinga\Module\Icingadb\Widget\HostList; use Icinga\Module\Icingadb\Widget\HostStatusBar; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; use ipl\Stdlib\Filter; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Filter\QueryString; use ipl\Web\Url; @@ -176,6 +179,18 @@ class HostsController extends Controller $this->getDocument()->add($suggestions); } + public function searchEditorAction() + { + $editor = $this->createSearchEditor(Host::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } + public function fetchCommandTargets() { $db = $this->getDb(); diff --git a/application/controllers/NotificationsController.php b/application/controllers/NotificationsController.php index c6b25444..28f62e2a 100644 --- a/application/controllers/NotificationsController.php +++ b/application/controllers/NotificationsController.php @@ -10,7 +10,10 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ItemList\NotificationList; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; use ipl\Sql\Sql; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Url; class NotificationsController extends Controller @@ -102,4 +105,16 @@ class NotificationsController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(NotificationHistory::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/ServicegroupsController.php b/application/controllers/ServicegroupsController.php index 815ad2c2..e01a94ac 100644 --- a/application/controllers/ServicegroupsController.php +++ b/application/controllers/ServicegroupsController.php @@ -11,6 +11,9 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ItemList\ServicegroupList; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Url; class ServicegroupsController extends Controller @@ -95,4 +98,16 @@ class ServicegroupsController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(ServicegroupSummary::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php index a44af97f..188c2891 100644 --- a/application/controllers/ServicesController.php +++ b/application/controllers/ServicesController.php @@ -18,7 +18,10 @@ use Icinga\Module\Icingadb\Widget\Detail\ObjectsDetail; use Icinga\Module\Icingadb\Widget\ServiceList; use Icinga\Module\Icingadb\Widget\ServiceStatusBar; use Icinga\Module\Icingadb\Widget\ShowMore; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; use ipl\Stdlib\Filter; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; use ipl\Web\Filter\QueryString; use ipl\Web\Url; @@ -187,13 +190,13 @@ class ServicesController extends Controller public function searchEditorAction() { - $services = Service::on($this->getDb())->with([ - 'state', - 'host', - 'host.state' + $editor = $this->createSearchEditor(Service::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ]); - $this->getDocument()->add($this->createSearchEditor($services)); + $this->getDocument()->add($editor); $this->setTitle(t('Adjust Filter')); } diff --git a/application/controllers/TacticalController.php b/application/controllers/TacticalController.php index 978be273..0473934a 100644 --- a/application/controllers/TacticalController.php +++ b/application/controllers/TacticalController.php @@ -11,6 +11,9 @@ use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\HostSummaryDonut; use Icinga\Module\Icingadb\Widget\ServiceSummaryDonut; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; class TacticalController extends Controller { @@ -70,4 +73,16 @@ class TacticalController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(ServicestateSummary::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/UsergroupsController.php b/application/controllers/UsergroupsController.php index 03e25c2d..bd88e346 100644 --- a/application/controllers/UsergroupsController.php +++ b/application/controllers/UsergroupsController.php @@ -9,7 +9,10 @@ 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\Module\Icingadb\Widget\ViewModeSwitcher; use Icinga\Security\SecurityException; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; class UsergroupsController extends Controller { @@ -82,4 +85,16 @@ class UsergroupsController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(Usergroup::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } } diff --git a/application/controllers/UsersController.php b/application/controllers/UsersController.php index f49b478e..d2c2a7f1 100644 --- a/application/controllers/UsersController.php +++ b/application/controllers/UsersController.php @@ -9,7 +9,10 @@ use Icinga\Module\Icingadb\Model\User; use Icinga\Module\Icingadb\Web\Control\SearchBar\ObjectSuggestions; use Icinga\Module\Icingadb\Web\Controller; use Icinga\Module\Icingadb\Widget\ItemList\UserList; +use Icinga\Module\Icingadb\Widget\ViewModeSwitcher; use Icinga\Security\SecurityException; +use ipl\Web\Control\LimitControl; +use ipl\Web\Control\SortControl; class UsersController extends Controller { @@ -84,4 +87,16 @@ class UsersController extends Controller $suggestions->forRequest(ServerRequest::fromGlobals()); $this->getDocument()->add($suggestions); } + + public function searchEditorAction() + { + $editor = $this->createSearchEditor(User::on($this->getDb()), [ + LimitControl::DEFAULT_LIMIT_PARAM, + SortControl::DEFAULT_SORT_PARAM, + ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM + ]); + + $this->getDocument()->add($editor); + $this->setTitle(t('Adjust Filter')); + } }