.group
  %h3 Nodes
  %ul
    %li{:class => active_if(controller_name == 'nodes' && action_name == 'index' && parent.nil?)}
      = link_to "All", nodes_path
      %span.count= Node.count
    %li{:class => active_if(controller_name == 'nodes' && action_name == 'successful' && parent.nil?)}
      = link_to "Successful", successful_nodes_path
      %span.count= Node.successful.count('DISTINCT `nodes`.name')
    %li{:class => active_if(controller_name == 'nodes' && action_name == 'failed' && parent.nil?)}
      = link_to "Failed", failed_nodes_path
      %span.count= Node.failed.count('DISTINCT `nodes`.name')
    %li{:class => active_if(controller_name == 'nodes' && action_name == 'unreported' && parent.nil?)}
      = link_to "Unreported", unreported_nodes_path
      %span.count= Node.unreported.count
.group
  %h3 By Class
  %ul
    - NodeClass.all(:include => :nodes).each do |node_class|
      %li{:class => active_if(controller_name == "nodes" && @node_class && @node_class == node_class)}
        = link_to node_class.name, node_class_nodes_path(node_class)
        %span.count= node_class.nodes.count
.group
  %h3 By Group
  %ul
    - NodeGroup.all(:include => :nodes).each do |node_group|
      %li{:class => active_if(controller_name == "nodes" && @node_group && @node_group == node_group)}
        = link_to node_group.name, node_group_nodes_path(node_group)
        %span.count= node_group.nodes.count
