From: Julien Lancelot Date: Thu, 16 May 2013 15:22:09 +0000 (+0200) Subject: SONAR-4301 Add status and assignee filters on issues search page X-Git-Tag: 3.6~346^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=10446fdfb48efd6b9ca04b21798ff0f75e565b8e;p=sonarqube.git SONAR-4301 Add status and assignee filters on issues search page --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb index db2ec131712..4d896a83f76 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/action_plans.html.erb @@ -67,7 +67,7 @@ <% if unresolved_issues_size == 0 %> <%= unresolved_issues_size -%> <% else %> - 'issues', :action => 'search', :actionPlans => plan.key, :resolved => 'false'}) -%>" title="<%= message('widget.issues_action_plans.x_unresolved_issues', :params => unresolved_issues_size.to_s) -%>"><%= unresolved_issues_size -%> <% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb index 2a39ea58e0c..a34ac48d079 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/issues/unresolved_issues_per_assignee.html.erb @@ -54,7 +54,8 @@ %> - <%= link_to results.user(assignee).name, {:controller => 'issues', :action => 'index', :assignees => assignee}.merge(options) -%> + <%= link_to results.user(assignee).name, + {:controller => 'issues', :action => 'search', :assignees => assignee}.merge(options) -%> <%= '+' if @dashboard_configuration.selected_period? -%><%= count.to_s -%> @@ -73,7 +74,7 @@ <%= link_to message('widget.unresolved_issues_per_assignee.not_assigned'), - {:controller => 'issues', :action => 'index', :assigned => 'false'}.merge(options) -%> + {:controller => 'issues', :action => 'search', :assigned => 'false'}.merge(options) -%> <%= '+' if @dashboard_configuration.selected_period? -%><%= counter_no_assignee.to_s -%> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java index 6937e575686..89d7704c19d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java @@ -332,6 +332,11 @@ public final class CoreMetrics { .create(); public static final String FUNCTION_COMPLEXITY_KEY = "function_complexity"; + + /** + * Information about the cyclomatic complexity per function, calculated by divided the complexity in functions by the number of functions. + * If the complexity in functions is not available, the complexity of the file is used. + */ public static final Metric FUNCTION_COMPLEXITY = new Metric.Builder(FUNCTION_COMPLEXITY_KEY, "Complexity /method", Metric.ValueType.FLOAT) .setDescription("Complexity average by method") .setDirection(Metric.DIRECTION_WORST) diff --git a/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java b/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java index d40ae9a6a37..7c67a7467d5 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java @@ -73,6 +73,10 @@ public class InternalRubyIssueService implements ServerComponent { return issueService.listTransitions(issue); } + public List listStatus() { + return issueService.listStatus(); + } + public Issue doTransition(String issueKey, String transitionKey) { return issueService.doTransition(issueKey, transitionKey, UserSession.get()); } diff --git a/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java b/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java index dd4340c6d7b..8bb17347e1a 100644 --- a/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java +++ b/sonar-server/src/main/java/org/sonar/server/issue/IssueService.java @@ -32,6 +32,7 @@ import org.sonar.core.issue.workflow.Transition; import org.sonar.server.platform.UserSession; import javax.annotation.Nullable; + import java.util.Collections; import java.util.Comparator; import java.util.Date; @@ -142,6 +143,10 @@ public class IssueService implements ServerComponent { return finder.findByKey(issueKey, UserRole.USER); } + public List listStatus(){ + return workflow.statusKeys(); + } + private void verifyLoggedIn(UserSession userSession) { if (!userSession.isLoggedIn()) { // must be logged diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb index 0146b498fef..5cd8168322e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb @@ -20,6 +20,8 @@ class IssuesController < ApplicationController + before_filter :init + def index @filter = IssueFilter.new render :action => 'search' @@ -34,6 +36,11 @@ class IssuesController < ApplicationController private + def init + status = Internal.issues.listStatus() + @options_for_status = status.map {|s| [message('issue.status.' + s), s]} + end + def criteria_params params.merge({:controller => nil, :action => nil, :search => nil, :widget_id => nil, :edit => nil}) 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 1d77704fd0f..28cec85c0a1 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 @@ -650,7 +650,8 @@ module ApplicationHelper user = options[:selected_user] if user - options[:selected_id]=user.login + # the login is a string so it have to be surrounded by quote to be taken in account by select2 + options[:selected_id]="'" + user.login + "'" options[:selected_text]=user.name end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_sidebar.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_sidebar.html.erb index 984fa2c5856..61824824979 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_sidebar.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_sidebar.html.erb @@ -9,6 +9,18 @@ {:width => '100%', :placeholder => message('issue_filter.criteria.severities')}, {:id => 'select-severities', :multiple => true}-%> +
  • + <%= message 'issue_filter.criteria.status' -%>: + <%= dropdown_tag 'statuses[]', options_for_select(@options_for_status, @filter.criteria('statuses')), + {:width => '100%', :placeholder => message('issue_filter.criteria.status')}, + {:id => 'select-status', :multiple => true}-%> +
  • +
  • + <%= message 'issue_filter.criteria.assignee' -%>: + <% selected_user = @filter.issues_result.user(@filter.criteria('assignees')) if @filter.issues_result %> + <%= user_select_tag('assignees', {:selected_user => selected_user, :width => '100%', :placeholder => message('issue_filter.criteria.assignee'), + :html_id => 'select-assignee', :open => false, :allow_clear => true}) -%> +
  • <%= message 'issue_filter.new_search' -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/_progress.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/_progress.html.erb index 0ca29968950..0d666b0c3af 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/_progress.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues_action_plans/_progress.html.erb @@ -1,7 +1,6 @@ <% unless action_plan.totalIssues()==0 - # TODO add links to issues page - options = {:controller => 'issues', :action => 'index', :actionPlans => action_plan.key} + options = {:controller => 'issues', :action => 'search', :actionPlans => action_plan.key} resolved_issues_link = action_plan.resolvedIssues().to_s resolved_issues_link = link_to action_plan.resolvedIssues().to_s, options.merge({:resolved => 'true'}) unless action_plan.resolvedIssues()==0 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb index 9529e928248..32a95978c25 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/project/widgets/issues/_issues_list.html.erb @@ -47,7 +47,7 @@ - <%= link_to(total_number, {:controller => "issues", :action => "index" }.merge(search_options)) %> <%= message('results').downcase -%> + <%= link_to(total_number, {:controller => 'issues', :action => 'search' }.merge(search_options)) -%> <%= message('results').downcase -%> <% if page_count page_count = 20 if page_count>20