diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2011-04-20 15:24:07 +0200 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2011-04-20 15:25:23 +0200 |
commit | 033b6d93dcf2ef91b481fc242ec724902dbd75e1 (patch) | |
tree | 9849a667f1705005cdd0f66ce5884fe1733f6183 /sonar-server | |
parent | 301caf419f04d6209bb95d2f5616302bbe68ac62 (diff) | |
download | sonarqube-033b6d93dcf2ef91b481fc242ec724902dbd75e1.tar.gz sonarqube-033b6d93dcf2ef91b481fc242ec724902dbd75e1.zip |
SONAR-1973 Add possibility to show only switched-off violations
Diffstat (limited to 'sonar-server')
3 files changed, 15 insertions, 2 deletions
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 bc4d569dd8d..e9cf723d21d 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,7 +171,7 @@ class ResourceController < ApplicationController @expandable=(@lines!=nil) @filtered=!@expanded - conditions='switched_off is not true AND snapshot_id=?' + conditions='snapshot_id=?' values=[@snapshot.id] unless params[:rule].blank? severity=Sonar::RulePriority.id(params[:rule]) @@ -194,6 +194,15 @@ class ResourceController < ApplicationController conditions+=' AND id=-1' end end + + if params[:switchedOff] + @switchedOff=true + conditions+='AND switched_off=?' + values<<true + else + conditions+='AND (switched_off IS NULL OR switched_off=?)' + values<<false + end RuleFailure.find(:all, :include => ['rule', 'reviews' ], :conditions => [conditions] + values, :order => 'failure_level DESC').each do |violation| # sorted by severity => from blocker to info diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb index ca8ef32259a..a0efbef1645 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb @@ -199,7 +199,7 @@ class ReviewsController < ApplicationController def add_all_users ( user_options ) User.find( :all ).each do |user| userName = user.name - if current_user.id == user.id + if current_user && current_user.id == user.id userName = "Me (" + user.name + ")" end user_options << [userName, user.id.to_s] 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 7e765102206..e1594d7d441 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 @@ -50,6 +50,10 @@ <% if @display_violations %> <td class="<%= 'first' if first -%>"> + <input type="checkbox" value="true" name="switchedOff" id="switchedOff" <%= 'checked' if @switchedOff -%> onclick="applyOptions()"/> + <label for="expand">Show only switched-off violations</label> + </td> + <td class="<%= 'first' if first -%>"> <select id="period" name="period" onchange="applyOptions()"> <option value="">Time changes...</option> <%= violation_period_select_options(@snapshot, 1) -%> |