Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #94 from djsauble2/radiator_view
Browse files Browse the repository at this point in the history
Radiator View (Status Board)
  • Loading branch information
lifton committed May 9, 2012
2 parents 6d01497 + 48734f7 commit 96f0633
Show file tree
Hide file tree
Showing 13 changed files with 9,725 additions and 30 deletions.
5 changes: 5 additions & 0 deletions app/controllers/radiator_controller.rb
@@ -0,0 +1,5 @@
class RadiatorController < InheritedResources::Base
def index
render :partial => "shared/node_summary", :layout => "radiator"
end
end
15 changes: 15 additions & 0 deletions app/views/layouts/radiator.html.haml
@@ -0,0 +1,15 @@
!!!
%html
%head
- page_title = yield(:page_title)
%title= [ page_title, 'Puppet Node Manager'].compact.join(' - ')
%meta{"http-equiv" => "refresh", :content => "60"}
= stylesheet_link_tag 'reset', 'mixins', 'radiator'
= javascript_include_tag 'jquery-1.7.2', 'radiator'
- add_body_class "#{controller.controller_name}_controller"
- add_body_class "#{controller.controller_name}_#{controller.action_name}_action"
- add_body_class "#{controller.controller_name}_form_action" if %w[new create edit update].include?(controller.action_name)
- add_body_class "no-sidebar" unless @body_classes.include?('with-sidebar')
%body{:class => @body_classes}
= yield
2 changes: 2 additions & 0 deletions app/views/shared/_node_manager_sidebar.html.haml
Expand Up @@ -49,6 +49,8 @@
= link_to "Hidden", hidden_nodes_path

.footer.actionbar
#radiator
= link_to "Radiator View", '/radiator'
- unless SETTINGS.enable_read_only_mode || session['ACCESS_CONTROL_ROLE'] == 'READ_ONLY'
= link_to "Add node", new_node_path, :class => 'button'

Expand Down
33 changes: 33 additions & 0 deletions app/views/shared/_node_summary.html.haml
@@ -0,0 +1,33 @@
%table.node_summary
- Node.possible_derived_statuses.push( 'unreported', 'all' ).each do |status|
- if( status == 'all' )
- status = 'total'
- node_count = Node.unhidden.count
- nodes_path = {:controller => "nodes", :action => "index"}
- action_status = 'index'
- percent = '0'
- else
- node_count = Node.send(status).unhidden.count
- nodes_path = eval("#{status}_nodes_path")
- action_status = status
- percent = percentage(node_count, Node.unhidden.count).to_i

%tr{:class => "#{status} #{active_if(controller_name == 'nodes' && action_name == action_status && parent.nil?)}"}
%td.count_column
%span.count= node_count
%td
%div
%p.label
%span
= status.capitalize
%p.percent{:style => "width: #{percent}%"}
%span
= status.capitalize

- if Node.hidden.count > 0
%table.secondary
%tr{:class => active_if(controller_name == 'nodes' && action_name == 'hidden' && parent.nil?)}
%td.count
= link_to h(Node.hidden.count), hidden_nodes_path
%td.label
= link_to "Hidden", hidden_nodes_path
2 changes: 2 additions & 0 deletions config/routes.rb
Expand Up @@ -40,6 +40,8 @@
map.header '/header.:format', :controller => :pages, :action => :header

map.root :controller => :pages, :action => :home

map.connect 'radiator', :controller => :radiator, :action => :index

map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
Expand Down

0 comments on commit 96f0633

Please sign in to comment.