]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2074 Improve Timeline widget style
authorFabrice Bellingard <bellingard@gmail.com>
Fri, 9 Sep 2011 08:13:48 +0000 (10:13 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Fri, 9 Sep 2011 08:14:51 +0000 (10:14 +0200)
- Apply same event style as for the stack area chart
- Fix bug in event display (displays too many events)

plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb
sonar-server/src/main/webapp/javascripts/protovis-sonar.js

index 58f6fe9376def6ed48c7334e4c11e3df4e86f268..73b0d9a951b737864fb90f3e036b8ade82742bad 100644 (file)
   # Prepare also event structure if required
   unless widget_properties["hideEvents"]
     events = {}
-    Event.find(:all, :conditions => {:resource_id => @resource.id}, :order => 'event_date').each() do |event|
+    unless from_date
+      # find the oldest date
+      metric_data_map.values.each() do |metric_data_array|
+        first_date = Time.parse(metric_data_array[0][:date])
+        from_date = first_date if !from_date || from_date > first_date  
+      end
+    end
+    Event.find(:all, :conditions => ["resource_id=? AND event_date>=?", @resource.id, from_date], :order => 'event_date').each() do |event|
       if events[event.event_date]
         events[event.event_date] << event
       else
index f80836031b525c93e075c3a51504cb7bc6e33c10..2ae43a256a549b7b0db2540509b33690de6bd978 100755 (executable)
@@ -302,7 +302,7 @@ SonarWidgets.Timeline.prototype.render = function() {
                .height(h)
                .left(20)
                .right(20)
-               .bottom(20)
+               .bottom(30)
                .top(5)
                .strokeStyle("#CCC");
 
@@ -310,8 +310,8 @@ SonarWidgets.Timeline.prototype.render = function() {
        vis.add(pv.Rule)
                .data(x.ticks())
                .left(x)
-               .bottom(-5)
-               .height(5)
+               .bottom(-10)
+               .height(10)
                .anchor("bottom")
                .add(pv.Label)
                .text(x.tickFormat);
@@ -361,8 +361,9 @@ SonarWidgets.Timeline.prototype.render = function() {
                .bottom(0)
                .anchor("top")
                .add(pv.Dot)
-               .bottom(6)
+               .bottom(-6)
                .shape("triangle")
+               .angle(pv.radians(180))
                .strokeStyle("grey")
                .fillStyle(function(e) {return e.sid == snapshots[idx].sid ? eventHoverColor : eventColor;})
                .add(pv.Dot)
@@ -382,7 +383,8 @@ SonarWidgets.Timeline.prototype.render = function() {
        /* An invisible bar to capture events (without flickering). */
        vis.add(pv.Bar)
                .fillStyle("rgba(0,0,0,.001)")
-               .width(w+10)
+               .width(w+30)
+               .height(h+30)
                .event("mouseout", function() {
                        i = -1;
                        return vis;