Project

General

Profile

Actions

Feature #259

closed

Ability to search Hosts by Parameters

Added by Bash Shell over 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

It would be useful to add a Search by Parameter field to the search bar

Adding these two lines in _searchbar.erb seems to do it:

diff --git a/app/views/common/_searchbar.erb b/app/views/common/_searchbar.erb
index 91abe8b..c9adc52 100644
--- a/app/views/common/_searchbar.erb
+++ b/app/views/common/_searchbar.erb
@@ -20,6 +20,8 @@
           </span>
           <%= f.label :hostgroup, "Role" %>
           <%= f.collection_select :hostgroup_id_eq, Hostgroup.all, :id, :name, :include_blank => true %>
+          <%= f.label :parameter, "Parameter" %>
+          <%= f.text_field :host_parameters_name_like, :size => 10 %>
           <%= render :partial => 'common/fact_selected' %>
           <%= f.submit "Go" %> Save as tab: <%= text_field_tag :tab_name, "" %>
         <% end %>

This is useful as assigning parameters to individual hosts creates "drift" and there should be a way to search for such Parameters.


Related issues 3 (0 open3 closed)

Related to Foreman - Refactor #250: Remove activescaffold from the domain parameters pageClosedPaul Kelly05/13/2010Actions
Follows Foreman - Feature #248: Generalise the searchbar and tabs to support multiple controllersClosedPaul Kelly05/13/2010Actions
Follows Foreman - Feature #719: Add new search functionailyClosedAmos Benari03/09/2011Actions
Actions #1

Updated by Bash Shell over 14 years ago

Or this:

diff --git a/app/views/common/_searchbar.erb b/app/views/common/_searchbar.erb
index 91abe8b..2534123 100644
--- a/app/views/common/_searchbar.erb
+++ b/app/views/common/_searchbar.erb
@@ -20,6 +20,8 @@
           </span>
           <%= f.label :hostgroup, "Role" %>
           <%= f.collection_select :hostgroup_id_eq, Hostgroup.all, :id, :name, :include_blank => true %>
+          <%= f.label :parameter, "Parameter" %>
+          <%= f.collection_select :host_parameters_name_like, Parameter.find(:all, :select => "DISTINCT name", :order => "name", :conditions => ['type="HostParameter"']), :name, :name, :include_blank => true %>
           <%= render :partial => 'common/fact_selected' %>
           <%= f.submit "Go" %> Save as tab: <%= text_field_tag :tab_name, "" %>
         <% end %>

This works too, but how can I improve?

Actions #2

Updated by Ohad Levy over 14 years ago

@Paul, do you want to generalize your domain parameters to any type of parameters?
as we are limited with screen size (but have many options for searching) maybe we need to break down more search options, like two select drop boxes (like with facts).

Actions #3

Updated by Ohad Levy over 14 years ago

  • Category set to Web Interface
  • Target version set to 0.1-6
Actions #4

Updated by Paul Kelly about 14 years ago

  • Status changed from New to Pending
  • Assignee set to Paul Kelly
  • Branch set to feature/259-search-hosts-by-parameters

Wow have I had some problems with this one! I have generalized the GUI components that show habtm relationships, such as facts, so that they can be added simply to search lines but there is a real problem with the host_parameters single-line selector.
There appears to be a bug in searchlogic, even in v2.4.26, where
Host.search("host_parameters_name_eq"=>"hostmode", "host_parameters_value_eq"=>"development").all.count
produces an SQL error. Just try it in the console. Ohad, maybe you can see something wrong with the declaration of the associations? I have posted a error report on the searchlogic site and am awaiting a reply.

Actions #5

Updated by Paul Kelly about 14 years ago

  • Status changed from Pending to Ready For Testing

The solution provided uses a workaround that ensures that a parameter based search is not combined with other searches from the search line as this leads to SQL errors. This may or may not be acceptable Ohad, you will have to decide.

Actions #6

Updated by Ohad Levy about 14 years ago

Paul, can you please rebase again ?

Actions #7

Updated by Paul Kelly about 14 years ago

  • Branch changed from feature/259-search-hosts-by-parameters to feature/259-search-hosts-by-parameters-2

rebased and tested
Note the branch name change

Actions #8

Updated by Ohad Levy about 14 years ago

  • Target version changed from 0.1-6 to 0.2

while the patch does a pertty good job, I wont feel we should merge it just yet, pushing to the next version.

Actions #9

Updated by Ohad Levy almost 14 years ago

paul, any chance you can rebase this one? if not, please unassign the target version

Actions #10

Updated by Paul Kelly almost 14 years ago

  • Status changed from Ready For Testing to Pending
  • Target version deleted (0.2)

Rebasing this one is a nightmare. It will rewrite it sometime.

Actions #11

Updated by Ohad Levy over 13 years ago

  • Status changed from Pending to Ready For Testing
  • % Done changed from 0 to 100
Actions #12

Updated by Ohad Levy over 13 years ago

  • Assignee changed from Paul Kelly to Amos Benari
  • Target version set to 0.3
Actions #13

Updated by Ohad Levy over 13 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF