From: Fabrice Bellingard Date: Fri, 19 Aug 2011 13:57:22 +0000 (+0200) Subject: SONAR-2074 Improve timeline widget X-Git-Tag: 2.11^2~136 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=12ebcddbcec1e865f271c1fc258ba52fd1c99ae9;p=sonarqube.git SONAR-2074 Improve timeline widget - Improve JS code - Sort the trends directly in the TrendsChart Ruby class - Add optional title for graph - Graph aware of differential view system --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java index c7c98054d88..6faba17f939 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java @@ -19,10 +19,15 @@ */ package org.sonar.plugins.core.widgets; -import org.sonar.api.web.*; +import org.sonar.api.web.AbstractRubyTemplate; +import org.sonar.api.web.RubyRailsWidget; +import org.sonar.api.web.WidgetProperties; +import org.sonar.api.web.WidgetProperty; +import org.sonar.api.web.WidgetPropertyType; @WidgetProperties( { + @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING), @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC), @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC), @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC), @@ -40,7 +45,7 @@ public class TimelineWidget extends AbstractRubyTemplate implements RubyRailsWid @Override protected String getTemplatePath() { - return "/org/sonar/plugins/core/widgets/timeline.html.erb"; - //return "/Users/fbellingard/Documents/Sonar/repos/sonar/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb"; + //return "/org/sonar/plugins/core/widgets/timeline.html.erb"; + return "/Users/fbellingard/Documents/Sonar/repos/sonar/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb"; } } \ No newline at end of file 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 d50e8ad9405..1c2f6ffc520 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 @@ -1,9 +1,4 @@ <%= javascript_include_tag 'protovis-sonar' %> - -
- - \ No newline at end of file diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml index ef0b4b3ffd7..6cb65614c09 100644 --- a/sonar-server/pom.xml +++ b/sonar-server/pom.xml @@ -266,6 +266,7 @@ **/prototip-min.js **/dashboard-min.js **/protovis-min.js + **/protovis-sonar-min.js ${project.build.directory}/${project.build.finalName}/javascripts/sonar.js diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb index 39497a9ed18..00d2a31ab02 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/trends_chart.rb @@ -25,7 +25,6 @@ class TrendsChart init_series(java_chart, metrics) metric_ids=metrics.map{|m| m.id} add_measures(java_chart, time_machine_measures(resource, metric_ids, options)) - add_measures(java_chart, time_machine_reviews(resource, metric_ids, options)) add_labels(java_chart, resource); export_chart_as_png(java_chart) @@ -55,6 +54,7 @@ class TrendsChart if (options[:to]) sql += ' and s.created_at<=?' end + sql += ' order by s.created_at ASC' conditions=[sql, Snapshot::STATUS_PROCESSED, resource.id, metric_ids] if (options[:from]) conditions< <%= javascript_include_tag 'dashboard' %> <%= javascript_include_tag 'protovis' %> +<%= javascript_include_tag 'protovis-sonar' %> <% end %>