@@ -188,19 +188,23 @@ public function childrenAction(): Generator
188188
189189 $ viewModeSwitcher = $ this ->createViewModeSwitcher ($ paginationControl , $ limitControl );
190190
191- $ searchBar = $ this ->createSearchBar (
192- $ nodesQuery ,
193- [
194- $ limitControl ->getLimitParam (),
195- $ sortControl ->getSortParam (),
196- $ viewModeSwitcher ->getViewModeParam (),
197- 'name ' ,
198- 'host.name '
199- ]
200- );
201-
202- $ searchBar ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
203- $ searchBar ->getEditorUrl ()->setParam ('isChildrenTab ' );
191+ $ preserveParams = [
192+ $ limitControl ->getLimitParam (),
193+ $ sortControl ->getSortParam (),
194+ $ viewModeSwitcher ->getViewModeParam (),
195+ 'name ' ,
196+ 'host.name '
197+ ];
198+
199+ $ requestParams = Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ();
200+ $ searchBar = $ this ->createSearchBar ($ nodesQuery , $ preserveParams )
201+ ->setEditorUrl (
202+ Url::fromPath ('icingadb/service/children-search-editor ' )
203+ ->setParams ($ requestParams )
204+ )->setSuggestionUrl (
205+ Url::fromPath ('icingadb/service/children-complete ' )
206+ ->setParams (clone $ requestParams )
207+ );
204208
205209 if ($ searchBar ->hasBeenSent () && ! $ searchBar ->isValid ()) {
206210 if ($ searchBar ->hasBeenSubmitted ()) {
@@ -330,33 +334,32 @@ public function historyAction(): Generator
330334
331335 public function completeAction (): void
332336 {
333- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
334- $ relation = $ isChildrenTab ? 'parent ' : 'child ' ;
337+ $ suggestions = (new ObjectSuggestions ())
338+ ->setModel (DependencyNode::class)
339+ ->setBaseFilter (Filter::equal ("child.service.id " , $ this ->service ->id ))
340+ ->forRequest ($ this ->getServerRequest ());
341+
342+ $ this ->getDocument ()->add ($ suggestions );
343+ }
335344
345+ public function childrenCompleteAction (): void
346+ {
336347 $ suggestions = (new ObjectSuggestions ())
337348 ->setModel (DependencyNode::class)
338- ->setBaseFilter (Filter::equal ("$ relation .service.id " , $ this ->service ->id ))
349+ ->setBaseFilter (Filter::equal ("parent .service.id " , $ this ->service ->id ))
339350 ->forRequest ($ this ->getServerRequest ());
340351
341352 $ this ->getDocument ()->add ($ suggestions );
342353 }
343354
344355 public function searchEditorAction (): void
345356 {
346- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
347- $ redirectUrl = $ isChildrenTab
348- ? Url::fromPath (
349- 'icingadb/service/children ' ,
350- ['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
351- )
352- : Url::fromPath (
353- 'icingadb/service/parents ' ,
354- ['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
355- );
356-
357357 $ editor = $ this ->createSearchEditor (
358358 DependencyNode::on ($ this ->getDb ()),
359- $ redirectUrl ,
359+ Url::fromPath (
360+ 'icingadb/service/parents ' ,
361+ ['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
362+ ),
360363 [
361364 LimitControl::DEFAULT_LIMIT_PARAM ,
362365 SortControl::DEFAULT_SORT_PARAM ,
@@ -366,9 +369,33 @@ public function searchEditorAction(): void
366369 ]
367370 );
368371
369- if ($ isChildrenTab ) {
370- $ editor ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
371- }
372+ $ this ->getDocument ()->add ($ editor );
373+ $ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
374+ }
375+
376+ public function childrenSearchEditorAction (): void
377+ {
378+ $ preserveParams = [
379+ LimitControl::DEFAULT_LIMIT_PARAM ,
380+ SortControl::DEFAULT_SORT_PARAM ,
381+ ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ,
382+ 'name ' ,
383+ 'host.name '
384+ ];
385+
386+ $ editor = $ this ->createSearchEditor (
387+ DependencyNode::on ($ this ->getDb ()),
388+ Url::fromPath (
389+ 'icingadb/service/children ' ,
390+ ['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
391+ ),
392+ $ preserveParams
393+ );
394+
395+ $ editor ->setSuggestionUrl (
396+ Url::fromPath ('icingadb/service/children-complete ' )
397+ ->setParams (Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ())
398+ );
372399
373400 $ this ->getDocument ()->add ($ editor );
374401 $ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
0 commit comments