Changed the "event" part of the page to an expandable tree view so that resource name, file, and line number information is not duplicated.
Paired-with: Jesse Wolfe <[email protected]> Signed-off-by: Paul Berry <[email protected]> --- Local-branch: ticket/next/5785 app/views/reports/_diff.html.haml | 10 ++++---- app/views/reports/_report.html.haml | 38 +++++++++++++++------------------- public/javascripts/application.js | 4 +- public/stylesheets/tables.css | 4 +++ 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/app/views/reports/_diff.html.haml b/app/views/reports/_diff.html.haml index 68faaba..f80a751 100644 --- a/app/views/reports/_diff.html.haml +++ b/app/views/reports/_diff.html.haml @@ -12,10 +12,11 @@ %a{ :href => '#', :class => 'expand-all' } (expand all) - if resource_statuses[:failure].present? %dl#baseline-diff-report - - resource_statuses[:failure].each do |resource| + - resource_statuses[:failure].each_with_index do |resource, index| %dt{:class => cycle( 'odd', 'even' )} - = link_to h(resource), {}, {:class => 'expandable-link collapsed-link'} - %dd.expandable.collapsed + %div.baseline-diff-item + = link_to h(resource), {}, {:class => 'expandable-link collapsed-link', :id => "expand-#{index}"} + %dd.expandable.collapsed{:id => "expandable-#{index}"} %table %tr %th Property @@ -35,5 +36,4 @@ %dl#baseline-diff-report - resource_statuses[:pass].each do |resource| %dt{:class => cycle( 'odd', 'even' )} - %span{:class => 'non-expandable-bullet'} - = h(resource) + %span{:class => 'non-expandable-bullet'}= h(resource) diff --git a/app/views/reports/_report.html.haml b/app/views/reports/_report.html.haml index 2517237..60b9cf8 100644 --- a/app/views/reports/_report.html.haml +++ b/app/views/reports/_report.html.haml @@ -15,33 +15,29 @@ %p= select_tag( "baseline_id", options_from_collection_for_select( Report.baselines, :id, :long_name ) ) + submit_tag("compare") - if report.resource_statuses.present? .section - %h3 Events + %h3 + Events + %a{ :href => '#', :class => 'expand-all' } (expand all) .section - %table.inspector#events - %thead - %tr - %th Name - %th Property - %th Message - %th File - %th Line - %tbody - - report.resource_statuses.sort_by(&:time).each do |status| - - if status.events.empty? + %dl#baseline-diff-report + - report.resource_statuses.sort_by(&:time).each_with_index do |status, index| + %dt{:class => cycle( 'odd', 'even' )} + %div.baseline-diff-item + - 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 - %td= status.name - %td - %td - %td= wrap_on_slashes(status.file) - %td= status.line - - else + %th Property + %th Message - status.events.each do |event| %tr{:class => "status #{event.status}"} - %td= status.name %td= event.property %td= event.message - %td= status.file - %td= status.line .section %h3 Log .section diff --git a/public/javascripts/application.js b/public/javascripts/application.js index f0e6754..feb467b 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -123,7 +123,7 @@ function init_baseline_diff_report() { function toggle_expandable_link() { jQuery(this).toggleClass('collapsed-link'); if (jQuery(this).hasClass('collapsed-link')) { - jQuery(this).parent().next( '.expandable' ) + jQuery(this.id.replace('expand', '#expandable')) .addClass('collapsed'); if (jQuery('.expandable-link').not('.collapsed-link').size() == 0) { var old_text = jQuery('.collapse-all').text(); @@ -133,7 +133,7 @@ function toggle_expandable_link() { .text( old_text.replace( 'collapse', 'expand' )); } } else { - jQuery(this).parent().next( '.expandable' ) + jQuery(this.id.replace('expand', '#expandable')) .removeClass('collapsed'); if (jQuery('.expandable-link.collapsed-link').size() == 0) { var old_text = jQuery('.expand-all').text(); diff --git a/public/stylesheets/tables.css b/public/stylesheets/tables.css index beb4ea2..42c9ba8 100644 --- a/public/stylesheets/tables.css +++ b/public/stylesheets/tables.css @@ -142,6 +142,10 @@ table td.empty { #baseline-diff-report .expandable-link, #baseline-diff-report .non-expandable-bullet { vertical-align: bottom; } +.baseline-diff-item { + display: inline-block; + vertical-align: bottom; +} #baseline-diff-report table th { font-weight : bold; } -- 1.7.2 -- 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.
