Class: AbrtReportsController

Inherits:
ApplicationController
  • Object
show all
Includes:
AbrtReportsHelper, Foreman::Controller::AutoCompleteSearch
Defined in:
app/controllers/abrt_reports_controller.rb

Instance Method Summary collapse

Methods included from AbrtReportsHelper

#count_abrt_reports, #format_reason, #render_abrt_graph, #send_to_abrt_server, #simple_format_if_multiline

Instance Method Details

#action_permissionObject



8
9
10
11
12
13
14
15
# File 'app/controllers/abrt_reports_controller.rb', line 8

def action_permission
  case params[:action]
    when 'forward'
      :forward
    else
      super
  end
end

#destroyObject

DELETE /abrt_reports/42



31
32
33
34
35
36
37
38
# File 'app/controllers/abrt_reports_controller.rb', line 31

def destroy
  if @abrt_report.destroy
    notice _("Successfully deleted bug report.")
  else
    error @abrt_reports.errors.full_messages.join("<br/>")
  end
  redirect_to abrt_reports_url
end

#forwardObject

POST /abrt_reports/42/forward



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/controllers/abrt_reports_controller.rb', line 41

def forward
  redirect_to abrt_report_url(@abrt_report)

  begin
    response = send_to_abrt_server @abrt_report
  rescue => e
    error _("Server rejected our report: #{e.message}") and return
  end

  begin
    @abrt_report.add_response response
  rescue => e
    error _("Cannot process server response: #{e.message}") and return
  end

  notice _("Report successfully forwarded")
end

#indexObject

GET /abrt_reports



18
19
20
# File 'app/controllers/abrt_reports_controller.rb', line 18

def index
  @abrt_reports = resource_base.search_for(params[:search], :order => params[:order]).paginate(:page => params[:page], :per_page => params[:per_page]).includes(:host)
end

#showObject

GET /abrt_reports/42



23
24
25
26
27
28
# File 'app/controllers/abrt_reports_controller.rb', line 23

def show
  respond_to do |format|
    format.html
    format.json { render :json => @abrt_report.json }
  end
end