When viewing an individual report, resources are now grouped by their
status.

Paired-with: Matt Robinson <[email protected]>
Signed-off-by: Max Martin <[email protected]>
---
Local-branch: ticket/master/7544-resource-grouping
 app/views/reports/_resource_statuses.html.haml |   44 +++++++++++++-----------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/app/views/reports/_resource_statuses.html.haml 
b/app/views/reports/_resource_statuses.html.haml
index ee713ed..d55b232 100644
--- a/app/views/reports/_resource_statuses.html.haml
+++ b/app/views/reports/_resource_statuses.html.haml
@@ -1,27 +1,31 @@
 .section
   - if report.resource_statuses.present?
-    %h3
-      Events
-      %a{ :href => '#', :class => 'expand-all' } (expand all)
+    - index = 0
+    %h4
+      %a{ :href => '#', :class => 'expand-all' } Expand all
     .section
       %dl.expandable-list
-        - report.resource_statuses.sort_by(&:time).each_with_index do |status, 
index|
-          %dt{:class => cycle( 'odd', 'even' )}
-            - if status.events.empty?
-              %span{:class => 'non-expandable-bullet'}= status.name
-            - else
-              = link_to h(status.name), {}, {:class => 'expandable-link 
collapsed-link', :id => "expand-#{index}"}
-            - if status.file or status.line
-              = "(#{status.file}:#{status.line})"
-          %dd.expandable.collapsed{:id => "expandable-#{index}"}
-            %table
-              %tr
-                %th Property
-                %th Message
-              - status.events.each do |event|
-                %tr{:class => "status #{event.status}"}
-                  %td= event.property
-                  %td= popup_md5s( h event.message )
+        - report.resource_statuses.group_by(&:status).each do |status, 
resources|
+          %h3 #{status.titleize} (#{resources.count})
+          - resources.sort_by(&:time).each do |status|
+            - index += 1
+            %dt{:class => cycle( 'odd', 'even' )}
+              - if status.events.empty?
+                %span{:class => 'non-expandable-bullet'}= status.name
+              - else
+                = link_to h(status.name), {}, {:class => 'expandable-link 
collapsed-link', :id => "expand-#{index}"}
+              - if status.file or status.line
+                = "(#{status.file}:#{status.line})"
+            %dd.expandable.collapsed{:id => "expandable-#{index}"}
+              %table
+                %tr
+                  %th Property
+                  %th Message
+                - status.events.each do |event|
+                  %tr{:class => "status #{event.status}"}
+                    %td= event.property
+                    %td= popup_md5s( h event.message )
+          %br
   - else
     %h3 Events
     %p= describe_no_matches_for(:events, :report)
-- 
1.7.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to