@@ -194,19 +194,23 @@ public function childrenAction(): Generator
194
194
195
195
$ viewModeSwitcher = $ this ->createViewModeSwitcher ($ paginationControl , $ limitControl );
196
196
197
- $ searchBar = $ this ->createSearchBar (
198
- $ nodesQuery ,
199
- [
200
- $ limitControl ->getLimitParam (),
201
- $ sortControl ->getSortParam (),
202
- $ viewModeSwitcher ->getViewModeParam (),
203
- 'name ' ,
204
- 'host.name '
205
- ]
206
- );
207
-
208
- $ searchBar ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
209
- $ searchBar ->getEditorUrl ()->setParam ('isChildrenTab ' );
197
+ $ preserveParams = [
198
+ $ limitControl ->getLimitParam (),
199
+ $ sortControl ->getSortParam (),
200
+ $ viewModeSwitcher ->getViewModeParam (),
201
+ 'name ' ,
202
+ 'host.name '
203
+ ];
204
+
205
+ $ requestParams = Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ();
206
+ $ searchBar = $ this ->createSearchBar ($ nodesQuery , $ preserveParams )
207
+ ->setEditorUrl (
208
+ Url::fromPath ('icingadb/service/children-search-editor ' )
209
+ ->setParams ($ requestParams )
210
+ )->setSuggestionUrl (
211
+ Url::fromPath ('icingadb/service/children-complete ' )
212
+ ->setParams ($ requestParams )
213
+ );
210
214
211
215
if ($ searchBar ->hasBeenSent () && ! $ searchBar ->isValid ()) {
212
216
if ($ searchBar ->hasBeenSubmitted ()) {
@@ -336,45 +340,70 @@ public function historyAction(): Generator
336
340
337
341
public function completeAction (): void
338
342
{
339
- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
340
- $ relation = $ isChildrenTab ? 'parent ' : 'child ' ;
343
+ $ suggestions = (new ObjectSuggestions ())
344
+ ->setModel (DependencyNode::class)
345
+ ->setBaseFilter (Filter::equal ("child.service.id " , $ this ->service ->id ))
346
+ ->forRequest ($ this ->getServerRequest ());
341
347
348
+ $ this ->getDocument ()->add ($ suggestions );
349
+ }
350
+
351
+ public function childrenCompleteAction (): void
352
+ {
342
353
$ suggestions = (new ObjectSuggestions ())
343
354
->setModel (DependencyNode::class)
344
- ->setBaseFilter (Filter::equal ("$ relation .service.id " , $ this ->service ->id ))
355
+ ->setBaseFilter (Filter::equal ("parent .service.id " , $ this ->service ->id ))
345
356
->forRequest ($ this ->getServerRequest ());
346
357
347
358
$ this ->getDocument ()->add ($ suggestions );
348
359
}
349
360
350
361
public function searchEditorAction (): void
351
362
{
352
- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
353
- $ redirectUrl = $ isChildrenTab
354
- ? Url::fromPath (
355
- 'icingadb/service/children ' ,
356
- ['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
357
- )
358
- : Url::fromPath (
363
+ $ preserveParams = [
364
+ LimitControl::DEFAULT_LIMIT_PARAM ,
365
+ SortControl::DEFAULT_SORT_PARAM ,
366
+ ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ,
367
+ 'name ' ,
368
+ 'host.name '
369
+ ];
370
+
371
+ $ editor = $ this ->createSearchEditor (
372
+ DependencyNode::on ($ this ->getDb ()),
373
+ Url::fromPath (
359
374
'icingadb/service/parents ' ,
360
375
['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
361
- );
376
+ ),
377
+ $ preserveParams
378
+ );
379
+
380
+ $ this ->getDocument ()->add ($ editor );
381
+ $ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
382
+ }
383
+
384
+ public function childrenSearchEditorAction (): void
385
+ {
386
+ $ preserveParams = [
387
+ LimitControl::DEFAULT_LIMIT_PARAM ,
388
+ SortControl::DEFAULT_SORT_PARAM ,
389
+ ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ,
390
+ 'name ' ,
391
+ 'host.name '
392
+ ];
362
393
363
394
$ editor = $ this ->createSearchEditor (
364
395
DependencyNode::on ($ this ->getDb ()),
365
- $ redirectUrl ,
366
- [
367
- LimitControl::DEFAULT_LIMIT_PARAM ,
368
- SortControl::DEFAULT_SORT_PARAM ,
369
- ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ,
370
- 'name ' ,
371
- 'host.name '
372
- ]
396
+ Url::fromPath (
397
+ 'icingadb/service/children ' ,
398
+ ['name ' => $ this ->service ->name , 'host.name ' => $ this ->service ->host ->name ]
399
+ ),
400
+ $ preserveParams
373
401
);
374
402
375
- if ($ isChildrenTab ) {
376
- $ editor ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
377
- }
403
+ $ editor ->setSuggestionUrl (
404
+ Url::fromPath ('icingadb/service/children-complete ' )
405
+ ->setParams (Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ())
406
+ );
378
407
379
408
$ this ->getDocument ()->add ($ editor );
380
409
$ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
0 commit comments