From: Fabrice Bellingard Date: Wed, 24 Aug 2011 13:50:32 +0000 (+0200) Subject: SONAR-2074 Select 'ncloc' by default for 1rst display X-Git-Tag: 2.11^2~129 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8a4f61072115d5c57098ae43d13dc4bba1292250;p=sonarqube.git SONAR-2074 Select 'ncloc' by default for 1rst display --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb index 274eeda8f2e..ad44fbac17a 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb @@ -9,6 +9,12 @@ metric_name_map[metric.id] = message('metric.' + metric.name + '.name') end end + if metric_data_map.empty? + # No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric + ncloc = Metric.find(:all, :conditions => "name = 'ncloc'").first + metric_data_map[ncloc.id] = [] + metric_name_map[ncloc.id] = message('metric.ncloc.name') + end # Retrieve metric trend information options = {}