@@ -174,19 +174,22 @@ public function childrenAction(): Generator
174
174
);
175
175
$ viewModeSwitcher = $ this ->createViewModeSwitcher ($ paginationControl , $ limitControl );
176
176
177
- $ searchBar = $ this ->createSearchBar (
178
- $ nodesQuery ,
179
- [
180
- $ limitControl ->getLimitParam (),
181
- $ sortControl ->getSortParam (),
182
- $ viewModeSwitcher ->getViewModeParam (),
183
- 'id '
184
- ]
185
- );
186
-
187
- $ searchBar ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
188
- $ searchBar ->getEditorUrl ()
189
- ->setParams ((clone $ searchBar ->getEditorUrl ()->getParams ())->set ('isChildrenTab ' , true ));
177
+ $ preserveParams = [
178
+ $ limitControl ->getLimitParam (),
179
+ $ sortControl ->getSortParam (),
180
+ $ viewModeSwitcher ->getViewModeParam (),
181
+ 'id '
182
+ ];
183
+
184
+ $ requestParams = Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ();
185
+ $ searchBar = $ this ->createSearchBar ($ nodesQuery , $ preserveParams )
186
+ ->setEditorUrl (
187
+ Url::fromPath ('icingadb/redundancygroup/children-search-editor ' )
188
+ ->setParams ($ requestParams )
189
+ )->setSuggestionUrl (
190
+ Url::fromPath ('icingadb/redundancygroup/children-complete ' )
191
+ ->setParams (clone $ requestParams )
192
+ );
190
193
191
194
if ($ searchBar ->hasBeenSent () && ! $ searchBar ->isValid ()) {
192
195
if ($ searchBar ->hasBeenSubmitted ()) {
@@ -224,28 +227,31 @@ public function childrenAction(): Generator
224
227
225
228
public function completeAction (): void
226
229
{
227
- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
228
- $ column = $ isChildrenTab ? 'parent ' : 'child ' ;
230
+ $ suggestions = (new ObjectSuggestions ())
231
+ ->setModel (DependencyNode::class)
232
+ ->onlyWithCustomVarSources (['host ' , 'service ' , 'hostgroup ' , 'servicegroup ' ])
233
+ ->setBaseFilter (Filter::equal ("child.redundancy_group.id " , $ this ->groupId ))
234
+ ->forRequest ($ this ->getServerRequest ());
235
+
236
+ $ this ->getDocument ()->add ($ suggestions );
237
+ }
229
238
239
+ public function childrenCompleteAction (): void
240
+ {
230
241
$ suggestions = (new ObjectSuggestions ())
231
242
->setModel (DependencyNode::class)
232
- ->setBaseFilter (Filter::equal ("$ column.redundancy_group.id " , $ this ->groupId ))
233
243
->onlyWithCustomVarSources (['host ' , 'service ' , 'hostgroup ' , 'servicegroup ' ])
244
+ ->setBaseFilter (Filter::equal ("parent.redundancy_group.id " , $ this ->groupId ))
234
245
->forRequest ($ this ->getServerRequest ());
235
246
236
247
$ this ->getDocument ()->add ($ suggestions );
237
248
}
238
249
239
250
public function searchEditorAction (): void
240
251
{
241
- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
242
- $ redirectUrl = $ isChildrenTab
243
- ? Url::fromPath ('icingadb/redundancygroup/children ' , ['id ' => $ this ->groupId ])
244
- : Url::fromPath ('icingadb/redundancygroup/members ' , ['id ' => $ this ->groupId ]);
245
-
246
252
$ editor = $ this ->createSearchEditor (
247
253
DependencyNode::on ($ this ->getDb ()),
248
- $ redirectUrl ,
254
+ Url:: fromPath ( ' icingadb/redundancygroup/members ' , [ ' id ' => $ this -> groupId ]) ,
249
255
[
250
256
LimitControl::DEFAULT_LIMIT_PARAM ,
251
257
SortControl::DEFAULT_SORT_PARAM ,
@@ -254,9 +260,29 @@ public function searchEditorAction(): void
254
260
]
255
261
);
256
262
257
- if ($ isChildrenTab ) {
258
- $ editor ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
259
- }
263
+ $ this ->getDocument ()->add ($ editor );
264
+ $ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
265
+ }
266
+
267
+ public function childrenSearchEditorAction (): void
268
+ {
269
+ $ preserveParams = [
270
+ LimitControl::DEFAULT_LIMIT_PARAM ,
271
+ SortControl::DEFAULT_SORT_PARAM ,
272
+ ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ,
273
+ 'id '
274
+ ];
275
+
276
+ $ editor = $ this ->createSearchEditor (
277
+ DependencyNode::on ($ this ->getDb ()),
278
+ Url::fromPath ('icingadb/redundancygroup/children ' , ['id ' => $ this ->groupId ]),
279
+ $ preserveParams
280
+ );
281
+
282
+ $ editor ->setSuggestionUrl (
283
+ Url::fromPath ('icingadb/redundancygroup/children-complete ' )
284
+ ->setParams (Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ())
285
+ );
260
286
261
287
$ this ->getDocument ()->add ($ editor );
262
288
$ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
0 commit comments