From 34f989f6f9da2aba60b5d4a6cb71ce6cb597d271 Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Fri, 23 Mar 2012 16:22:16 +0100 Subject: [PATCH] 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. --- .../plugins/core/widgets/time_machine.html.erb | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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) %> -- 2.39.5