Skip to content

Commit

Permalink
Add clickthrough to trends
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej committed Aug 16, 2021
1 parent 00e36c9 commit ce238ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 1 addition & 5 deletions app/helpers/foreman_statistics/trends_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ def trend_title(trend)
def trend_chart_data(trend, from = Setting[:max_trend])
data = {}
names = {}
paths = {}
trend.values.preload(:trendable).each do |value|
names[value.id] = CGI.escapeHTML(value.to_label)
paths[value.id] = trend_path(id: value)
end
trend.values.preload(:trendable).each { |value| names[value.id] = CGI.escapeHTML(value.to_label) }
trend.values.preload(:trend_counters).joins(:trend_counters)
.where(['trend_counters.interval_end > ? or trend_counters.interval_end is null', from])
.reorder('trend_counters.interval_start')
Expand Down
2 changes: 1 addition & 1 deletion app/views/foreman_statistics/trends/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="stats-well trends-chart">
<h4 class="ca"><%= "#{trend_title(@trend)}" %></h4>
<h6 class="ca"><%= n_("last %s day", "last %s days", trends_range) % trends_range %></h6>
<%= react_component('AreaChart', yAxisLabel: _('Number of Hosts'), data: trend_chart_data(@trend, trends_range.days.ago)) %>
<%= react_component('AreaChart', yAxisLabel: _('Number of Hosts'), data: trend_chart_data(@trend, trends_range.days.ago), searchUrl: trend_path(id: '~VAL~')) %>
</div>
</div>
</div>
Expand Down

0 comments on commit ce238ef

Please sign in to comment.