Paired-With: Matt Robinson <[email protected]>
Signed-off-by: Jesse Wolfe <[email protected]>
---
Local-branch: ticket/next/5174-part2
app/models/report.rb | 3 +++
app/views/nodes/show.html.haml | 35 ++++++++++++++++++++++++++++++++---
spec/models/report_spec.rb | 8 ++++++++
3 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/app/models/report.rb b/app/models/report.rb
index 98f4817..2c38fbb 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -18,6 +18,9 @@ class Report < ActiveRecord::Base
default_scope :order => 'time DESC'
+ named_scope :inspections, :conditions => {:kind => "inspect"}
+ named_scope :applies, :conditions => {:kind => "apply" }
+
def self.find_last_for(node)
self.first(:conditions => {:node_id => node.id}, :order => 'time DESC',
:limit => 1)
end
diff --git a/app/views/nodes/show.html.haml b/app/views/nodes/show.html.haml
index c05ab3b..2a82a1f 100644
--- a/app/views/nodes/show.html.haml
+++ b/app/views/nodes/show.html.haml
@@ -46,7 +46,7 @@
.section
%h3
Recent reports
- %span.count== (#[email protected]})
+ %span.count== (#[email protected]})
- reports_limit = 10
%table.inspector
%thead
@@ -57,20 +57,49 @@
%th Failed
%th Runtime
%tbody
- - @node.reports.limit(reports_limit).each do |report|
+ - @node.reports.applies.limit(reports_limit).each do |report|
%tr
= report_status_td(report)
%td= link_to report.time, report
%td= report.total_resources
%td= report.failed_resources
%td= report.total_time
- - if @node.reports.count > reports_limit
+ - if @node.reports.applies.count > reports_limit
%tfoot
%tr
%td{:colspan => 5}
.actionbar
= link_to "More »", reports_node_path(@node), :class
=> 'button'
+ - if @node.reports.inspections.count > 0
+ .section
+ %h3
+ Recent inspections
+ - if @node.baseline_report
+ = link_to "Baseline: #[email protected]_report.time}",
@node.baseline_report
+ %span.count== (#[email protected]})
+ - reports_limit = 10
+ %table.inspector
+ %thead
+ %tr
+ %th.status
+ %th Reported at
+ %th Total
+ %th Runtime
+ %tbody
+ - @node.reports.inspections.limit(reports_limit).each do |report|
+ %tr
+ = report_status_td(report)
+ %td= link_to report.time, report
+ %td= report.total_resources
+ %td= report.total_time
+ - if @node.reports.inspections.count > reports_limit
+ %tfoot
+ %tr
+ %td{:colspan => 5}
+ .actionbar
+ = link_to "More »", reports_node_path(@node),
:class => 'button'
+
.section
%h3 Dashboard activity
- unless @node.timeline_events.empty?
diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb
index ffd3177..09767e7 100644
--- a/spec/models/report_spec.rb
+++ b/spec/models/report_spec.rb
@@ -240,6 +240,14 @@ HEREDOC
}
end
+ describe ".inspections" do
+ it "should include inspect reports" do
+ @report = generate_report(Time.now, "file", "foo")
+ @report.save!
+ Report.inspections.should == [...@report]
+ end
+ end
+
describe "baseline!" do
before do
@report = generate_report(Time.now, "file", "foo")
--
1.7.0.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.