foreman_openscap 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -6
  3. data/app/assets/javascript/foreman_openscap/period_selector.js +3 -0
  4. data/app/assets/javascript/foreman_openscap/policy_edit.js +37 -0
  5. data/app/assets/stylesheets/foreman_openscap/policy.css.scss +7 -0
  6. data/app/controllers/api/v2/{openscap → compliance}/arf_reports_controller.rb +6 -5
  7. data/app/controllers/scaptimony_arf_reports_controller.rb +9 -6
  8. data/app/controllers/scaptimony_policies_controller.rb +72 -11
  9. data/app/{models/scaptimony/asset.rb → controllers/scaptimony_policy_dashboard_controller.rb} +8 -9
  10. data/app/controllers/scaptimony_scap_contents_controller.rb +25 -16
  11. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +3 -4
  12. data/app/helpers/scaptimony_policies_helper.rb +22 -0
  13. data/app/helpers/scaptimony_policy_dashboard_helper.rb +43 -0
  14. data/app/helpers/scaptimony_report_dashboard_helper.rb +20 -0
  15. data/app/models/concerns/foreman_openscap/arf_report_extensions.rb +30 -1
  16. data/app/models/concerns/foreman_openscap/asset_extensions.rb +34 -0
  17. data/app/models/concerns/foreman_openscap/host_extensions.rb +38 -7
  18. data/app/models/concerns/foreman_openscap/policy_extensions.rb +214 -3
  19. data/app/models/concerns/foreman_openscap/scap_content_extensions.rb +21 -1
  20. data/app/overrides/hosts/index/host_arf_report.rb +5 -0
  21. data/app/services/scaptimony/policy_dashboard/data.rb +30 -0
  22. data/app/services/scaptimony/policy_dashboard/loader.rb +20 -0
  23. data/app/services/scaptimony/policy_dashboard/manager.rb +32 -0
  24. data/app/services/scaptimony/report_dashboard/data.rb +37 -0
  25. data/app/views/dashboard/_foreman_openscap_host_reports_widget.html.erb +24 -0
  26. data/app/views/dashboard/_foreman_openscap_reports_breakdown_widget.html.erb +3 -0
  27. data/app/views/scaptimony_arf_reports/_host_report.html.erb +8 -0
  28. data/app/views/scaptimony_arf_reports/_list.html.erb +2 -2
  29. data/app/views/scaptimony_arf_reports/show.html.erb +3 -0
  30. data/app/views/scaptimony_policies/_form.html.erb +23 -4
  31. data/app/views/scaptimony_policies/_list.html.erb +2 -4
  32. data/app/views/scaptimony_policies/create.html.erb +2 -0
  33. data/app/views/scaptimony_policies/edit.html.erb +1 -2
  34. data/app/views/scaptimony_policies/index.html.erb +1 -1
  35. data/app/views/scaptimony_policies/new.html.erb +1 -2
  36. data/app/views/scaptimony_policies/select_multiple_hosts.html.erb +8 -0
  37. data/app/views/scaptimony_policies/show.html.erb +3 -0
  38. data/app/views/scaptimony_policies/steps/_create_policy_form.html.erb +5 -0
  39. data/app/views/scaptimony_policies/steps/_hostgroups_form.html.erb +7 -0
  40. data/app/views/scaptimony_policies/steps/_locations_form.html.erb +13 -0
  41. data/app/views/scaptimony_policies/steps/_organizations_form.html.erb +13 -0
  42. data/app/views/scaptimony_policies/steps/_scap_content_form.html.erb +21 -0
  43. data/app/views/scaptimony_policies/steps/_schedule_form.html.erb +11 -0
  44. data/app/views/scaptimony_policies/steps/_step_form.html.erb +11 -0
  45. data/app/views/scaptimony_policy_dashboard/_policy_chart_widget.html.erb +4 -0
  46. data/app/views/scaptimony_policy_dashboard/_policy_reports.html.erb +24 -0
  47. data/app/views/scaptimony_policy_dashboard/_policy_status_widget.html.erb +12 -0
  48. data/app/views/scaptimony_policy_dashboard/index.html.erb +26 -0
  49. data/app/views/scaptimony_scap_contents/_form.html.erb +8 -0
  50. data/app/views/scaptimony_scap_contents/_list.html.erb +8 -6
  51. data/config/routes.rb +24 -6
  52. data/db/seeds.d/openscap_feature.rb +2 -0
  53. data/lib/foreman_openscap/engine.rb +18 -12
  54. data/lib/foreman_openscap/helper.rb +1 -7
  55. data/lib/foreman_openscap/version.rb +1 -1
  56. metadata +57 -31
  57. data/app/assets/javascript/policy_edit.js +0 -14
  58. data/app/overrides/dashboard/index/sample_override.html.erb.deface +0 -4
  59. data/db/migrate/20141017172055_create_scaptimony_auditable_hosts.rb +0 -9
@@ -0,0 +1,5 @@
1
+
2
+ Deface::Override.new(:virtual_path => "hosts/_list",
3
+ :name => "add_compliance_host_data",
4
+ :surround_contents => "td[@class='ellipsis']",
5
+ :partial => "scaptimony_arf_reports/host_report")
@@ -0,0 +1,30 @@
1
+ module Scaptimony::PolicyDashboard
2
+ class Data
3
+ attr_reader :report
4
+
5
+ def initialize(policy, filter = "")
6
+ @policy = policy
7
+ @filter = filter
8
+ @report = {}
9
+ fetch_data
10
+ end
11
+
12
+ private
13
+ attr_writer :report
14
+
15
+ def hosts
16
+ @hosts ||= Host.authorized(:view_hosts, Host)
17
+ end
18
+
19
+ def fetch_data
20
+ report.update(
21
+ {:compliant_hosts => @policy.assets.hosts.comply_with(@policy).count,
22
+ :incompliant_hosts => @policy.assets.hosts.incomply_with(@policy).count,
23
+ :inconclusive_hosts => @policy.assets.hosts.inconclusive_with(@policy).count,
24
+ :report_missing => @policy.assets.hosts.policy_reports_missing(@policy).count,
25
+ :assigned_hosts => @policy.assets.hosts.count,
26
+ :unassigned_hosts => hosts.count - @policy.assets.hosts.count
27
+ })
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ #
2
+ # Copyright (c) 2014 Red Hat Inc.
3
+ #
4
+ # This software is licensed to you under the GNU General Public License,
5
+ # version 3 (GPLv3). There is NO WARRANTY for this software, express or
6
+ # implied, including the implied warranties of MERCHANTABILITY or FITNESS
7
+ # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3
8
+ # along with this software; if not, see http://www.gnu.org/licenses/gpl.txt
9
+ #
10
+
11
+ module Scaptimony::PolicyDashboard
12
+ class Loader
13
+ def self.load
14
+ Scaptimony::PolicyDashboard::Manager.map do |dashboard|
15
+ dashboard.widget 'policy_status_widget', :row=>1,:col=>1,:sizex=>8,:sizey=>1,:name=> N_('Status table')
16
+ dashboard.widget 'policy_chart_widget', :row=>1,:col=>9,:sizex=>4,:sizey=>1,:name=> N_('Status chart')
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ #
2
+ # Copyright (c) 2014 Red Hat Inc.
3
+ #
4
+ # This software is licensed to you under the GNU General Public License,
5
+ # version 3 (GPLv3). There is NO WARRANTY for this software, express or
6
+ # implied, including the implied warranties of MERCHANTABILITY or FITNESS
7
+ # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3
8
+ # along with this software; if not, see http://www.gnu.org/licenses/gpl.txt
9
+ #
10
+
11
+ module Scaptimony::PolicyDashboard
12
+ module Manager
13
+ class << self
14
+ def map
15
+ @widgets ||= []
16
+ mapper = Mapper.new(@widgets)
17
+ if block_given?
18
+ yield mapper
19
+ else
20
+ mapper
21
+ end
22
+ end
23
+
24
+ def widgets
25
+ @widgets ||= Scaptimony::PolicyDashboard::Loader.load
26
+ end
27
+ end
28
+
29
+ class Mapper < ::Dashboard::Manager::Mapper
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,37 @@
1
+ module Scaptimony::ReportDashboard
2
+ class Data
3
+ attr_reader :report
4
+
5
+ def initialize(filter = "")
6
+ @filter = filter
7
+ @report = {}
8
+ fetch_data
9
+ end
10
+
11
+ private
12
+ attr_writer :report
13
+ attr_accessor :filter
14
+
15
+ def fetch_data
16
+ report.update(
17
+ {
18
+ :passed => passed_breakdowns,
19
+ :failed => failed_breakdowns,
20
+ :othered => othered_breakdowns
21
+ }
22
+ )
23
+ end
24
+
25
+ def passed_breakdowns
26
+ (::Scaptimony::ArfReportBreakdown.sum(:passed)).to_f
27
+ end
28
+
29
+ def failed_breakdowns
30
+ (::Scaptimony::ArfReportBreakdown.sum(:failed)).to_f
31
+ end
32
+
33
+ def othered_breakdowns
34
+ (::Scaptimony::ArfReportBreakdown.sum(:othered)).to_f
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,24 @@
1
+ <h4 class="ca"><%= _('Latest compliance reports') %></h4>
2
+ <% latest_reports = Scaptimony::ArfReport.latest %>
3
+ <% if latest_reports.empty? %>
4
+ <p class="ca"><%= _("No reports available") %></p>
5
+ <% else %>
6
+ <table class="table table-striped ellipsis">
7
+ <tr>
8
+ <th><%= _('Host') %></th>
9
+ <th><%= _('Policy') %></th>
10
+ <%= translated_header(s_('Passed|P'), _('Passed')).html_safe %>
11
+ <%= translated_header(s_('Failed|F'), _('Failed')).html_safe %>
12
+ <%= translated_header(s_('Othered|O'), _('Othered')).html_safe %>
13
+ </tr>
14
+ <% latest_reports.each do |report| %>
15
+ <tr>
16
+ <td><%= link_to h(report.host.name), scaptimony_arf_report_path(report) %></td>
17
+ <td><%= link_to h(report.policy.name), scaptimony_policy_dashboard_scaptimony_policy_path(report.policy) %></td>
18
+ <td><%= report_event_column(report.passed, "label-success") %></td>
19
+ <td><%= report_event_column(report.failed, "label-danger") %></td>
20
+ <td><%= report_event_column(report.othered, "label-info") %></td>
21
+ </tr>
22
+ <% end %>
23
+ </table>
24
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h4 class="header ca"><%= _('Compliance reports breakdown') %></h4>
2
+ <% report = Scaptimony::ReportDashboard::Data.new().report %>
3
+ <%= reports_breakdown_chart(report, :class => 'statistics-pie small') %>
@@ -0,0 +1,8 @@
1
+ <% if host.arf_reports.any? %>
2
+ <% if host.arf_reports.search_for('failed > 0').blank? %>
3
+ <%= link_to(report_event_column('O', "label-success"), scaptimony_arf_reports_path(:search => "host=#{host.name}")) %>
4
+ <% else %>
5
+ <%= link_to(report_event_column('F', "label-danger"), scaptimony_arf_reports_path(:search => "host=#{host.name}")) %>
6
+ <% end %>
7
+ <% end %>
8
+ <%= render_original %>
@@ -9,8 +9,8 @@
9
9
  </tr>
10
10
  <% for arf_report in @arf_reports %>
11
11
  <tr>
12
- <td><%= name_column(arf_report.asset.host) %></td>
13
- <td><%= _("%s ago") % time_ago_in_words(arf_report.date.getlocal) %></td>
12
+ <td><%= name_column(arf_report.host) %></td>
13
+ <td><%= _("%s ago") % time_ago_in_words(arf_report.date) %></td>
14
14
  <td><%= report_arf_column(arf_report.passed, "label-info") %></th>
15
15
  <td><%= report_arf_column(arf_report.failed, "label-danger") %></th>
16
16
  <td><%= report_arf_column(arf_report.othered, "label-warning") %></th>
@@ -0,0 +1,3 @@
1
+ <div class="row">
2
+ <iframe style="min-height: 800px" height="100%" width="100%" frameborder="0" src="<%= parse_scaptimony_arf_report_path(@arf_report) %>"></iframe>
3
+ </div>
@@ -1,4 +1,5 @@
1
- <%= javascript 'policy_edit' %>
1
+ <%= javascript 'foreman_openscap/policy_edit' %>
2
+ <%= javascript 'foreman_openscap/period_selector' %>
2
3
  <%= form_for @policy,
3
4
  :url => (@policy.id? ? scaptimony_policy_path(:id => @policy.id) : scaptimony_policies_path) do |f| %>
4
5
  <%= base_errors_for @policy %>
@@ -7,11 +8,18 @@
7
8
  <li class="active"><a href="#primary" data-toggle="tab"><%= _("General") %></a></li>
8
9
  <li><a href="#scap_content" data-toggle="tab"><%= _("SCAP Content") %></a></li>
9
10
  <li><a href="#scap_schedule" data-toggle="tab"><%= _("Schedule") %></a></li>
11
+ <% if show_location_tab? %>
12
+ <li><a href='#locations' data-toggle='tab'><%= _('Locations') %></a></li>
13
+ <% end %>
14
+ <% if show_organization_tab? %>
15
+ <li><a href='#organizations' data-toggle='tab'><%= _('Organizations') %></a></li>
16
+ <% end %>
17
+ <li><a href='#hostgroups' data-toggle='tab'><%= _('Hostgroups') %></a></li>
10
18
  </ul>
11
19
  <div class="tab-content">
12
20
  <div class="tab-pane active" id="primary">
13
21
  <%= text_f(f, :name) %>
14
- <%= text_f(f, :description, :size => "col-md-8" ) %>
22
+ <%= textarea_f(f, :description, :rows => :auto ) %>
15
23
  </div>
16
24
  <div class="tab-pane" id="scap_content">
17
25
  <%= select_f f, :scap_content_id, Scaptimony::ScapContent.all, :id, :title,
@@ -31,8 +39,19 @@
31
39
  </span>
32
40
  </div>
33
41
  <div class="tab-pane" id="scap_schedule">
34
- <%= text_f(f, :period) %>
35
- <%= text_f(f, :weekday) %>
42
+ <%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s,
43
+ { :include_blank => _('Choose period') },
44
+ { :onchange => 'period_selected(this)' }) %>
45
+ <%= select_f(f, :weekday, Date::DAYNAMES, :downcase, :to_s, :include_blank => _('Choose weekday')) %>
46
+ <%= text_f(f, :day_of_month, :help_inline => _('Number of a day in month, note that not all months have same count of days')) %>
47
+ <%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %>
48
+ </div>
49
+
50
+ <%= render 'taxonomies/loc_org_tabs', :f => f, :obj => @policy %>
51
+ <div class="tab-pane" id="hostgroups">
52
+ <%= multiple_selects f, :hostgroups, Hostgroup,
53
+ @policy.hostgroup_ids,
54
+ {:disabled => @policy.used_hostgroup_ids } %>
36
55
  </div>
37
56
  <%= submit_or_cancel f %>
38
57
  </div>
@@ -1,4 +1,4 @@
1
- <table class="table table-bordered table-striped table-two-pane">
1
+ <table class="table table-bordered table-striped">
2
2
  <tr>
3
3
  <th>Name</th>
4
4
  <th>Content</th>
@@ -8,9 +8,7 @@
8
8
  <% for policy in @policies %>
9
9
  <tr>
10
10
  <td>
11
- <%= link_to_if_authorized policy.name,
12
- hash_for_edit_scaptimony_policy_path(:id => policy).merge(
13
- :auth_object => policy, :authorizer => authorizer) %>
11
+ <%= link_to policy.name, scaptimony_policy_dashboard_scaptimony_policy_path(:id => policy.id) %>
14
12
  </td>
15
13
  <td>
16
14
  <% if !policy.scap_content.nil? %>
@@ -0,0 +1,2 @@
1
+ <% title _("New Compliance Policy") %>
2
+ <%= render :partial => "scaptimony_policies/steps/step_form" %>
@@ -1,3 +1,2 @@
1
1
  <% title _("Edit Compliance Policy") %>
2
-
3
- <%= render :partial => 'form' %>
2
+ <%= render :partial => "form" %>
@@ -1,4 +1,4 @@
1
- <%= javascript 'policy_edit' %>
1
+ <%= javascript 'foreman_openscap/policy_edit' %>
2
2
  <% title _("Compliance Policies") %>
3
3
 
4
4
  <% title_actions(
@@ -1,3 +1,2 @@
1
1
  <% title _("New Compliance Policy") %>
2
-
3
- <%= render :partial => 'form' %>
2
+ <%= render :partial => "scaptimony_policies/steps/step_form" %>
@@ -0,0 +1,8 @@
1
+ <%= render 'hosts/selected_hosts', :hosts => @hosts %>
2
+
3
+ <%= form_for :policy,
4
+ :url => update_multiple_hosts_scaptimony_policies_path(:host_ids => params[:host_ids]) do |f| %>
5
+ <%= selectable_f f, :id, [[_("Select Compliance Policy"), "disabled"],
6
+ ] + Scaptimony::Policy.all.map{|e| [e.name, e.id]},{},
7
+ :onchange => "toggle_multiple_ok_button(this)" %>
8
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <div class="row">
2
+ <iframe style="min-height: 800px" height="100%" width="100%" frameborder="0" src="<%= parse_scaptimony_policy_path(@policy) %>"></iframe>
3
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="create-policy">
2
+ <%= wizard_header @policy.step_index, *@policy.steps %>
3
+ <%= text_f(f, :name) %>
4
+ <%= text_f(f, :description, :size => "col-md-8" ) %>
5
+ </div>
@@ -0,0 +1,7 @@
1
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="hostgroups">
2
+ <%= wizard_header @policy.step_index, *@policy.steps %>
3
+ <% select_options ||= {} %>
4
+ <%= multiple_selects f, :hostgroups, Hostgroup,
5
+ @policy.hostgroup_ids,
6
+ {:disabled => @policy.used_hostgroup_ids }.merge!(select_options) %>
7
+ </div>
@@ -0,0 +1,13 @@
1
+ <% select_options ||= {} %>
2
+ <% html_options ||= {} %>
3
+ <% html_options[:location] ||= {} %>
4
+ <% obj = @policy %>
5
+ <% if show_location_tab? %>
6
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="locations">
7
+ <%= wizard_header @policy.step_index, *@policy.steps %>
8
+ <%= location_selects f, obj.used_or_selected_location_ids,
9
+ {:disabled => obj.used_location_ids}.merge!(select_options),
10
+ {:data => {:descendants => obj.children_of_selected_location_ids,
11
+ :useds => obj.used_location_ids}}.merge!(html_options[:location]) %>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <% select_options ||= {} %>
2
+ <% html_options ||= {} %>
3
+ <% html_options[:organization] ||= {} %>
4
+ <% obj = @policy %>
5
+ <% if show_organization_tab? %>
6
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="organizations">
7
+ <%= wizard_header @policy.step_index, *@policy.steps %>
8
+ <%= organization_selects f, obj.used_or_selected_organization_ids,
9
+ {:disabled => obj.used_organization_ids}.merge!(select_options),
10
+ {:data => {:descendants => obj.children_of_selected_organization_ids,
11
+ :useds => obj.used_organization_ids}}.merge!(html_options[:organization]) %>
12
+ </div>
13
+ <% end %>
@@ -0,0 +1,21 @@
1
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="scap_content">
2
+ <%= wizard_header @policy.step_index, *@policy.steps %>
3
+
4
+ <%= select_f f, :scap_content_id, Scaptimony::ScapContent.all, :id, :title,
5
+ {:include_blank => _("Choose existing SCAP Content")},
6
+ {:label => _("SCAP Content"),
7
+ :onchange => 'scap_content_selected(this);',
8
+ :'data-url' => method_path('scap_content_selected')}
9
+ %>
10
+ <span id="scap_content_profile_select">
11
+ <%= select_f f, :scap_content_profile_id, profiles_selection, :id, :title,
12
+ {:selected => @policy.scap_content_profile_id,
13
+ :include_blank => _("Default XCCDF profile")},
14
+ {:label => _("XCCDF Profile"),
15
+ :disabled => profiles_selection.empty?,
16
+ :help_inline => :indicator}
17
+ %>
18
+ </span>
19
+ <p class="alert alert-info"><%= _('Notice: Ensure the selected SCAP content exists on your hosts.') %></p>
20
+ </div>
21
+
@@ -0,0 +1,11 @@
1
+ <%= javascript 'foreman_openscap/period_selector' %>
2
+
3
+ <div class="tab-pane <%= show_partial_wizard(step) %>" id="scap_schedule">
4
+ <%= wizard_header @policy.step_index, *@policy.steps %>
5
+ <%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s,
6
+ { :include_blank => _('Choose period') },
7
+ { :onchange => 'period_selected(this)' }) %>
8
+ <%= select_f(f, :weekday, Date::DAYNAMES, :downcase, :to_s, :include_blank => _('Choose weekday')) %>
9
+ <%= text_f(f, :day_of_month, :help_inline => _('Number of a day in month, note that not all months have same count of days')) %>
10
+ <%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %>
11
+ </div>
@@ -0,0 +1,11 @@
1
+ <%= javascript 'foreman_openscap/policy_edit' %>
2
+ <%= stylesheet 'foreman_openscap/policy' %>
3
+ <%= form_for @policy,
4
+ :url => (@policy.id? ? scaptimony_policy_path(:id => @policy.id) : scaptimony_policies_path) do |f| %>
5
+ <%= base_errors_for @policy %>
6
+ <%= f.hidden_field(:current_step, :value => @policy.next_step) unless @policy.current_step.blank? %>
7
+ <% @policy.steps.each do | step | %>
8
+ <%= render :partial => "scaptimony_policies/steps/#{step.downcase.tr(' ', '_')}_form", :locals => {:f => f, :step => step} %>
9
+ <% end %>
10
+ <%= submit_or_cancel_policy(f, (_('Next') unless @policy.last_step?) ) %>
11
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <div id='status-chart'>
2
+ <h4 class="header ca"><%= _('Host Breakdown Chart') %></h4>
3
+ <%= host_breakdown_chart(@report, :class => 'statistics-pie small') %>
4
+ </div>
@@ -0,0 +1,24 @@
1
+ <table class="table table-bordered table-striped ellipsis">
2
+ <tr>
3
+ <th><%= _('Host') %></th>
4
+ <th><%= _("Date") %></th>
5
+ <th><%= _("Passed") %></th>
6
+ <th><%= _("Failed") %></th>
7
+ <th><%= _("Other") %></th>
8
+ <th></th>
9
+ </tr>
10
+ <% for arf_report in @policy.arf_reports.latest %>
11
+ <tr>
12
+ <td><%= name_column(arf_report.host) %></td>
13
+ <td><%= _("%s ago") % time_ago_in_words(arf_report.date) %></td>
14
+ <td><%= report_arf_column(arf_report.passed, "label-info") %></th>
15
+ <td><%= report_arf_column(arf_report.failed, "label-danger") %></th>
16
+ <td><%= report_arf_column(arf_report.othered, "label-warning") %></th>
17
+ <td>
18
+ <%= action_buttons(
19
+ link_to(_("View Report"), hash_for_scaptimony_arf_report_path(:id => arf_report.id))
20
+ ) %>
21
+ </td>
22
+ </tr>
23
+ <% end %>
24
+ </table>
@@ -0,0 +1,12 @@
1
+ <div id='status-table'>
2
+ <h4 class="header"><%= _('Hosts Breakdown') %></h4>
3
+ <ul>
4
+ <%= status_link _('Compliant with the policy'), :compliant_hosts, scaptimony_arf_reports_path(:search => "comply_with = #{@policy.name}") %>
5
+ <%= status_link _('Not compliant with the policy'), :incompliant_hosts, scaptimony_arf_reports_path(:search => "not_comply_with = #{@policy.name}") %>
6
+ <%= status_link _('Inconclusive results'), :inconclusive_hosts, scaptimony_arf_reports_path(:search => " inconclusive_with = #{@policy.name}") %>
7
+ <%= status_link _('Never audited'), :report_missing, hosts_path(:search => "compliance_report_missing_for = #{@policy.name}") %>
8
+ <h4 class="total">
9
+ <%= link_to(_("Total hosts: %s") % @report[:assigned_hosts], hosts_path(:search => "compliance_policy = #{@policy.name}")) %>
10
+ </h4>
11
+ </ul>
12
+ </div>
@@ -0,0 +1,26 @@
1
+ <%= javascript 'dashboard' %>
2
+
3
+ <% title _("Compliance policy: %s") % @policy.name %>
4
+
5
+ <div id='dashboard' class="row gridster">
6
+ <ul>
7
+ <%= policy_widget_list.map do |widget|
8
+ content_tag(:li, render(widget.id), :data => {
9
+ :id => widget.id,
10
+ :name => widget.name || widget.id,
11
+ :row => widget.row,
12
+ :col => widget.col,
13
+ :sizex => widget.sizex,
14
+ :sizey => widget.sizey,
15
+ :hide => widget.hide
16
+ })
17
+ end.join(' ').html_safe
18
+ %>
19
+ </ul>
20
+ </div>
21
+ <% if @policy.arf_reports.any? %>
22
+ <div class="row gridster">
23
+ <%= _("Latest reports for policy: %s") % @policy.name %>
24
+ <%= render :partial => 'policy_reports' %>
25
+ </div>
26
+ <% end %>