Feature #259
Ability to search Hosts by Parameters
| Status: | Closed | Start: | 03/10/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | 03/10/2011 | |
| Assigned to: | % Done: | 100% |
||
| Category: | Web Interface | |||
| Target version: | 0.3 | |||
| Backlog: | No | Difficulity: | ||
| Votes: | 0 |
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
| related to Foreman - Refactor #250: Remove activescaffold from the domain parameters page | Closed | 05/13/2010 | ||
| follows Foreman - Feature #248: Generalise the searchbar and tabs to support multiple controllers | Closed | 05/13/2010 | ||
| follows Foreman - Feature #719: Add new search functionaily | Closed | 03/09/2011 |
Associated revisions
Revision e77b99e0267e9c459e9fca7bbc74105b0ba43840
fixes #259 - Ability to search Hosts by Parameters
History
Updated by Bash Shell over 1 year 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?
Updated by Ohad Levy over 1 year 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).
Updated by Ohad Levy over 1 year ago
- Category set to Web Interface
- Target version set to 0.1-6
Updated by Paul Kelly over 1 year ago
- Status changed from New to Pending
- Assigned to 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.
Updated by Paul Kelly over 1 year 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.
Updated by Paul Kelly about 1 year ago
- Branch changed from feature/259-search-hosts-by-parameters to feature/259-search-hosts-by-parameters-2
- Backlog set to No
rebased and tested
Note the branch name change
Updated by Ohad Levy about 1 year 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.
Updated by Ohad Levy about 1 year ago
paul, any chance you can rebase this one? if not, please unassign the target version
Updated by Paul Kelly about 1 year 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.
Updated by Ohad Levy 10 months ago
- Status changed from Pending to Ready For Testing
- % Done changed from 0 to 100
Applied in changeset e77b99e0267e9c459e9fca7bbc74105b0ba43840.
