Skip to content

Commit

Permalink
Fixes #21253 - fix latest events widget
Browse files Browse the repository at this point in the history
  • Loading branch information
akofink authored and timogoebel committed Oct 12, 2017
1 parent 0439102 commit fa90853
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/services/dashboard/data.rb
Expand Up @@ -20,12 +20,9 @@ def report
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)
Expand Down

0 comments on commit fa90853

Please sign in to comment.