Add hook to include custom variables by default when searching under Overview entries#1046
Conversation
|
Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Oscar Zambotti.
|
5c2b7d3 to
334aaf8
Compare
|
Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA). Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA. After that, please reply here with a comment and we'll verify. Contributors that have not signed yet: @oskarnrk Details
|
I signed the ICLA, thanks in advance. |
|
Is it possibile to retrigger the CLA check? Thanks |
|
@cla-bot check |
|
Please, is it possible to check this quite old PR? Thanks 😇 |
|
Hi, the reason why (at least for me) no-one looked at this yet, is that this isn't just a small feature. This has so many other parts which might be affected, that I don't want to introduce a half baked solution. (Besides that a new hook also requires us to cover support for it, which I cannot guarantee at all) |
1adf706 to
fa23e86
Compare
276781c to
02e6fb0
Compare
nilmerg
left a comment
There was a problem hiding this comment.
Since Icinga/ipl-web@91221e2 there's an additional usage of Model::getSearchColumns(). It's intended to provide the same set of columns the searchbar will provide as a default in the same route, but applied in case the user hits enter faster than the default suggestion appears (or rather can be interacted with).
My suggestion to extend this, isolated to Icinga DB Web, is to change \Icinga\Module\Icingadb\Common\SearchControls::createSearchBar to override what the base implementation did. However, for this to work at all, \ipl\Web\Compat\SearchControls::callHandleRequest has be overridden and you have to call $searchBar->handleRequest($this->getServerRequest()).
2b4a8de to
dc69402
Compare
nilmerg
left a comment
There was a problem hiding this comment.
looking fine now, but please rebase and fix the conflicts
dc69402 to
5767c91
Compare
…dated ObjectSuggestions and Controller classes to utilize the new hook for enhanced search functionality
5767c91 to
512c5b6
Compare
…tom variable retrieval and added new SearchColumnProviderHook class
512c5b6 to
6fb5476
Compare
#1046 introduced two problems to the `SearchControls` trait. Returning `false` from `SearchControls::callHandleRequest()` prevents the ipl-web `SearchControls` trait from calling `handleRequest()` in both `createSearchBar()` and `createSearchEditor()`. An implementation of `createSearchEditor()` is added, which explicitly calls `$editor->handleRequest()` as `createSearchBar()` already does. Without this no `SearchEditor` in the entire module is usable. An other problem is that moving the call of `$searchbar->handleRequest()` also delayed its `assemble()`, so this if block was entered before the assemble, resulting in the wrapper being added twice. ``` if (($wrapper = $searchBar->getWrapper()) && ! $wrapper->getWrapper()) { // TODO: Remove this once ipl-web v0.7.0 is required $searchBar->addWrapper(Html::tag('div', ['class' => 'search-controls'])); } ``` which caused a visual bug: <img width="447" height="175" alt="Screenshot from 2026-06-25 11-01-42" src="https://github.com/user-attachments/assets/4e852585-c677-4c70-8f95-631601294de4" /> The statement should be safe to remove together with the less that has the same `TODO`.
The hook can be implemented in multiple ways. For example:
Add to run.php
SearchColumnsProvider.php