From: Fabrice Bellingard Date: Fri, 23 Mar 2012 15:22:16 +0000 (+0100) Subject: SONAR-3353 TimeMachine widget not correctly displayed X-Git-Tag: 3.0~136 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=34f989f6f9da2aba60b5d4a6cb71ce6cb597d271;p=sonarqube.git SONAR-3353 TimeMachine widget not correctly displayed This happens if for all the metrics that must be displayed, each one of them has only 1 snapshot with a non-null value. In this case, the sparkline can't be displayed, so there's a layout problem in the element. --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb index d89d4d60535..91526be032b 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb @@ -61,7 +61,14 @@ end # Should display the sparkline? - display_sparkline = snapshot_by_id.size > 1 && widget_properties["displaySparkLine"] + sparkline_urls_by_row = {} + if widget_properties["displaySparkLine"] + rows.each do |row| + sparkline_url = row.sparkline_url + sparkline_urls_by_row[row] = sparkline_url if sparkline_url + end + end + display_sparkline = !sparkline_urls_by_row.empty? %>
@@ -101,8 +108,8 @@
<% end %> <% - sparkline_url=row.sparkline_url - if display_sparkline && sparkline_url + if display_sparkline + sparkline_url = sparkline_urls_by_row[row] %>
<%= format_measure(measure, :skip_span_id => true) %> <%= image_tag(sparkline_url) %>