aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2011-12-23 11:02:36 +0100
committerFabrice Bellingard <bellingard@gmail.com>2011-12-23 11:03:34 +0100
commit5d6ab3e62e41fc1d9928156557c96c301bc50ce5 (patch)
tree55ae1ce9c9103fcc29d69ee5c85ea9bb16e6e663 /sonar-server
parentad8ee64ba4e06795cbc8939e623ebbad0b174acb (diff)
downloadsonarqube-5d6ab3e62e41fc1d9928156557c96c301bc50ce5.tar.gz
sonarqube-5d6ab3e62e41fc1d9928156557c96c301bc50ce5.zip
SONAR-2662 Show filters on the review listing page
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb16
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb22
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb31
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb12
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css20
5 files changed, 83 insertions, 18 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
index 50ba007ca1a..5990f4ebc88 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/project_reviews_controller.rb
@@ -31,13 +31,17 @@ class ProjectReviewsController < ApplicationController
# lists all the reviews of a project, filtered using the same parameters as for the review WS API
def index
@project=Project.by_key(params[:projects])
- not_found("Project not found") unless @project
- access_denied unless has_role?(:user, @project)
- found_reviews = Review.search(params)
- @reviews = select_authorized(:user, found_reviews, :project)
- if found_reviews.size != @reviews.size
- @security_exclusions = true
+ if @project
+ access_denied unless has_role?(:user, @project)
+
+ found_reviews = Review.search(params)
+ @reviews = select_authorized(:user, found_reviews, :project)
+ if found_reviews.size != @reviews.size
+ @security_exclusions = true
+ end
+ else
+ render :text => "<b>Listing reviews without a project reference is not possible</b>. Go to review search service instead."
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 871d6041a0b..a240ff1a26a 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
@@ -592,5 +592,27 @@ module ApplicationHelper
html
end
+
+ #
+ # Used on the reviews listing page (http://localhost:9000/project_reviews)
+ # Prints a label for the given parameter that is used to filter the review list.
+ # The label has:
+ # * a name (=the param name) with a tooltip (=the param value)
+ # * a 'x' action to remove this filter
+ #
+ # === Optional parameters
+ # * title: to overwrite the tooltip of the parameter
+ #
+ def review_filter_tag(param_name, params, options={})
+ html = "<span class=\"review-filter\" title=\""
+ html += options[:title] ? options[:title] : params[param_name]
+ html += "\">"
+ html += message('reviews.filtered_by.' + param_name)
+ html += "<a href=\""
+ html += url_for params.reject{|p| p[0]==param_name}
+ html += "\" title=\""
+ html += message('reviews.remove_this_filter')
+ html += "\">X</a></span>"
+ end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb
index 0b00d367835..4ba5a989c34 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/index.html.erb
@@ -5,6 +5,37 @@
<div id="reviews-search">
<h1><%= message('reviews') -%></h1>
+ <div class="review-filters">
+ <%= message('reviews.filtered_by') -%>:
+ <% if params[:statuses] %>
+ <%= review_filter_tag 'statuses', params -%>
+ <% end %>
+ <% if params[:resolutions] %>
+ <%= review_filter_tag 'resolutions', params -%>
+ <% end %>
+ <% if params[:severities] %>
+ <%= review_filter_tag 'severities', params -%>
+ <% end %>
+ <% if params[:authors] %>
+ <%= review_filter_tag 'authors', params -%>
+ <% end %>
+ <% if params[:assignees] %>
+ <%= review_filter_tag 'assignees', params, {:title => params[:assignees].size()==0 ? message('none') : params[:assignees]} -%>
+ <% end %>
+ <% if params[:action_plan_id] %>
+ <%= review_filter_tag 'action_plan_id', params, {:title => ActionPlan.find(params[:action_plan_id]).name} -%>
+ <% end %>
+ <% if params[:unplanned] %>
+ <%= review_filter_tag 'unplanned', params -%>
+ <% end %>
+ <% if params[:from] %>
+ <%= review_filter_tag 'from', params, {:title => l(DateTime.parse(params[:from]))} -%>
+ <% end %>
+ <% if params[:to] %>
+ <%= review_filter_tag 'to', params, {:title => l(DateTime.parse(params[:to]))} -%>
+ <% end %>
+ </div>
+
<%= render :partial => "reviews/list" -%>
</div> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb
index 97c0e647779..d41b13667bf 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_list.html.erb
@@ -1,16 +1,4 @@
<%
- if params[:from] && params[:to]
- from = Time.parse(params[:from])
- to = Time.parse(params[:to])
- %>
- <div style="color:#777777; font-size:93%; padding: 4px 0px 4px 10px;">
- <span style="background-color: #FFF6BF; padding-left: 5px; padding-right: 5px;">
- <%= message('reviews.reviews_filtered_by_date_x_to_y', :params => [l(from, :format => '%d %B %Y'), l(to, :format => '%d %B %Y')]) -%>
- </span>
- </div>
- <% end %>
-
- <%
if @reviews && !@reviews.empty?
%>
<table id="reviews-list" class="data width100">
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index 07b72ba83a8..3fc715299b6 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -1188,6 +1188,26 @@ div.comment-excerpt {
font-size: 90%;
}
+div.review-filters {
+ font-size: 93%;
+ margin: 10px;
+}
+
+span.review-filter {
+ background-color: #CAE3F2;
+ padding-left: 5px;
+ padding-right: 5px;
+ margin-left: 5px;
+}
+
+span.review-filter a {
+ color: #777777;
+ font-size: 80%;
+ margin-left: 6px;
+ text-decoration: none;
+ text-shadow: 1px 1px 0 #FFFFFF;
+}
+
/* ACTION PLANS */
table.actionPlans {
margin-top: 10px;