Permalink
Browse files

Merge branch 'next'

* next: (29 commits)
  (#6090) Improved auto-selection of "specific baseline".
  (#6072) Moved baseline inspection link underneath "Recent Inspections"
  (#6095) Render proper error messages when diffing against a baseline that can't be found
  (#6069) Fixed unique ids in the report group diff view.
  maint: Use new factory_girl syntax to improve a test
  maint: Refresh the vendored gem specifications
  maint: replace object_daddy with factory_girl
  maint: Fix a case where the alphabetically first baselines may not appear
  Maint: Moved colorbox.css and image files to be compatible with production environment
  (#5869) Extract baseline selector into a partial
  (#5869) Add new baseline selector to the node group page
  (#5869) Rework the baseline selector for report show page
  (#5869) Add a /reports/baselines action to retrieve baselines
  maint: add a view test to motivate reverting diff expand_all
  maint: Added combobox widget, to replace autocomplete plugin
  maint: upgraded jquery-ui to 1.8.9
  Maint: Add JQuery UI animation to expand/collapse widgets.
  (#6024) Show filebucket popup on diff screen, too
  (#6024) Click md5s to popup file bucket contents on reports
  maint: Privatize string helper
  ...
  • Loading branch information...
2 parents d41f85d + 259ea77 commit 875f5a4169d5c09ded3154d047c7e768dd7fa44f Matt Robinson committed Feb 3, 2011
Showing with 6,171 additions and 2,322 deletions.
  1. +1 −0 app/controllers/application_controller.rb
  2. +22 −6 app/controllers/files_controller.rb
  3. +31 −18 app/controllers/node_groups_controller.rb
  4. +48 −27 app/controllers/reports_controller.rb
  5. +5 −0 app/helpers/application_helper.rb
  6. +9 −0 app/helpers/reports_helper.rb
  7. +6 −0 app/helpers/string_helper.rb
  8. +1 −1 app/models/report.rb
  9. +7 −12 app/models/resource_status.rb
  10. +2 −2 app/views/layouts/application.html.haml
  11. +29 −22 app/views/node_groups/diff.html.haml
  12. +2 −2 app/views/node_groups/show.html.haml
  13. +4 −2 app/views/nodes/show.html.haml
  14. +13 −0 app/views/reports/_baseline_selector.html.haml
  15. +10 −6 app/views/reports/_diff.html.haml
  16. +20 −26 app/views/reports/_report.html.haml
  17. +15 −6 app/views/reports/diff.html.haml
  18. +28 −35 app/views/reports/search.html.haml
  19. +1 −0 config/routes.rb
  20. +8 −4 public/javascripts/application.js
  21. +14 −0 public/javascripts/baseline_selector.js
  22. +374 −99 public/javascripts/jquery-ui.min.js
  23. +788 −0 public/javascripts/jquery.colorbox.js
  24. +0 −46 public/javascripts/jquery.ui.autocomplete.ext.js
  25. +0 −231 public/javascripts/jquery.ui.autocomplete.js
  26. +98 −0 public/javascripts/jquery.ui.combobox.js
  27. +2 −2 public/stylesheets/application.css
  28. +62 −0 public/stylesheets/colorbox.css
  29. BIN public/stylesheets/images/border.png
  30. BIN public/stylesheets/images/controls.png
  31. BIN public/stylesheets/images/internet_explorer/borderBottomCenter.png
  32. BIN public/stylesheets/images/internet_explorer/borderBottomLeft.png
  33. BIN public/stylesheets/images/internet_explorer/borderBottomRight.png
  34. BIN public/stylesheets/images/internet_explorer/borderMiddleLeft.png
  35. BIN public/stylesheets/images/internet_explorer/borderMiddleRight.png
  36. BIN public/stylesheets/images/internet_explorer/borderTopCenter.png
  37. BIN public/stylesheets/images/internet_explorer/borderTopLeft.png
  38. BIN public/stylesheets/images/internet_explorer/borderTopRight.png
  39. BIN public/stylesheets/images/loading.gif
  40. BIN public/stylesheets/images/loading_background.png
  41. BIN public/stylesheets/images/overlay.png
  42. BIN public/stylesheets/images/ui-bg_flat_0_aaaaaa_40x100.png
  43. BIN public/stylesheets/images/ui-bg_flat_0_eeeeee_40x100.png
  44. BIN public/stylesheets/images/ui-bg_flat_100_5c80a8_40x100.png
  45. BIN public/stylesheets/images/ui-bg_flat_55_ffffff_40x100.png
  46. BIN public/stylesheets/images/ui-bg_flat_65_ffffff_40x100.png
  47. BIN public/stylesheets/images/ui-bg_flat_75_ffffff_40x100.png
  48. BIN public/stylesheets/images/ui-bg_glass_65_ffffff_1x400.png
  49. BIN public/stylesheets/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png
  50. BIN public/stylesheets/images/ui-bg_highlight-soft_25_0073ea_1x100.png
  51. BIN public/stylesheets/images/ui-bg_highlight-soft_50_dddddd_1x100.png
  52. BIN public/stylesheets/images/ui-icons_0073ea_256x240.png
  53. BIN public/stylesheets/images/ui-icons_454545_256x240.png
  54. BIN public/stylesheets/images/ui-icons_666666_256x240.png
  55. BIN public/stylesheets/images/ui-icons_ff0084_256x240.png
  56. BIN public/stylesheets/images/ui-icons_ffffff_256x240.png
  57. +0 −22 public/stylesheets/jquery.ui.autocomplete.css
  58. +3 −0 public/stylesheets/jquery.ui.combobox.css
  59. +414 −0 public/stylesheets/jquery.ui.custom.css
  60. +17 −17 public/stylesheets/sass/application.scss
  61. +4 −0 public/stylesheets/tables.css
  62. +38 −3 spec/controllers/files_controller_spec.rb
  63. +94 −8 spec/controllers/node_groups_controller_spec.rb
  64. +110 −55 spec/controllers/reports_controller_spec.rb
  65. 0 spec/exemplars/.gitignore
  66. +0 −2 spec/exemplars/edge_exemplar.rb
  67. +0 −3 spec/exemplars/node_class_exemplar.rb
  68. +0 −3 spec/exemplars/node_exemplar.rb
  69. +0 −3 spec/exemplars/node_group_exemplar.rb
  70. +0 −4 spec/exemplars/parameter_exemplar.rb
  71. +0 −6 spec/exemplars/report_exemplar.rb
  72. +0 −3 spec/exemplars/service_exemplar.rb
  73. +53 −0 spec/factories.rb
  74. +25 −0 spec/helpers/string_helper_spec.rb
  75. +0 −6 spec/models/resource_status_spec.rb
  76. +3 −0 spec/spec_helper.rb
  77. +44 −0 spec/views/node_groups/diff.html.haml_spec.rb
  78. +69 −0 vendor/gems/factory_girl-1.3.3/.specification
  79. +9 −0 vendor/gems/factory_girl-1.3.3/CONTRIBUTION_GUIDELINES.rdoc
  80. +29 −0 vendor/gems/factory_girl-1.3.3/Changelog
  81. +19 −0 vendor/gems/factory_girl-1.3.3/LICENSE
  82. +274 −0 vendor/gems/factory_girl-1.3.3/README.rdoc
  83. +69 −0 vendor/gems/factory_girl-1.3.3/Rakefile
  84. +125 −0 vendor/gems/factory_girl-1.3.3/features/factory_girl_steps.feature
  85. +18 −0 vendor/gems/factory_girl-1.3.3/features/step_definitions/database_steps.rb
  86. +15 −0 vendor/gems/factory_girl-1.3.3/features/support/env.rb
  87. +62 −0 vendor/gems/factory_girl-1.3.3/features/support/factories.rb
  88. BIN vendor/gems/factory_girl-1.3.3/features/support/test.db
  89. +30 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl.rb
  90. +50 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/aliases.rb
  91. +29 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/attribute.rb
  92. +20 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/attribute/association.rb
  93. +16 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/attribute/callback.rb
  94. +20 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/attribute/dynamic.rb
  95. +17 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/attribute/static.rb
  96. +412 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/factory.rb
  97. +79 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/proxy.rb
  98. +21 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/proxy/attributes_for.rb
  99. +30 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/proxy/build.rb
  100. +12 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/proxy/create.rb
  101. +58 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/proxy/stub.rb
  102. +1 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/rails2.rb
  103. +63 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/sequence.rb
  104. +53 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/step_definitions.rb
  105. +12 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/syntax.rb
  106. +41 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/syntax/blueprint.rb
  107. +68 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/syntax/generate.rb
  108. +39 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/syntax/make.rb
  109. +42 −0 vendor/gems/factory_girl-1.3.3/lib/factory_girl/syntax/sham.rb
  110. +16 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/acceptance_helper.rb
  111. +305 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/acceptance_spec.rb
  112. +48 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/models.rb
  113. +34 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/syntax/blueprint_spec.rb
  114. +57 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/syntax/generate_spec.rb
  115. +35 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/syntax/make_spec.rb
  116. +35 −0 vendor/gems/factory_girl-1.3.3/spec/acceptance/syntax/sham_spec.rb
  117. +33 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/aliases_spec.rb
  118. +29 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/attribute/association_spec.rb
  119. +23 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/attribute/callback_spec.rb
  120. +49 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/attribute/dynamic_spec.rb
  121. +29 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/attribute/static_spec.rb
  122. +30 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/attribute_spec.rb
  123. +677 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/factory_spec.rb
  124. +52 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/proxy/attributes_for_spec.rb
  125. +81 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/proxy/build_spec.rb
  126. +94 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/proxy/create_spec.rb
  127. +79 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/proxy/stub_spec.rb
  128. +84 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/proxy_spec.rb
  129. +66 −0 vendor/gems/factory_girl-1.3.3/spec/factory_girl/sequence_spec.rb
  130. +42 −0 vendor/gems/factory_girl-1.3.3/spec/spec_helper.rb
  131. +6 −1 vendor/gems/haml-3.0.13/.specification
  132. +9 −2 vendor/gems/maruku-0.6.0/.specification
  133. +5 −1 vendor/gems/mocha-0.9.7/.specification
  134. +11 −1 vendor/gems/rack-1.0.1/.specification
  135. +19 −2 vendor/gems/rspec-1.3.0/.specification
  136. +8 −1 vendor/gems/rspec-rails-1.3.2/.specification
  137. +4 −1 vendor/gems/thoughtbot-shoulda-2.10.2/.specification
  138. +4 −1 vendor/gems/will_paginate-2.3.11/.specification
  139. +0 −20 vendor/plugins/object_daddy/MIT-LICENSE
  140. +0 −314 vendor/plugins/object_daddy/README.markdown
  141. +0 −12 vendor/plugins/object_daddy/init.rb
  142. +0 −28 vendor/plugins/object_daddy/install.rb
  143. +0 −227 vendor/plugins/object_daddy/lib/object_daddy.rb
  144. +0 −123 vendor/plugins/object_daddy/spec/install_spec.rb
  145. +0 −848 vendor/plugins/object_daddy/spec/object_daddy_spec.rb
  146. +0 −3 vendor/plugins/object_daddy/spec/resources/config/database.yml
  147. +0 −30 vendor/plugins/object_daddy/spec/resources/schema
  148. +0 −5 vendor/plugins/object_daddy/spec/spec.opts
  149. +0 −20 vendor/plugins/object_daddy/spec/spec_helper.rb
  150. 0 vendor/plugins/object_daddy/spec/tmp/.git_sucks
@@ -4,6 +4,7 @@
class ApplicationController < ActionController::Base
include InheritedResources::DSL
include PaginateScopeHelper
+ include StringHelper
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
@@ -1,12 +1,9 @@
class FilesController < ApplicationController
- def diff
- unless SETTINGS.use_file_bucket_diffs
- render :text => "File bucket diffs have been disabled", :content_type => 'text/plain', :status => 403
- return
- end
+ before_filter :deny_unless_file_bucket_enabled
+ def diff
[params[:file1], params[:file2]].each do |md5|
- unless md5 =~ /^[0-9a-f]{32}$/
+ unless is_md5?(md5)
render :text => "Invalid md5: #{md5.inspect}", :content_type => 'text/plain', :status => 400
return
end
@@ -15,4 +12,23 @@ def diff
diff = PuppetHttps.get(url, 's')
render :text => diff, :content_type => 'text/plain'
end
+
+ def show
+ unless is_md5?(params[:file])
+ render :text => "Invalid md5: #{md5.inspect}", :content_type => 'text/plain', :status => 400
+ return
+ end
+
+ url = "https://#{SETTINGS.file_bucket_server}:#{SETTINGS.file_bucket_port}/production/file_bucket_file/md5/#{params[:file]}"
+ content = PuppetHttps.get(url, 's')
+ render :text => content, :content_type => 'text/plain'
+ end
+
+ private
+ def deny_unless_file_bucket_enabled
+ unless SETTINGS.use_file_bucket_diffs
+ render :text => "File bucket diffs have been disabled", :content_type => 'text/plain', :status => 403
+ return
+ end
+ end
end
@@ -7,27 +7,40 @@ class NodeGroupsController < InheritedResources::Base
def diff
@node_group = NodeGroup.find(params[:id])
+ unless params[:baseline_type] == "self"
+ node = Node.find_by_name(params[:baseline_host])
- @nodes_without_latest_inspect_reports = []
- @nodes_without_baselines = []
- @nodes_without_differences = []
- @nodes_with_differences = []
- @node_group.all_nodes.each do |node|
- @nodes_without_latest_inspect_reports << node and next unless node.last_inspect_report
- @nodes_without_baselines << node and next unless node.baseline_report
+ if node
+ @baseline = node.baseline_report
+ @diff_error_message = "Node '#{params[:baseline_host]}' does not have a baseline report set." unless @baseline
+ else
+ @diff_error_message = "Node '#{params[:baseline_host]}' does not exist."
+ end
+ end
- report_diff = node.baseline_report.diff(node.last_inspect_report)
- resource_statuses = Report.divide_diff_into_pass_and_fail(report_diff)
+ unless @diff_error_message
+ @nodes_without_latest_inspect_reports = []
+ @nodes_without_baselines = []
+ @nodes_without_differences = []
+ @nodes_with_differences = []
+ @node_group.all_nodes.sort_by(&:name).each do |node|
+ baseline = @baseline || node.baseline_report
+ @nodes_without_latest_inspect_reports << node and next unless node.last_inspect_report
+ @nodes_without_baselines << node and next unless baseline
- if resource_statuses[:failure].empty?
- @nodes_without_differences << node
- else
- @nodes_with_differences << {
- :baseline_report => node.baseline_report,
- :last_inspect_report => node.last_inspect_report,
- :report_diff => report_diff,
- :resource_statuses => resource_statuses,
- }
+ report_diff = baseline.diff(node.last_inspect_report)
+ resource_statuses = Report.divide_diff_into_pass_and_fail(report_diff)
+
+ if resource_statuses[:failure].empty?
+ @nodes_without_differences << node
+ else
+ @nodes_with_differences << {
+ :baseline_report => baseline,
+ :last_inspect_report => node.last_inspect_report,
+ :report_diff => report_diff,
+ :resource_statuses => resource_statuses,
+ }
+ end
end
end
end
@@ -39,9 +39,25 @@ def upload
def diff
@my_report = Report.find(params[:id])
- @baseline_report = Report.find(params[:baseline_id])
- @diff = @baseline_report.diff(@my_report)
- @resource_statuses = Report.divide_diff_into_pass_and_fail(@diff)
+
+ if params[:baseline_type] == "self"
+ @baseline_report = @my_report.node.baseline_report
+ @diff_error_message = "Node '#{@my_report.node.name}' does not have a baseline report set." unless @baseline_report
+ else
+ node = Node.find_by_name(params[:baseline_host])
+
+ if node
+ @baseline_report = node.baseline_report
+ @diff_error_message = "Node '#{params[:baseline_host]}' does not have a baseline report set." unless @baseline_report
+ else
+ @diff_error_message = "Node '#{params[:baseline_host]}' does not exist."
+ end
+ end
+
+ unless @diff_error_message
+ @diff = @baseline_report.diff(@my_report)
+ @resource_statuses = Report.divide_diff_into_pass_and_fail(@diff)
+ end
end
def make_baseline
@@ -51,36 +67,41 @@ def make_baseline
end
def search
- if params[:search_all_inspect_reports]
- inspected_resources = ResourceStatus.inspections
- else
- inspected_resources = ResourceStatus.latest_inspections
- end
- inspected_resources = inspected_resources.order("reports.time DESC")
+ flash[:errors] = []
+ inspected_resources = ResourceStatus.latest_inspections.order("nodes.name")
- if params[:file_title].present? and params[:file_content].present?
- @files = inspected_resources.by_file_title(params[:file_title])
- if params[:content_match] == "negative"
- @files = @files.without_file_content(params[:file_content])
- else
- @files = @files.by_file_content(params[:file_content])
- end
-
- elsif params[:file_title].present?
- @files = inspected_resources.by_file_title(params[:file_title])
+ @title = params[:file_title].to_s.strip
+ @content = params[:file_content].to_s.strip
- elsif params[:file_content].present?
- if params[:content_match] == "negative"
- @files = inspected_resources.in_a_report_without_content(params[:file_content])
- else
- @files = inspected_resources.by_file_content(params[:file_content])
+ if params[:file_title] == nil and params[:file_content] == nil
+ # Don't do anything; user just navigated to the search page
+ else
+ if !@title.present?
+ flash[:errors] << "Please specify the file title to search for"
end
+ if !@content.present?
+ flash[:errors] << "Please specify the file content to search for"
+ elsif !is_md5?(@content)
+ flash[:errors] << "#{@content} is not a valid md5 checksum"
+ end
+ if flash[:errors].empty?
+ @matching_files = inspected_resources.by_file_title(@title).by_file_content(@content)
+ @unmatching_files = inspected_resources.by_file_title(@title).without_file_content(@content)
+ end
+ end
+ end
+ def baselines
+ if request.format == :json
+ limit = params[:limit].to_i
+ search_term = params[:term].gsub(/([\\%_])/, "\\\\\\1")
+ prefix_matches = Report.baselines.where(["host LIKE ?", "#{search_term}%"]).order("host ASC").limit(limit).map(&:host)
+ substring_matches = Report.baselines.where(["host LIKE ?", "%#{search_term}%"]).order("host ASC").limit(limit).map(&:host)
+ matches = (prefix_matches + substring_matches).uniq[0,limit]
+ render :text => matches.to_json, :content_type => 'application/json'
else
- @files = nil
- return
+ render :status => 406
end
- @files = paginate_scope @files
end
private
@@ -261,4 +261,9 @@ def tokenize_input_class(*inputs)
def load_asynchronously(element, url)
javascript = "jQuery.get('#{url}', function(data) { jQuery('#{element}').html(data) })"
end
+
+ def generate_unique_id
+ @unique_id_counter ||= 0
+ @unique_id_counter += 1
+ end
end
@@ -1,2 +1,11 @@
module ReportsHelper
+ def popup_md5s( string )
+ if SETTINGS.use_file_bucket_diffs
+ string.gsub(/\{md5\}[a-fA-F0-9]{32}/) do |match|
+ link_to_function match, "display_file_popup('#{url_for :controller => :files, :action => :show, :file => match.sub('{md5}','')}')"
+ end
+ else
+ string
+ end
+ end
end
@@ -0,0 +1,6 @@
+module StringHelper
+ private
+ def is_md5?(str)
+ !!(str =~ /^[0-9a-f]{32}$/)
+ end
+end
View
@@ -136,7 +136,7 @@ def long_name
end
def baseline?
- self.node.baseline_report == self
+ self.node.baseline_report_id == self.id
end
def baseline!
@@ -1,5 +1,5 @@
class ResourceStatus < ActiveRecord::Base
- belongs_to :report
+ belongs_to :report, :include => :node
has_many :events, :class_name => "ResourceEvent", :dependent => :destroy
accepts_nested_attributes_for :events
@@ -9,33 +9,28 @@ class ResourceStatus < ActiveRecord::Base
named_scope :inspections, { :joins => :report, :conditions => "reports.kind = 'inspect'" }
named_scope :latest_inspections, {
- :joins => "INNER JOIN reports ON resource_statuses.report_id = reports.id INNER JOIN nodes on reports.id = nodes.last_inspect_report_id",
- :conditions => "reports.kind = 'inspect' and reports.id = nodes.last_inspect_report_id"
+ :conditions => "nodes.last_inspect_report_id = resource_statuses.report_id",
+ :include => [:report => :node],
}
named_scope :by_file_content, lambda {|content|
{
:conditions => ["resource_statuses.resource_type = 'File' AND resource_events.property = 'content' AND resource_events.previous_value = ?", "{md5}#{content}"],
- :joins => :events,
+ :include => :events,
}
}
named_scope :without_file_content, lambda {|content|
{
:conditions => ["resource_statuses.resource_type = 'File' AND resource_events.property = 'content' AND resource_events.previous_value != ?", "{md5}#{content}"],
- :joins => :events,
- }
- }
-
- named_scope :in_a_report_without_content, lambda {|content|
- {
- :conditions => ["resource_statuses.report_id NOT IN (SELECT report_id FROM resource_statuses rs JOIN resource_events re ON re.resource_status_id = rs.id WHERE rs.resource_type = 'File' AND re.property = 'content' AND re.previous_value = ?)", "{md5}#{content}"],
+ :include => :events,
}
}
named_scope :by_file_title, lambda {|title|
{
- :conditions => ["resource_type = 'File' AND title = ?", title],
+ :conditions => ["resource_statuses.resource_type = 'File' AND resource_statuses.title = ?", title],
+ :include => :events,
}
}
@@ -11,8 +11,8 @@
var relative_url_root = '#{ActionController::Base.relative_url_root}';
$.noConflict();
- = stylesheet_link_tag 'reset', 'layout', 'forms', 'tables', 'jquery.ui.autocomplete.css', 'typography', 'links', 'token-input-facebook', 'tipsy', 'application', :cache => 'all'
- = javascript_include_tag 'prototype', 'jquery-ui.min', 'jquery.tokeninput', 'excanvas.min', 'raphael-min', 'grafico.min', 'jquery.form', 'jquery.placeholders', 'jquery.ui.autocomplete', 'jquery.ui.autocomplete.ext', 'jquery.tipsy', 'search', 'application', :cache => 'all'
+ = stylesheet_link_tag 'reset', 'layout', 'forms', 'tables', 'jquery.ui.custom', 'jquery.ui.combobox', 'typography', 'links', 'token-input-facebook', 'tipsy', 'application', 'colorbox', :cache => 'all'
+ = javascript_include_tag 'prototype', 'jquery-ui.min', 'jquery.tokeninput', 'excanvas.min', 'raphael-min', 'grafico.min', 'jquery.form', 'jquery.placeholders', 'jquery.ui.combobox', 'jquery.colorbox.js', 'jquery.tipsy', 'search', 'application', :cache => 'all'
- body_classes = [ "#{controller.controller_name}_controller", "#{controller.controller_name}_#{controller.action_name}_action" ]
- body_classes << "#{controller.controller_name}_form_action" if %w[new create edit update].include?(controller.action_name)
@@ -4,26 +4,33 @@
%h2
Diff Report for
= @node_group.name
- - unless @nodes_without_latest_inspect_reports.empty?
+ - if @diff_error_message
.item
- %h2 No latest inspect report
- = @nodes_without_latest_inspect_reports.map {|node| link_to node.name, node_path(node)}.join(", ")
- - unless @nodes_without_baselines.empty?
- .item
- %h2 No baseline
- = @nodes_without_baselines.map {|node| link_to node.name, node_path(node)}.join(", ")
- - unless @nodes_without_differences.empty?
- .item
- %h2 No differences from baseline
- = @nodes_without_differences.map {|node| link_to node.name, node_path(node)}.join(", ")
- - unless @nodes_with_differences.empty?
- .item
- %h2 Nodes with difference from baseline
- %a{ :href => '#', :class => ['expand-all', 'button'] } expand all
- %br
- - @nodes_with_differences.each do |diff_information|
- = render 'reports/diff', |
- :baseline_report => diff_information[:baseline_report], |
- :my_report => diff_information[:last_inspect_report], |
- :resource_statuses => diff_information[:resource_statuses], |
- :diff => diff_information[:report_diff]
+ .section.error
+ %h3 No baseline available to compare.
+ %p
+ = h @diff_error_message
+ - else
+ - unless @nodes_without_latest_inspect_reports.empty?
+ .item
+ %h2 No latest inspect report
+ = @nodes_without_latest_inspect_reports.sort_by(&:name).map {|node| link_to node.name, node_path(node)}.join(", ")
+ - unless @nodes_without_baselines.empty?
+ .item
+ %h2 No baseline
+ = @nodes_without_baselines.sort_by(&:name).map {|node| link_to node.name, node_path(node)}.join(", ")
+ - unless @nodes_without_differences.empty?
+ .item
+ %h2 No differences from baseline
+ = @nodes_without_differences.sort_by(&:name).map {|node| link_to node.name, node_path(node)}.join(", ")
+ - unless @nodes_with_differences.empty?
+ .item
+ %h2 Nodes with difference from baseline
+ %a{ :href => '#', :class => ['expand-all', 'button'] } expand all
+ %br
+ - @nodes_with_differences.each do |diff_information|
+ = render 'reports/diff', |
+ :baseline_report => diff_information[:baseline_report], |
+ :my_report => diff_information[:last_inspect_report], |
+ :resource_statuses => diff_information[:resource_statuses], |
+ :diff => diff_information[:report_diff]
@@ -42,8 +42,8 @@
.section
.header
%h2 Nodes for this group
- %ul.actions
- %li= link_to "Diffs against own baselines", diff_node_group_path(@node_group), :class => 'button'
+ - if Report.baselines.any?
+ = render 'reports/baseline_selector', :diffee => @node_group
- if @node_group.all_nodes.present?
= render 'nodes/nodes', :nodes => @node_group.all_nodes, :container => @node_group
- else
@@ -75,10 +75,12 @@
.section
%h3
Recent inspections
- - if @node.baseline_report
- = link_to "Baseline: #{@node.baseline_report.time}", @node.baseline_report
%span.count== (#{@node.reports.inspections.count})
- reports_limit = 10
+ - if @node.baseline_report
+ %h4
+ Baseline:
+ = link_to "#{@node.baseline_report.time}", @node.baseline_report
%table.inspector
%thead
%tr
@@ -0,0 +1,13 @@
+%h3= "Compare with:"
+- form_tag({:id => diffee, :action => "diff"}, :id => "baseline_compare", :method => :get) do
+ %p
+ = radio_button_tag "baseline_type", "self", true
+ = label_tag "baseline_type_self", "individual baseline", :class => "inline"
+ %br
+ = radio_button_tag "baseline_type", "other"
+ = label_tag "baseline_type_other", "specific baseline:", :class => "inline"
+ = text_field_tag("baseline_host")
+ = link_to_function('Compare', "jQuery('#baseline_compare').submit()", :class => "button")
+= javascript_include_tag 'baseline_selector'
+%script{:type => 'text/javascript'}
+ setup_baseline_selector('#baseline_host', '#{baselines_reports_path :limit => 20, :format => :json}');
Oops, something went wrong.

0 comments on commit 875f5a4

Please sign in to comment.