The logic for marking inspect reports with an appropriate icon is now in a callback method that plugs into :report :status_icon, rather than being hardcoded in the _report_status_icon partial. This paves the way for additional future modularity in choosing report icons.
Paired-with: Nick Lewis <[email protected]> Signed-off-by: Paul Berry <[email protected]> --- Local-branch: maint/next/refactor_report_icon app/views/reports/_report_status_icon.html.haml | 2 +- lib/core_callbacks.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/app/views/reports/_report_status_icon.html.haml b/app/views/reports/_report_status_icon.html.haml index 47702a3..6be4452 100644 --- a/app/views/reports/_report_status_icon.html.haml +++ b/app/views/reports/_report_status_icon.html.haml @@ -1,5 +1,5 @@ %span{:title => report ? report_title_text(report) : 'No reports'} - if report - = icon(Registry.find_first_callback(:report, :status_icon) { |thing| thing.call(report) } || (report.kind == "inspect" ? :inspect : report.status)) + = icon(Registry.find_first_callback(:report, :status_icon) { |thing| thing.call(report) } || report.status) - else = icon(:error) diff --git a/lib/core_callbacks.rb b/lib/core_callbacks.rb index a575af1..20f5b67 100644 --- a/lib/core_callbacks.rb +++ b/lib/core_callbacks.rb @@ -35,3 +35,10 @@ end Registry.add_callback :core, :report_view_widgets, "800_metrics" do |view_renderer, report| view_renderer.render 'reports/metrics', :report => report end + +# Report status icon +Registry.add_callback :report, :status_icon, "750_inspect_report" do |report| + if report.kind == "inspect" + :inspect + end +end -- 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.
