Search in custom columns

hi all,

its possible to search in custom columns like below “informations”:

thank you all

We are using scoped_search to populate the searchable data for columns, e.g: foreman/search.rb at d767911c30db4c5cb2c3d5d3c6c25385329a6e35 · theforeman/foreman · GitHub

I am not very strong with rails, but maybe there’s a way to extend it,
by the way, how did you create that custom column?

1 Like

Hi, so first of all, it’s important for us to understand, how you actually added the new column. Was that some plugin? Do you have that plugin source code under control? What does the informations display, is it based on some data in database? Is that a simple text column?

As Ron said, a new scoped search definition can be added in the source code. You need to extend the Host::Managed class with scoped_search :on => :informations, that would be the simplest version. It may differ based on the answers to the questions above.

1 Like

thanks for your answer @Ron_Lavi I’ll check that and give my feedback here

same here :smiley:

here is the way:

> :/etc/foreman/plugins# cat foreman_column_view.yaml
> :column_view:
>   :informations:
>     :title: informations
>     :after: last_report
>     :content: facts_hash['my_test_custom_fact']
>     :width: 30%

dont foreget to restart foreman service.

thank you @Marek_Hulan this is the way which I create the column:

I show value of custom facts.

I’ll check this

@Marek_Hulan where can I find the class: Host::Managed in the file above search.rb I cannot finde Host::Managed class thanks

You can either add such definition here or here where we already have most search definitions.