aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-core-plugin
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-03-23 16:41:26 +0100
committerFabrice Bellingard <bellingard@gmail.com>2012-03-23 16:41:26 +0100
commite8cdc53a9e7b329abe80622bb7a36320d1dc3bd8 (patch)
treef944c5f2b0b8379fd23eb275496551be77ac7e31 /plugins/sonar-core-plugin
parent34f989f6f9da2aba60b5d4a6cb71ce6cb597d271 (diff)
downloadsonarqube-e8cdc53a9e7b329abe80622bb7a36320d1dc3bd8.tar.gz
sonarqube-e8cdc53a9e7b329abe80622bb7a36320d1dc3bd8.zip
SONAR-3354 Display an explicit message if no measure is available
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/time_machine.html.erb76
1 files changed, 42 insertions, 34 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 91526be032b..ea8e590b194 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
@@ -29,46 +29,48 @@
]
)
- # And prepare the rows to display
- snapshot_by_id={}
- snapshots.each do |s|
- snapshot_by_id[s.id]=s
- end
- rows_by_metric_id={}
- measures.each do |measure|
- next unless measure.metric
+
+ if measures.size > 0
+ # Prepare the rows to display
+ snapshot_by_id={}
+ snapshots.each do |s|
+ snapshot_by_id[s.id]=s
+ end
+ rows_by_metric_id={}
+ measures.each do |measure|
+ next unless measure.metric
- if measure.metric.timemachine? && (measure.value || measure.text_value)
- row=rows_by_metric_id[measure.metric_id]
- unless row
- row=Sonar::TimemachineRow.new(measure.metric)
- rows_by_metric_id[measure.metric_id]=row
- end
+ if measure.metric.timemachine? && (measure.value || measure.text_value)
+ row=rows_by_metric_id[measure.metric_id]
+ unless row
+ row=Sonar::TimemachineRow.new(measure.metric)
+ rows_by_metric_id[measure.metric_id]=row
+ end
- #optimization : avoid eager loading of snapshots
- measure.snapshot=snapshot_by_id[measure.snapshot_id]
- row.add_measure(measure)
+ #optimization : avoid eager loading of snapshots
+ measure.snapshot=snapshot_by_id[measure.snapshot_id]
+ row.add_measure(measure)
+ end
end
- end
- # Create the list of rows to display in the same order as defined by the user
- rows=[]
- metric_ids.each do |metric_id|
- row = rows_by_metric_id[metric_id]
- if row
- rows<<row
+ # Create the list of rows to display in the same order as defined by the user
+ rows=[]
+ metric_ids.each do |metric_id|
+ row = rows_by_metric_id[metric_id]
+ if row
+ rows<<row
+ end
end
- end
- # Should display the sparkline?
- 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
+ # Should display the sparkline?
+ 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
- end
- display_sparkline = !sparkline_urls_by_row.empty?
+ display_sparkline = !sparkline_urls_by_row.empty?
%>
<div style="overflow: auto;font-size: 12px;padding: 1px;">
@@ -121,4 +123,10 @@
</table>
-</div> \ No newline at end of file
+</div>
+
+<% else %>
+
+<span class="empty_widget"><%= message('widget.time_machine.no_data_for_selected_metrics') -%></span>
+
+<% end %> \ No newline at end of file