@@ -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,27 +227,29 @@ 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
+ ->setBaseFilter (Filter::equal ("child.redundancy_group.id " , $ this ->groupId ))
233
+ ->forRequest ($ this ->getServerRequest ());
229
234
235
+ $ this ->getDocument ()->add ($ suggestions );
236
+ }
237
+
238
+ public function childrenCompleteAction (): void
239
+ {
230
240
$ suggestions = (new ObjectSuggestions ())
231
241
->setModel (DependencyNode::class)
232
- ->setBaseFilter (Filter::equal ("$ column .redundancy_group.id " , $ this ->groupId ))
242
+ ->setBaseFilter (Filter::equal ("parent .redundancy_group.id " , $ this ->groupId ))
233
243
->forRequest ($ this ->getServerRequest ());
234
244
235
245
$ this ->getDocument ()->add ($ suggestions );
236
246
}
237
247
238
248
public function searchEditorAction (): void
239
249
{
240
- $ isChildrenTab = $ this ->params ->shift ('isChildrenTab ' );
241
- $ redirectUrl = $ isChildrenTab
242
- ? Url::fromPath ('icingadb/redundancygroup/children ' , ['id ' => $ this ->groupId ])
243
- : Url::fromPath ('icingadb/redundancygroup/members ' , ['id ' => $ this ->groupId ]);
244
-
245
250
$ editor = $ this ->createSearchEditor (
246
251
DependencyNode::on ($ this ->getDb ()),
247
- $ redirectUrl ,
252
+ Url:: fromPath ( ' icingadb/redundancygroup/members ' , [ ' id ' => $ this -> groupId ]) ,
248
253
[
249
254
LimitControl::DEFAULT_LIMIT_PARAM ,
250
255
SortControl::DEFAULT_SORT_PARAM ,
@@ -253,9 +258,29 @@ public function searchEditorAction(): void
253
258
]
254
259
);
255
260
256
- if ($ isChildrenTab ) {
257
- $ editor ->getSuggestionUrl ()->setParam ('isChildrenTab ' );
258
- }
261
+ $ this ->getDocument ()->add ($ editor );
262
+ $ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
263
+ }
264
+
265
+ public function childrenSearchEditorAction (): void
266
+ {
267
+ $ preserveParams = [
268
+ LimitControl::DEFAULT_LIMIT_PARAM ,
269
+ SortControl::DEFAULT_SORT_PARAM ,
270
+ ViewModeSwitcher::DEFAULT_VIEW_MODE_PARAM ,
271
+ 'id '
272
+ ];
273
+
274
+ $ editor = $ this ->createSearchEditor (
275
+ DependencyNode::on ($ this ->getDb ()),
276
+ Url::fromPath ('icingadb/redundancygroup/children ' , ['id ' => $ this ->groupId ]),
277
+ $ preserveParams
278
+ );
279
+
280
+ $ editor ->setSuggestionUrl (
281
+ Url::fromPath ('icingadb/redundancygroup/children-complete ' )
282
+ ->setParams (Url::fromRequest ()->onlyWith ($ preserveParams )->getParams ())
283
+ );
259
284
260
285
$ this ->getDocument ()->add ($ editor );
261
286
$ this ->setTitle ($ this ->translate ('Adjust Filter ' ));
0 commit comments