Project

General

Profile

« Previous | Next » 

Revision fe5f36c1

Added by Andrew Kofink over 6 years ago

Fixes #21253 - fix latest events widget

(cherry picked from commit fa908536885b602232208df0a974f995ed2a50e0)

View differences:

app/services/dashboard/data.rb
end
def latest_events
con = ActiveRecord::Base.connection
#workaround to get the inner query working
ids = hosts.to_sql.sub(/SELECT.*FROM/, "SELECT #{Host.quoted_table_name}.#{con.quote_column_name('id')} FROM")
# 9 reports + header fits the events box nicely...
@latest_events ||= ConfigReport.authorized(:view_config_reports).my_reports.interesting
.where("#{ConfigReport.quoted_table_name}.#{con.quote_column_name('host_id')} IN (#{ids})")
.where(host_id: hosts.pluck(:id))
.search_for('reported > "7 days ago"')
.reorder(:reported_at => :desc)
.limit(9)

Also available in: Unified diff