Class: OmahaReportsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- OmahaReportsController
- Includes:
- Foreman::Controller::AutoCompleteSearch
- Defined in:
- app/controllers/omaha_reports_controller.rb
Instance Method Summary collapse
Instance Method Details
#destroy ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/omaha_reports_controller.rb', line 36 def destroy @omaha_report = resource_base.find(params[:id]) if @omaha_report.destroy process_success( :success_msg => _('Successfully deleted report.'), :success_redirect => omaha_reports_path ) else process_error end end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/omaha_reports_controller.rb', line 12 def index @host = resource_finder(Host.(:view_hosts), params[:host_id]) if params[:host_id] @omaha_reports = resource_base_search_and_page(:host) end |
#model_of_controller ⇒ Object
8 9 10 |
# File 'app/controllers/omaha_reports_controller.rb', line 8 def model_of_controller ::ForemanOmaha::OmahaReport end |
#show ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/omaha_reports_controller.rb', line 17 def show # are we searching for the last report? if params[:id] == 'last' conditions = if params[:host_id].present? { :host_id => resource_finder(Host.(:view_hosts), params[:host_id]).try(:id) } else {} end params[:id] = resource_base.where(conditions).maximum(:id) end return not_found if params[:id].blank? @omaha_report = resource_base.includes(:logs => [:message, :source]).find(params[:id]) @offset = @omaha_report.reported_at - @omaha_report.created_at end |