From c31096f025b14201e759fb5c96ad6e5b67e33b97 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Tue, 15 Oct 2024 14:29:41 +0200 Subject: [PATCH] (Host/Service)groupController: Don't overwrite the (SearchBar/SearchEditor) suggestionUrl SuggestionUrl now uses the preserveParams as default params require: https://github.com/Icinga/ipl-web/pull/233 --- application/controllers/HostgroupController.php | 14 +++++--------- application/controllers/ServicegroupController.php | 10 +--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/application/controllers/HostgroupController.php b/application/controllers/HostgroupController.php index e48adca20..3bbaa5fd9 100644 --- a/application/controllers/HostgroupController.php +++ b/application/controllers/HostgroupController.php @@ -18,7 +18,6 @@ use ipl\Stdlib\Filter; use ipl\Web\Control\LimitControl; use ipl\Web\Control\SortControl; -use ipl\Web\Url; class HostgroupController extends Controller { @@ -84,14 +83,7 @@ public function indexAction(): Generator $sortControl->getSortParam(), $viewModeSwitcher->getViewModeParam(), 'name' - ])->setSuggestionUrl(Url::fromPath( - 'icingadb/hostgroup/complete', - [ - 'name' => $this->hostgroupName, - '_disableLayout' => true, - 'showCompact' => true - ] - )); + ]); if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { if ($searchBar->hasBeenSubmitted()) { @@ -156,6 +148,10 @@ public function searchEditorAction(): void 'name' ]); + if ($editor->getSuggestionUrl()) { + $editor->getSuggestionUrl()->addParams(['name' => $this->hostgroupName]); + } + $this->getDocument()->add($editor); $this->setTitle(t('Adjust Filter')); } diff --git a/application/controllers/ServicegroupController.php b/application/controllers/ServicegroupController.php index c3dea15bc..f4fce5fd2 100644 --- a/application/controllers/ServicegroupController.php +++ b/application/controllers/ServicegroupController.php @@ -18,7 +18,6 @@ use ipl\Stdlib\Filter; use ipl\Web\Control\LimitControl; use ipl\Web\Control\SortControl; -use ipl\Web\Url; class ServicegroupController extends Controller { @@ -92,14 +91,7 @@ public function indexAction(): Generator $sortControl->getSortParam(), $viewModeSwitcher->getViewModeParam(), 'name' - ])->setSuggestionUrl(Url::fromPath( - 'icingadb/servicegroup/complete', - [ - 'name' => $this->servicegroupName, - '_disableLayout' => true, - 'showCompact' => true - ] - )); + ]); if ($searchBar->hasBeenSent() && ! $searchBar->isValid()) { if ($searchBar->hasBeenSubmitted()) {