Revision 459e0feb
Added by Paul Kelly almost 14 years ago
- ID 459e0feb5c15f2ff8c175e2d46e372b4d83c6a4c
app/controllers/reports_controller.rb | ||
---|---|---|
# avoids storing the report data in the log files
|
||
filter_parameter_logging :report
|
||
|
||
active_scaffold :reports do |config|
|
||
config.label = "Puppet reports"
|
||
config.actions = [:list, :search, :delete]
|
||
config.columns = [:host, :reported_at, :applied, :restarted, :failed, :failed_restarts, :skipped, :config_retrival, :runtime]
|
||
config.list.sorting = { :reported_at => :desc }
|
||
config.action_links.add 'show', :label => 'Details', :inline => false, :type => :record
|
||
def index
|
||
search_cmd = "Report"
|
||
for condition in Report::METRIC
|
||
search_cmd += ".with('#{condition.to_s}', #{params[condition]})" if params.has_key? condition
|
||
end
|
||
search_cmd += ".search(params[:search])"
|
||
# set defaults search order - cant use default scope due to bug in AR
|
||
# http://github.com/binarylogic/searchlogic/issues#issue/17
|
||
params[:search] ||= {}
|
||
params[:search][:order] ||= "ascend_by_reported_at"
|
||
|
||
@search = eval search_cmd
|
||
@reports = @search.paginate :page => params[:page], :include => [{:host => :domain}]
|
||
end
|
||
|
||
def show
|
||
@report = Report.find(params[:id])
|
||
end
|
||
|
||
def create
|
||
... | ... | |
end
|
||
end
|
||
|
||
def show
|
||
def destroy
|
||
@report = Report.find(params[:id])
|
||
if @report.destroy
|
||
flash[:foreman_notice] = "Successfully destroyed report."
|
||
else
|
||
flash[:foreman_error] = @report.errors.full_messages.join("<br>")
|
||
end
|
||
redirect_to reports_url
|
||
end
|
||
|
||
end
|
Also available in: Unified diff
Fixes #249 - Remove AS from reports
Added a searchbar for hostname, reporting period and the type of report.