summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuo Yan <nuoyan@nuo-yans-macbook-pro.(none)>2010-02-26 12:44:07 -0800
committerNuo Yan <nuoyan@nuo-yans-macbook-pro.(none)>2010-02-26 12:44:07 -0800
commit20d016bd3bb1ccfbc65fbbb9e0d62b11db12f86f (patch)
tree476d75c06b60c24f970f543f2041155ca1a3dd68
parent2767695393f7e81ed294731d7b3d86afd268eb83 (diff)
downloadchef-20d016bd3bb1ccfbc65fbbb9e0d62b11db12f86f.tar.gz
fixing CHEF-989, being able to show client in the search result, and also fixing the colspan for all of the views
-rw-r--r--chef-server-webui/app/controllers/search.rb7
-rw-r--r--chef-server-webui/app/helpers/application_helper.rb2
-rw-r--r--chef-server-webui/app/views/clients/index.html.haml5
-rw-r--r--chef-server-webui/app/views/databags/index.html.haml7
-rw-r--r--chef-server-webui/app/views/databags/show.html.haml5
-rw-r--r--chef-server-webui/app/views/roles/index.html.haml6
-rw-r--r--chef-server-webui/app/views/users/index.html.haml22
7 files changed, 29 insertions, 25 deletions
diff --git a/chef-server-webui/app/controllers/search.rb b/chef-server-webui/app/controllers/search.rb
index db45538b75..7965eed2ae 100644
--- a/chef-server-webui/app/controllers/search.rb
+++ b/chef-server-webui/app/controllers/search.rb
@@ -40,7 +40,7 @@ class ChefServerWebui::Search < ChefServerWebui::Application
@s = Chef::Search::Query.new
query = params[:q].nil? ? "*:*" : (params[:q].empty? ? "*:*" : params[:q])
@results = @s.search(params[:id], query)
- @type = if params[:id].to_s == "node" || params[:id].to_s == "role"
+ @type = if params[:id].to_s == "node" || params[:id].to_s == "role" || params[:id].to_s == "client"
params[:id]
else
"databag"
@@ -51,8 +51,9 @@ class ChefServerWebui::Search < ChefServerWebui::Application
end
@results
render
- rescue StandardError => e
- @_message = { :error => "Unable to find the #{params[:id]}. (#{$!})" }
+ rescue => e
+ Chef::Log.error("#{e}\n#{e.backtrace.join("\n")}")
+ @_message = { :error => "Unable to find the #{params[:id]}." }
@search_indexes = @s.list_indexes
render :index
end
diff --git a/chef-server-webui/app/helpers/application_helper.rb b/chef-server-webui/app/helpers/application_helper.rb
index 1fe2f4fe5c..93c0cf4932 100644
--- a/chef-server-webui/app/helpers/application_helper.rb
+++ b/chef-server-webui/app/helpers/application_helper.rb
@@ -134,7 +134,7 @@ module Merb
#for showing search result
def determine_name(type, object)
case type
- when :node, :role
+ when :node, :role, :client
object.name
else
params[:id]
diff --git a/chef-server-webui/app/views/clients/index.html.haml b/chef-server-webui/app/views/clients/index.html.haml
index ba7df0e3bb..6d9c0a742b 100644
--- a/chef-server-webui/app/views/clients/index.html.haml
+++ b/chef-server-webui/app/views/clients/index.html.haml
@@ -7,12 +7,13 @@
.inner
%table.table
%tr
- %th.first Name
+ %th.first{:colspan => 2} Name
+ %th &nbsp;
%th.last &nbsp;
- even = false;
- @clients_list.each do |client|
%tr{ :class => even ? "even" : "odd" }
- %td= link_to(client[0], slice_url(:client, client[0]))
+ %td{:colspan => 2}= link_to(client[0], slice_url(:client, client[0]))
%td
= link_to('Edit', slice_url(:edit_client, client[0]))
|
diff --git a/chef-server-webui/app/views/databags/index.html.haml b/chef-server-webui/app/views/databags/index.html.haml
index ad5f0c5a5c..7e880061ec 100644
--- a/chef-server-webui/app/views/databags/index.html.haml
+++ b/chef-server-webui/app/views/databags/index.html.haml
@@ -7,11 +7,12 @@
.inner
%table.table
%tr
- %th.first Databag Name
- %th.last
+ %th.first{:colspan => 2} Databag Name
+ %th &nbsp;
+ %th.last &nbsp;
- @databags.sort.each_with_index do |databag, index|
%tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"}
- %td= link_to databag[0], slice_url(:databag, { :id => databag[0] })
+ %td{:colspan => 2}= link_to databag[0], slice_url(:databag, { :id => databag[0] })
%td
= link_to('Edit', slice_url(:databag, :id => databag[0]))
|
diff --git a/chef-server-webui/app/views/databags/show.html.haml b/chef-server-webui/app/views/databags/show.html.haml
index 61c574dbb5..abee8c0a15 100644
--- a/chef-server-webui/app/views/databags/show.html.haml
+++ b/chef-server-webui/app/views/databags/show.html.haml
@@ -7,11 +7,12 @@
.inner
%table.table
%tr
- %th.first Databag Items
+ %th.first{:colspan => 2} Databag Items
+ %th &nbsp;
%th.last &nbsp;
- @databag.sort.each_with_index do |databag_item_uri, index|
%tr{:class => "#{index % 2 == 1 ? 'odd' : 'even'}"}
- %td= link_to databag_item_uri[0], slice_url(:databag_databag_item, :id => databag_item_uri[0], :databag_id => @databag_name)
+ %td{:colspan => 2}= link_to databag_item_uri[0], slice_url(:databag_databag_item, :id => databag_item_uri[0], :databag_id => @databag_name)
%td
= link_to('Edit', slice_url(:edit_databag_databag_item, :id => databag_item_uri[0], :databag_id => @databag_name))
|
diff --git a/chef-server-webui/app/views/roles/index.html.haml b/chef-server-webui/app/views/roles/index.html.haml
index ed1677bf06..ee38369d8e 100644
--- a/chef-server-webui/app/views/roles/index.html.haml
+++ b/chef-server-webui/app/views/roles/index.html.haml
@@ -7,13 +7,13 @@
.inner
%table.table
%tr
- %th.first Name
- %th
+ %th.first{:colspan => 2} Name
+ %th &nbsp;
%th.last &nbsp;
- even = false;
- @role_list.each do |role|
%tr{ :class => even ? "even" : "odd" }
- %td= link_to(role[0], slice_url(:role, role[0]))
+ %td{:colspan => 2}= link_to(role[0], slice_url(:role, role[0]))
%td
= link_to('Edit', slice_url(:edit_role, role[0]))
|
diff --git a/chef-server-webui/app/views/users/index.html.haml b/chef-server-webui/app/views/users/index.html.haml
index 532b583d10..69db307d23 100644
--- a/chef-server-webui/app/views/users/index.html.haml
+++ b/chef-server-webui/app/views/users/index.html.haml
@@ -7,14 +7,14 @@
.inner
%table.table
%tr
- %th.first User Name
- %th.last
- - even = false
- - @users.sort.each do |user, user_url|
- %tr{:class => even ? "even": "odd" }
- %td= link_to user, slice_url(:users_show, :user_id => user)
- %td
- = link_to('Edit', slice_url(:users_edit, :user_id => user))
- |
- = link_to('Delete', slice_url(:users_delete, :user_id => user), :method => "delete", :confirm => "Really delete User #{user}? There is no undo.")
- \ No newline at end of file
+ %th.first{:colspan => 2} Username
+ %th &nbsp;
+ %th.last &nbsp;
+ - even = false
+ - @users.sort.each do |user, user_url|
+ %tr{:class => even ? "even": "odd" }
+ %td{:colspan => 2}= link_to user, slice_url(:users_show, :user_id => user)
+ %td
+ = link_to('Edit', slice_url(:users_edit, :user_id => user))
+ |
+ = link_to('Delete', slice_url(:users_delete, :user_id => user), :method => "delete", :confirm => "Really delete User #{user}? There is no undo.")