summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-06-03 23:14:32 -0700
committerDaniel DeLeo <dan@opscode.com>2010-06-04 15:02:55 -0700
commit6c7f580e3ffe0d576e9744fb4a573a05a33e10ee (patch)
treecb0ea4b64c8e1dff8e6f0dd31a15e161628016e8
parent455858243b6f1d0515bec302e93c463476ae67c7 (diff)
downloadchef-6c7f580e3ffe0d576e9744fb4a573a05a33e10ee.tar.gz
fix the status page, node list and role list
-rw-r--r--chef-server-webui/app/helpers/status_helper.rb13
-rw-r--r--chef-server-webui/app/views/clients/index.html.haml2
-rw-r--r--chef-server-webui/app/views/nodes/index.html.haml2
-rw-r--r--chef-server-webui/app/views/roles/index.html.haml2
-rw-r--r--chef-server-webui/app/views/roles/show.html.haml7
-rw-r--r--chef-server-webui/app/views/status/index.html.haml17
6 files changed, 23 insertions, 20 deletions
diff --git a/chef-server-webui/app/helpers/status_helper.rb b/chef-server-webui/app/helpers/status_helper.rb
index 2ce9fa6148..d267c39732 100644
--- a/chef-server-webui/app/helpers/status_helper.rb
+++ b/chef-server-webui/app/helpers/status_helper.rb
@@ -18,9 +18,16 @@
require 'chef' / 'node'
module Merb
- module ChefServerWebui
- module StatusHelper
+ module StatusHelper
+ def time_difference_in_hms(unix_time)
+ now = Time.now.to_i
+ difference = now - unix_time.to_i
+ hours = (difference / 3600).to_i
+ difference = difference % 3600
+ minutes = (difference / 60).to_i
+ seconds = (difference % 60)
+ return [hours, minutes, seconds]
end
-
+
end
end
diff --git a/chef-server-webui/app/views/clients/index.html.haml b/chef-server-webui/app/views/clients/index.html.haml
index f216452af1..f577eecc9c 100644
--- a/chef-server-webui/app/views/clients/index.html.haml
+++ b/chef-server-webui/app/views/clients/index.html.haml
@@ -18,4 +18,4 @@
= link_to('Edit', url(:edit_client, client))
|
= link_to('Delete', url(:client, client), :method => "delete", :confirm => "Really delete Role #{client}? there is no undo.")
- - even ? even = false: even = true
+ - even = (not even)
diff --git a/chef-server-webui/app/views/nodes/index.html.haml b/chef-server-webui/app/views/nodes/index.html.haml
index c48b5bef22..021993af59 100644
--- a/chef-server-webui/app/views/nodes/index.html.haml
+++ b/chef-server-webui/app/views/nodes/index.html.haml
@@ -21,5 +21,5 @@
= link_to('Edit', url(:edit_node, node))
|
= link_to('Delete', url(:node, node), :method => "delete", :confirm => "Really delete Node #{node}? There is no undo.")
- - even ? even = false: even = true
+ - even = (not even)
diff --git a/chef-server-webui/app/views/roles/index.html.haml b/chef-server-webui/app/views/roles/index.html.haml
index 742981b8a4..c16c616666 100644
--- a/chef-server-webui/app/views/roles/index.html.haml
+++ b/chef-server-webui/app/views/roles/index.html.haml
@@ -18,4 +18,4 @@
= link_to('Edit', url(:edit_role, role[0]))
|
= link_to('Delete', url(:role, role[0]), :method => "delete", :confirm => "Really delete Role #{role[0]}? there is no undo.")
- - even ? even = false: even = true
+ - even = (not even)
diff --git a/chef-server-webui/app/views/roles/show.html.haml b/chef-server-webui/app/views/roles/show.html.haml
index 62966767c1..e2db161023 100644
--- a/chef-server-webui/app/views/roles/show.html.haml
+++ b/chef-server-webui/app/views/roles/show.html.haml
@@ -20,12 +20,11 @@
%tr
%td{:colspan => 2} This role does not include any roles or recipes.
- else
- -@role.run_list.each_index do |i|
- - type, name, fname = @role.run_list.parse_entry(@role.run_list[i])
+ -@role.run_list.each_with_index do |run_list_item, i|
%tr
%td.position= i
- %td= name
- %td= type
+ %td= run_list_item.name
+ %td= run_list_item.type
.left.accordion
%h3.head= link_to("Recipes", "#")
- full_recipe_list, default_attrs, override_attrs = @role.run_list.expand()
diff --git a/chef-server-webui/app/views/status/index.html.haml b/chef-server-webui/app/views/status/index.html.haml
index 8236181b0a..13f1167eea 100644
--- a/chef-server-webui/app/views/status/index.html.haml
+++ b/chef-server-webui/app/views/status/index.html.haml
@@ -31,9 +31,9 @@
%td= node[1]["uptime"]
- unless node[1]["ohai_time"].nil?
- - current_time = DateTime.now
- - date = DateTime.parse(Time.at(node[1]["ohai_time"]).to_s)
- - hours, minutes, seconds, frac = DateTime.day_fraction_to_time(current_time - date)
+ - current_time = Time.now.to_f
+ - ohai_time = Time.at(node[1]["ohai_time"])
+ - hours, minutes, seconds = time_difference_in_hms(ohai_time)
- hours_text = "#{hours} hour#{hours == 1 ? '' : 's'}"
- minutes_text = "#{minutes} minute#{minutes == 1 ? '' : 's'}"
%td.flash
@@ -57,7 +57,7 @@
%table.table.tooltip
%tr
%td
- = date
+ = ohai_time
%br
- if hours == 0
= "#{minutes_text} ago"
@@ -79,12 +79,9 @@
%tr
%td{:colspan => 2} This node has no roles or recipes applied.
- else
- - rl = Chef::RunList.new
- - rl.reset!(node[1].run_list)
- -rl.each_index do |i|
- - type, name, fname = rl.parse_entry(rl[i])
+ -node[1].run_list.each_with_index do |run_list_item, i|
%tr
%td.position= i
- %td= name
- %td= type
+ %td= run_list_item.name
+ %td= run_list_item.type