aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-03-08 13:23:38 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-03-08 13:23:38 +0100
commit914d329ad4f75b0248c44fdfa0cea958a5388c8b (patch)
treed5d7a5f48e71517d21d476a2d9695a9354373247 /sonar-server
parent5434327a2cbdd535cd28e5abbd70ac89d5f7b5b5 (diff)
downloadsonarqube-914d329ad4f75b0248c44fdfa0cea958a5388c8b.tar.gz
sonarqube-914d329ad4f75b0248c44fdfa0cea958a5388c8b.zip
SONAR-2218 improve UI
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb34
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb32
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb112
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb124
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb13
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb80
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb2
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css2
14 files changed, 267 insertions, 168 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb
index 46910f85fb4..90a2cce018b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb
@@ -20,7 +20,7 @@
class DrilldownController < ApplicationController
before_filter :init_project
- helper ProjectHelper
+ helper ProjectHelper, DashboardHelper
SECTION=Navigation::SECTION_RESOURCE
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
index e965b1a748b..afcc3f2722e 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
@@ -171,8 +171,8 @@ class ResourceController < ApplicationController
if @period
date=@snapshot.period_datetime(@period)
if date
- conditions+=' AND created_at>=?'
- values<<date
+ conditions+=' AND created_at>?'
+ values<<date.advance(:minutes => 1)
else
conditions+=' AND id=-1'
end
@@ -213,10 +213,10 @@ class ResourceController < ApplicationController
def filter_lines_by_date
if @period
- date=@snapshot.period_datetime(@period)
- if date
+ to=@snapshot.period_datetime(@period)
+ if to
@lines.each do |line|
- line.hidden=true if line.datetime==nil || line.datetime<date
+ line.hidden=true if line.datetime==nil || line.datetime<to
end
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
index 848d6becce1..44232d80298 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
@@ -470,7 +470,11 @@ module ApplicationHelper
index = @dashboard_configuration.period_index
end
- m.variation(index)
+ if m
+ m.variation(index)||options[:default]
+ else
+ options[:default]
+ end
end
@@ -521,6 +525,8 @@ module ApplicationHelper
end
html="<span class='#{css_class}'>#{formatted_val}</span>"
end
+ else
+ html = options[:default].to_s
end
html
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
index e1a34328ffb..8b880481bde 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb
@@ -37,4 +37,38 @@ module DashboardHelper
nil
end
end
+
+ def violation_period_select_options(snapshot, index)
+ return nil if snapshot.nil? || snapshot.project_snapshot.nil?
+ mode=snapshot.project_snapshot.send "period#{index}_mode"
+ mode_param=snapshot.project_snapshot.send "period#{index}_param"
+ date=snapshot.project_snapshot.send "period#{index}_date"
+
+ if mode
+ if mode=='days'
+ label = "Added over %s days" % mode_param
+ elsif mode=='version'
+ label = "Added since version %s" % mode_param
+ elsif mode=='previous_analysis'
+ label = "Added since previous analysis (%s)" % date.strftime("%Y %b. %d")
+ elsif mode=='date'
+ label = "Added since #{date.strftime("%Y %b %d")}"
+ end
+ if label
+ selected=(params[:period]==index.to_s ? 'selected' : '')
+ "<option value='#{index}' #{selected}>#{label}</option>"
+ end
+ else
+ nil
+ end
+
+ end
+
+ def measure_or_variation_value(measure)
+ if measure
+ @period_index ? measure.variation(@period_index) : measure.value
+ else
+ nil
+ end
+ end
end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb
index 19537519d4d..400d4af0886 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb
@@ -19,37 +19,5 @@
#
module DrilldownHelper
- def period_select_options(snapshot, index)
- return nil if snapshot.nil? || snapshot.project_snapshot.nil?
- mode=snapshot.project_snapshot.send "period#{index}_mode"
- mode_param=snapshot.project_snapshot.send "period#{index}_param"
- date=snapshot.project_snapshot.send "period#{index}_date"
- if mode
- if mode=='days'
- label = "Added over %s days" % mode_param
- elsif mode=='version'
- label = "Added since version %s" % mode_param
- elsif mode=='previous_analysis'
- label = "Added since previous analysis (%s)" % date.strftime("%Y %b. %d")
- elsif mode=='date'
- label = "Added since #{date.strftime("%Y %b %d")}"
- end
- if label
- selected=(params[:period]==index.to_s ? 'selected' : '')
- "<option value='#{index}' #{selected}>#{label}</option>"
- end
- else
- nil
- end
-
- end
-
- def measure_or_variation_value(measure)
- if measure
- @period_index ? measure.variation(@period_index) : measure.value
- else
- nil
- end
- end
end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb
index aff4f99f88a..14c91ad345a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb
@@ -1,8 +1,8 @@
<tr class="<%= css -%> <%= 'selected' if Sonar::RulePriority.to_s(priority_id)==params[:priority] -%>">
<td><%= image_tag "priority/#{priority_id}.png" %></td>
- <td><%= link_to label, {:controller => 'drilldown', :action => 'violations', :id => @project.id, :priority => Sonar::RulePriority.to_s(priority_id), :period => @period_index} %></td>
+ <td><%= link_to label, {:controller => 'drilldown', :action => 'violations', :id => @project.id, :priority => Sonar::RulePriority.to_s(priority_id), :period => @period} %></td>
<td style="padding-left: 10px;" align="right">
- <%= @period_index ? format_variation(measure, :index => @period_index, :style => 'light') : format_measure(measure) -%>
+ <%= @period ? format_variation(measure, :index => @period, :style => 'light') : format_measure(measure) -%>
</td>
<td align="left">
<% value = measure_or_variation_value(measure) %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
index 329dfd64cfb..6da915f8c1b 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
@@ -13,7 +13,7 @@
<option value="">Time changes...</option>
<% end %>
<% for period_index in 1..5 do %>
- <%= period_select_options(@snapshot, 1) if @drilldown.display_period?(period_index) -%>
+ <%= period_select_options(@snapshot, period_index) if @drilldown.display_period?(period_index) -%>
<% end %>
</select>
</form>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
index 434bf469bb4..06e4f5d34f5 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
@@ -12,11 +12,11 @@
- <form method="GET" action="<%= url_for :only_path=>true, :overwrite_params => {:period => nil} -%>" style="display: inline">
<select id="select-comparison" name="period" onchange="submit()" class="small">
<option value="">Time changes...</option>
- <%= period_select_options(@snapshot, 1) -%>
- <%= period_select_options(@snapshot, 2) -%>
- <%= period_select_options(@snapshot, 3) -%>
- <%= period_select_options(@snapshot, 4) -%>
- <%= period_select_options(@snapshot, 5) -%>
+ <%= violation_period_select_options(@snapshot, 1) -%>
+ <%= violation_period_select_options(@snapshot, 2) -%>
+ <%= violation_period_select_options(@snapshot, 3) -%>
+ <%= violation_period_select_options(@snapshot, 4) -%>
+ <%= violation_period_select_options(@snapshot, 5) -%>
</select>
</form>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
index 3f58b908b1a..a7a297576bd 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_coverage.html.erb
@@ -1,68 +1,64 @@
<div id="coverage_header" class="tab_header">
- <table class="metrics">
- <tr>
- <td class="big" rowspan="2"><%= format_measure('coverage', :default => '-') -%></td>
- <td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('line_coverage'), :title => 'Line coverage'} -%>
+ <% if @period && measure('new_coverage') %>
+ <p>On new code:</p>
+ <table class="metrics">
+ <tr>
+ <td class="big" rowspan="2"><%= format_variation('new_coverage', :period => @period, :style => 'none') -%></td>
- <td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('branch_coverage'), :title => 'Branch coverage'} -%>
- </tr>
- <tr>
- <td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_lines'), :title => 'Uncovered lines', :ratio => measure('lines_to_cover')} -%>
- <td class="sep"> </td>
- <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_conditions'), :title => 'Uncovered conditions', :ratio => measure('conditions_to_cover')} -%>
- </tr>
+ <td class="sep"> </td>
- <% if @period && measure('new_coverage')
- new_uncovered_lines=measure('new_uncovered_lines')
- %>
- <tr>
- <td colspan="7"><br/>On new/changed code: </td>
- </tr>
+ <% if m=measure('new_line_coverage') %>
+ <td class="name">Line coverage:</td>
+ <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
+ <% else %>
+ <td colspan="2"></td>
+ <% end %>
- <tr>
- <td class="big" rowspan="2"><%= format_variation('new_coverage', :period => @period, :style => 'none') -%></td>
+ <td class="sep"> </td>
+ <% if m=measure('new_branch_coverage') %>
+ <td class="name">Branch coverage:</td>
+ <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
+ <% else %>
+ <td colspan="2"></td>
+ <% end %>
+ </tr>
+ <tr>
+ <td class="sep"> </td>
+ <% if m=measure('new_uncovered_lines') %>
+ <td class="name">Uncovered lines:</td>
+ <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_lines_to_cover', :period => @period, :style => 'none') -%></td>
+ <% else %>
+ <td colspan="2"></td>
+ <% end %>
- <td class="sep"> </td>
-
- <% if m=measure('new_line_coverage') %>
- <td class="name">Line coverage:</td>
- <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
- <% else %>
- <td colspan="2"></td>
- <% end %>
+ <td class="sep"> </td>
+ <% if m=measure('new_uncovered_conditions') %>
+ <td class="name">Uncovered conditions: </td>
+ <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_conditions_to_cover', :period => @period, :style => 'none') -%></td>
+ <% else %>
+ <td colspan="2"></td>
+ <% end %>
+ </tr>
+ </table>
+ <% else %>
+ <table class="metrics">
+ <tr>
+ <td class="big" rowspan="2"><%= format_measure('coverage', :default => '-') -%></td>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('line_coverage'), :title => 'Line coverage'} -%>
- <td class="sep"> </td>
- <% if m=measure('new_branch_coverage') %>
- <td class="name">Branch coverage:</td>
- <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%></td>
- <% else %>
- <td colspan="2"></td>
- <% end %>
- </tr>
- <tr>
- <td class="sep"> </td>
-
- <% if new_uncovered_lines %>
- <td class="name">Uncovered lines:</td>
- <td class="value"><%= format_variation(new_uncovered_lines, :period => @period, :style => 'none') -%>/<%= format_variation('new_lines_to_cover', :period => @period, :style => 'none') -%></td>
- <% else %>
- <td colspan="2"></td>
- <% end %>
-
- <td class="sep"> </td>
- <% if m=measure('new_uncovered_conditions') %>
- <td class="name">Uncovered conditions: </td>
- <td class="value"><%= format_variation(m, :period => @period, :style => 'none') -%>/<%= format_variation('new_conditions_to_cover', :period => @period, :style => 'none') -%></td>
- <% else %>
- <td colspan="2"></td>
- <% end %>
- </tr>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('branch_coverage'), :title => 'Branch coverage'} -%>
+ </tr>
+ <tr>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_lines'), :title => 'Uncovered lines', :ratio => measure('lines_to_cover')} -%>
+ <td class="sep"> </td>
+ <%= render :partial => 'measure', :locals => {:measure => measure('uncovered_conditions'), :title => 'Uncovered conditions', :ratio => measure('conditions_to_cover')} -%>
+ </tr>
+ </table>
<% end %>
- </table>
-
+
<%= render :partial => 'options' -%>
<div class="clear"></div>
</div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb
index 67e1d36eff8..fc97be464c7 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_violations.html.erb
@@ -1,46 +1,88 @@
<div id="violations_header" class="tab_header">
+ <% if @period && measure('new_violations') %>
+ <table class="bottomcol">
+ <tr>
+ <td><span class="big"><%= format_variation('new_violations', :default => 0, :period => @period, :style => 'none') -%></span> new violations</td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/BLOCKER.png' -%></td>
+ <td class="name">Blocker:</td>
+ <td class="value"><%= format_variation('new_blocker_violations', :default => 0, :period => @period, :style => 'none') -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/CRITICAL.png' -%></td>
+ <td class="name">Critical:</td>
+ <td class="value"><%= format_variation('new_critical_violations', :default => 0, :period => @period, :style => 'none') -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/MAJOR.png' -%></td>
+ <td class="name">Major:</td>
+ <td class="value"><%= format_variation('new_major_violations', :default => 0, :period => @period, :style => 'none') -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/MINOR.png' -%></td>
+ <td class="name">Minor:</td>
+ <td class="value"><%= format_variation('new_minor_violations', :default => 0, :period => @period, :style => 'none') -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/INFO.png' -%></td>
+ <td class="name">Info:</td>
+ <td class="value"><%= format_variation('new_info_violations', :default => 0, :period => @period, :style => 'none') -%></td>
+ </tr>
+ </table>
- <table class="bottomcol">
- <tr>
- <td><span class="big"><%= format_measure('violations', :default => 0) -%></span> violations</td>
- </tr>
- </table>
-
- <table class="bottomcol">
- <tr>
- <td><%= image_tag 'priority/BLOCKER.png' -%></td>
- <td class="name">Blocker:</td>
- <td class="value"><%= format_measure('blocker_violations', :default => 0) -%></td>
- </tr>
- </table>
- <table class="bottomcol">
- <tr>
- <td><%= image_tag 'priority/CRITICAL.png' -%></td>
- <td class="name">Critical:</td>
- <td class="value"><%= format_measure('critical_violations', :default => 0) -%></td>
- </tr>
- </table>
- <table class="bottomcol">
- <tr>
- <td><%= image_tag 'priority/MAJOR.png' -%></td>
- <td class="name">Major:</td>
- <td class="value"><%= format_measure('major_violations', :default => 0) -%></td>
- </tr>
- </table>
- <table class="bottomcol">
- <tr>
- <td><%= image_tag 'priority/MINOR.png' -%></td>
- <td class="name">Minor:</td>
- <td class="value"><%= format_measure('minor_violations', :default => 0) -%></td>
- </tr>
- </table>
- <table class="bottomcol">
- <tr>
- <td><%= image_tag 'priority/INFO.png' -%></td>
- <td class="name">Info:</td>
- <td class="value"><%= format_measure('info_violations', :default => 0) -%></td>
- </tr>
- </table>
+ <% else %>
+ <table class="bottomcol">
+ <tr>
+ <td><span class="big"><%= format_measure('violations', :default => 0) -%></span> violations</td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/BLOCKER.png' -%></td>
+ <td class="name">Blocker:</td>
+ <td class="value"><%= format_measure('blocker_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/CRITICAL.png' -%></td>
+ <td class="name">Critical:</td>
+ <td class="value"><%= format_measure('critical_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/MAJOR.png' -%></td>
+ <td class="name">Major:</td>
+ <td class="value"><%= format_measure('major_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/MINOR.png' -%></td>
+ <td class="name">Minor:</td>
+ <td class="value"><%= format_measure('minor_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/INFO.png' -%></td>
+ <td class="name">Info:</td>
+ <td class="value"><%= format_measure('info_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <% end %>
<%= render :partial => 'options' -%>
<div class="clear"></div>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
index ab81eaae342..87460906560 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb
@@ -40,7 +40,7 @@
<% first=false
end %>
- <% if @snapshot.project_snapshot.periods? %>
+ <% if @snapshot.project_snapshot.periods? && !@display_violations %>
<td class="<%= 'first' if first -%>">
<select id="period" name="period" onchange="applyOptions()">
<option value="">Time changes...</option>
@@ -56,6 +56,17 @@
end %>
<% if @display_violations %>
+ <td class="<%= 'first' if first -%>">
+ <select id="period" name="period" onchange="applyOptions()">
+ <option value="">Time changes...</option>
+ <%= violation_period_select_options(@snapshot, 1) -%>
+ <%= violation_period_select_options(@snapshot, 2) -%>
+ <%= violation_period_select_options(@snapshot, 3) -%>
+ <%= violation_period_select_options(@snapshot, 4) -%>
+ <%= violation_period_select_options(@snapshot, 5) -%>
+ </select>
+ </td>
+
<td class="<%= 'first' if first -%>"><%= render :partial => 'rules_filter' -%></td>
<% end %>
</tr>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb
index 900711898b0..0bd942683bd 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb
@@ -1,16 +1,29 @@
<%
- blocker_violations = @snapshot.measure('blocker_violations')
+ if @period
+ blocker_violations = @snapshot.measure('new_blocker_violations')
+ critical_violations = @snapshot.measure('new_critical_violations')
+ major_violations = @snapshot.measure('new_major_violations')
+ minor_violations = @snapshot.measure('new_minor_violations')
+ info_violations = @snapshot.measure('new_info_violations')
+ violation_metric_key='new_violations'
+ else
+ blocker_violations = @snapshot.measure('blocker_violations')
critical_violations = @snapshot.measure('critical_violations')
major_violations = @snapshot.measure('major_violations')
minor_violations = @snapshot.measure('minor_violations')
info_violations = @snapshot.measure('info_violations')
+ violation_metric_key='violations'
+ end
rule_counts={}
rules=[]
- rule_measures=ProjectMeasure.find(:all, :include => 'rule', :conditions => ['metric_id=? AND snapshot_id=? AND rule_id IS NOT NULL AND characteristic_id IS NULL', Metric.by_key('violations').id, @snapshot.id])
+ rule_measures=ProjectMeasure.find(:all, :include => 'rule', :conditions => ['metric_id=? AND snapshot_id=? AND rule_id IS NOT NULL AND characteristic_id IS NULL', Metric.by_key(violation_metric_key).id, @snapshot.id])
rule_measures.each do |rule_measure|
- rule_counts[rule_measure.rule_id]=rule_measure.value.to_i
- rules<<rule_measure.rule
+ count=(@period ? rule_measure.variation(@period) : rule_measure.value)
+ if count && count.to_i>0
+ rule_counts[rule_measure.rule_id]=count.to_i
+ rules<<rule_measure.rule
+ end
end
rule_options=[]
@@ -21,21 +34,50 @@
<select id="rule" name="rule" onchange="applyOptions()">
<option value="">No filters</option>
<optgroup label="Severity">
- <% if blocker_violations && blocker_violations.value>0 %>
- <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>>Blocker (<%= blocker_violations.formatted_value -%>)</option>
- <% end %>
- <% if critical_violations && critical_violations.value>0 %>
- <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>>Critical (<%= critical_violations.formatted_value -%>)</option>
- <% end %>
- <% if major_violations && major_violations.value>0 %>
- <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>>Major (<%= major_violations.formatted_value -%>)</option>
- <% end %>
- <% if minor_violations && minor_violations.value>0 %>
- <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>>Minor (<%= minor_violations.formatted_value -%>)</option>
- <% end %>
- <% if info_violations && info_violations.value>0 %>
- <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>>Info (<%= info_violations.formatted_value -%>)</option>
- <% end %>
+ <% if blocker_violations
+ value=(@period ? blocker_violations.variation(@period) : blocker_violations.value)
+ if value && value>0
+ %>
+ <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>>Blocker (<%= blocker_violations.format_numeric_value(value) -%>)</option>
+ <% end
+ end %>
+
+ <% if critical_violations
+ value=(@period ? critical_violations.variation(@period) : critical_violations.value)
+ if value && value>0
+ %>
+ <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>>Critical (<%= critical_violations.format_numeric_value(value) -%>)</option>
+ <% end
+ end
+ %>
+
+ <% if major_violations
+ value=(@period ? major_violations.variation(@period) : major_violations.value)
+ if value && value>0
+ %>
+ <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>>Major (<%= major_violations.format_numeric_value(value) -%>)</option>
+ <% end
+ end
+ %>
+
+ <% if minor_violations
+ value=(@period ? minor_violations.variation(@period) : minor_violations.value)
+ if value && value>0
+ %>
+ <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>>Minor (<%= minor_violations.format_numeric_value(value) -%>)</option>
+ <% end
+ end
+ %>
+
+ <% if info_violations
+ value=(@period ? info_violations.variation(@period) : info_violations.value)
+ if value && value>0
+ %>
+ <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>>Info (<%= info_violations.format_numeric_value(value) -%>)</option>
+ <% end
+ end
+ %>
+
</optgroup>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb
index e4eb4bc335e..2fe57e4da47 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/index.html.erb
@@ -64,7 +64,7 @@
<% if @display_scm
if current_revision!=line.revision
current_revision=line.revision
- title = "Revision #{h(line.revision)} (#{l(line.datetime)})"
+ title = "Revision #{h(line.revision)} ยป #{l(line.datetime) if line.datetime}"
%>
<td class="scm revision"><span class="date"><a href="#" title="<%= title -%>" alt="<%= title -%>"><%= l(line.date) -%></a></span> <span class="author"><%= h(line.author) -%></span></td>
<% else %>
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index d418289baf0..55d19caca73 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -757,7 +757,7 @@ span.rulename a:hover {
vertical-align: top;
}
.tab_header table.bottomcol {
- margin-right: 20px;
+ margin-right: 10px;
display: inline-block;
vertical-align: bottom;
}