From: Fabrice Bellingard Date: Thu, 26 May 2011 15:53:53 +0000 (+0200) Subject: SONAR-2388 Make it possible to search for 'false-positive' reviews X-Git-Tag: 2.9~139 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=aa2b9116625c1bcb08da5ba0858c035f847eaa26;p=sonarqube.git SONAR-2388 Make it possible to search for 'false-positive' reviews - Adds select box on the search page - Change comment icon color if false-positive - Add "False positive" label on the permalink page - Adjust link that opens the resource to directly open the resource viewer on the false-positives --- 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 ddf519dca1e..5062feb382d 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 @@ -272,7 +272,8 @@ class ReviewsController < ApplicationController @severities = filter_any(params[:severities]) || [''] @statuses = filter_any(params[:statuses]) || [Review::STATUS_OPEN] @projects = filter_any(params[:projects]) || [''] - @id = params[:review_id] || "" + @false_positives = params[:false_positives] || 'without' + @id = params[:review_id] || '' @sort = params[:sort] @asc = params[:asc] == "true" end @@ -285,7 +286,7 @@ class ReviewsController < ApplicationController end def search_reviews - options = { 'false_positives' => 'without' } + options = {} unless @statuses == [''] options['statuses']=@statuses.join(',') end @@ -301,6 +302,9 @@ class ReviewsController < ApplicationController if @assignee_id options['assignees']=@assignee_id.to_s end + if @false_positives + options['false_positives']=@false_positives + end unless @id == '' if is_number? @id options['id'] = @id 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 ccc33e692ff..2922bcf0c92 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 @@ -315,13 +315,13 @@ module ApplicationHelper period_index=nil if period_index && period_index<=0 if resource.display_dashboard? if options[:dashboard] - link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab]}}, :title => options[:title]) + link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title]) else # stay on the same page (for example components) - link_to(name || resource.name, {:overwrite_params => {:id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab]}}, :title => options[:title]) + link_to(name || resource.name, {:overwrite_params => {:id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title]) end else - link_to(name || resource.name, {:controller => 'resource', :action => 'index', :id => resource.id, :period => period_index, :tab => options[:tab]}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title]) + link_to(name || resource.name, {:controller => 'resource', :action => 'index', :id => resource.id, :period => period_index, :tab => options[:tab], :rule => options[:rule]}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title]) end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/users_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/users_helper.rb index a99f1fd7b30..7999bc9c69d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/users_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/users_helper.rb @@ -117,11 +117,14 @@ module UsersHelper # field that is submitted is a hidden one that contains the user ID that corresponds # to the typed name (if the user exists, of course). # + # The 'options' argument can be used to pass HTML elements to the text field. + # (for the moment 'class' is supported). + # # Example: # <%= user_autocomplete_field "assignee_id", @assignee_id -%> # # => generates an input field for the parameter 'assignee_id' # - def user_autocomplete_field(param_id, param_value) + def user_autocomplete_field(param_id, param_value, options={}) param_id_name = param_id param_id_value = param_value @@ -134,7 +137,8 @@ module UsersHelper server_url = url_for :controller => 'users', :action => 'autocomplete' render :partial => 'autocomplete/text_field', :locals => {:param_id_name => param_id_name, :param_id_value => param_id_value, - :param_displayed_value => param_displayed_value, :server_url => server_url } + :param_displayed_value => param_displayed_value, :server_url => server_url, + :options => options.to_options} end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb index 8675ee22515..2e9b6f047e7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/autocomplete/_text_field.html.erb @@ -1,4 +1,8 @@ - + />