@@ -188,19 +188,23 @@ public function childrenAction(): Generator
188
188
189
189
$ viewModeSwitcher = $ this ->createViewModeSwitcher ($ paginationControl , $ limitControl );
190
190
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
+ );
204
208
205
209
if ($ searchBar ->hasBeenSent () && ! $ searchBar ->isValid ()) {
206
210
if ($ searchBar ->hasBeenSubmitted ()) {
@@ -330,33 +334,32 @@ public function historyAction(): Generator
330
334
331
335
public function completeAction (): void
332
336
{
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
+ }
335
344
345
+ public function childrenCompleteAction (): void
346
+ {
336
347
$ suggestions = (new ObjectSuggestions ())
337
348
->setModel (DependencyNode::class)
338
- ->setBaseFilter (Filter::equal ("$ relation .service.id " , $ this ->service ->id ))
349
+ ->setBaseFilter (Filter::equal ("parent .service.id " , $ this ->service ->id ))
339
350
->forRequest ($ this ->getServerRequest ());
340
351
341
352
$ this ->getDocument ()->add ($ suggestions );
342
353
}
343
354
344
355
public function searchEditorAction (): void
345
356
{
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
-
357
357
$ editor = $ this ->createSearchEditor (
358
358
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
+ ),
360
363
[
361
364
LimitControl::DEFAULT_LIMIT_PARAM ,
362
365
SortControl::DEFAULT_SORT_PARAM ,
@@ -366,9 +369,33 @@ public function searchEditorAction(): void
366
369
]
367
370
);
368
371
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
+ );
372
399
373
400
$ this ->getDocument ()->add ($ editor );
374
401
$ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
0 commit comments