]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3353 TimeMachine widget not correctly displayed
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 23 Mar 2012 15:22:16 +0000 (16:22 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Fri, 23 Mar 2012 15:22:16 +0000 (16:22 +0100)
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
<table> element.

plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb

index d89d4d60535bcc39fae91d25d18e71c275f9fea5..91526be032b6bbaa51f1e911bbc1d8733b801767 100644 (file)
    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?
 %>
 
 <div style="overflow: auto;font-size: 12px;padding: 1px;">
           <td width="1%" nowrap="nowrap" class="right"><%= format_measure(measure, :skip_span_id => true) %></td>
         <% end %>
         <%
-           sparkline_url=row.sparkline_url
-           if display_sparkline && sparkline_url
+           if display_sparkline
+             sparkline_url = sparkline_urls_by_row[row]
         %>
           <td width="1%">
             <%= image_tag(sparkline_url) %>