From: Julien Lancelot Date: Thu, 23 May 2013 13:29:37 +0000 (+0200) Subject: SONAR-4301 Add resolution on issues search page, add resolution to status index X-Git-Tag: 3.6~292 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4377c13abbc691800ec3299585e2fe14a6b83db5;p=sonarqube.git SONAR-4301 Add resolution on issues search page, add resolution to status index --- diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index 43e989126b6..24bf89edfc5 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -571,16 +571,19 @@ issue_filter.new_search=New search issue_filter.header.action_plan=Action plan issue_filter.header.assignee=Assignee issue_filter.header.creation_date=Creation date +issue_filter.header.resolution=Resolution issue_filter.header.update_date=Update date -issue_filter.criteria.severities=Severities -issue_filter.criteria.project=Project -issue_filter.criteria.status=Status issue_filter.criteria.assignee=Assignee -issue_filter.criteria.reporter=Reporter issue_filter.criteria.created_after=Created since issue_filter.criteria.created_before=Created before issue_filter.criteria.date_format=year-month-day (2013-01-31) +issue_filter.criteria.project=Project +issue_filter.criteria.reporter=Reporter +issue_filter.criteria.resolution=Resolution +issue_filter.criteria.severities=Severities +issue_filter.criteria.status=Status issue_filter.max_results_reached=Only the first {0} issues matching the search criteria have been retrieved. Add some additional criteria to get less results to be able to sort this list. +issue_filter.no_result=No matching issues found. #------------------------------------------------------------------------------ diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index a451c3ce6e6..4273361092d 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -683,7 +683,7 @@ CREATE INDEX "ISSUES_RULE_ID" ON "ISSUES" ("RULE_ID"); CREATE INDEX "ISSUES_SEVERITY" ON "ISSUES" ("SEVERITY"); -CREATE INDEX "ISSUES_STATUS" ON "ISSUES" ("STATUS"); +CREATE INDEX "ISSUES_STATUS_RESOLUTION" ON "ISSUES" ("STATUS", "RESOLUTION"); CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES" ("ASSIGNEE"); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java index 4122e73212a..a517eaa7111 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java @@ -19,6 +19,7 @@ */ package org.sonar.api.issue; +import com.google.common.collect.ImmutableList; import org.sonar.api.rule.RuleKey; import javax.annotation.CheckForNull; @@ -44,6 +45,8 @@ public interface Issue extends Serializable { String RESOLUTION_FIXED = "FIXED"; String RESOLUTION_FALSE_POSITIVE = "FALSE-POSITIVE"; + List RESOLUTIONS = ImmutableList.of(RESOLUTION_FALSE_POSITIVE, RESOLUTION_FIXED); + /** * Unique generated key */ 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 e0ba5b35c0e..c81de2d16df 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 @@ -40,6 +40,7 @@ import org.sonar.server.platform.UserSession; import org.sonar.server.util.RubyUtils; import javax.annotation.Nullable; + import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; @@ -78,6 +79,10 @@ public class InternalRubyIssueService implements ServerComponent { return issueService.listStatus(); } + public List listResolutions() { + return Issue.RESOLUTIONS; + } + public Issue doTransition(String issueKey, String transitionKey) { return issueService.doTransition(issueKey, transitionKey, UserSession.get()); } 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 c954e70c7e3..11241ff6379 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 @@ -23,8 +23,7 @@ class IssuesController < ApplicationController before_filter :init def index - @filter = IssueFilter.new - render :action => 'search' + redirect_to :action => 'search' end def search @@ -39,8 +38,8 @@ class IssuesController < ApplicationController private def init - status = Internal.issues.listStatus() - @options_for_status = status.map {|s| [message('issue.status.' + s), s]} + @options_for_statuses = Internal.issues.listStatus().map {|s| [message('issue.status.' + s), s]} + @options_for_resolutions = Internal.issues.listResolutions().map {|s| [message('issue.resolution.' + s), s]} end def criteria_params diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/issue_filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/issue_filter.rb index 21c884afda8..09423ffc863 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/issue_filter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/issue_filter.rb @@ -73,8 +73,6 @@ class IssueFilter @paging = nil @issues = nil criteria['pageSize'] = 100 - criteria['sort'] ||= 'SEVERITY' - criteria['asc'] ||= 'false' self end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb index 7e57d1e0146..dea011f0b65 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb @@ -31,6 +31,9 @@ <%= column_html(@filter, message('status'), message('status'), 'STATUS') %> + + <%= message('issue_filter.header.resolution') -%> + <%= message('description') -%> @@ -66,7 +69,10 @@ <%= message("issue.status.#{issue.status}") -%> - <%= link_to h(truncate(issue.message, :length => 200)), :controller => 'issue', :action => 'view', :id => issue.key -%> + <%= message("issue.resolution.#{issue.resolution}") if issue.resolution -%> + + + <%= link_to h(truncate(issue.message, :length => 100)), :controller => 'issue', :action => 'view', :id => issue.key -%> <%= h (truncate(@filter.issues_result.project(issue).name, :length => 100)) -%> @@ -106,7 +112,7 @@ <% elsif @filter.issues %> -

<%= message('no_results') -%>

+

<%= message('issue_filter.no_result') -%>

<% 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 7abcd58515b..9a6a66ede1d 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 @@ -25,10 +25,16 @@
  • <%= message 'issue_filter.criteria.status' -%>: - <%= dropdown_tag 'statuses[]', options_for_select(@options_for_status, @filter.criteria('statuses')), + <%= dropdown_tag 'statuses[]', options_for_select(@options_for_statuses, @filter.criteria('statuses')), {:width => '100%', :placeholder => message('issue_filter.criteria.status')}, {:id => 'select-status', :multiple => true}-%>
  • +
  • + <%= message 'issue_filter.criteria.resolution' -%>: + <%= dropdown_tag 'resolutions[]', options_for_select(@options_for_resolutions, @filter.criteria('resolutions')), + {:width => '100%', :placeholder => message('issue_filter.criteria.resolution')}, + {:id => 'select-resolution', :multiple => true}-%> +
  • <%= message 'issue_filter.criteria.assignee' -%>: <% selected_assignee = @filter.issues_result.user(@filter.criteria('assignees')) if @filter.issues_result %> diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/398_create_issues.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/398_create_issues.rb index 4f60847a2cb..beb3811c478 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/398_create_issues.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/398_create_issues.rb @@ -53,14 +53,14 @@ class CreateIssues < ActiveRecord::Migration t.column :updated_at, :datetime, :null => true end - add_index :issues, :kee, :name => 'issues_kee', :unique => true - add_index :issues, :resource_id, :name => 'issues_resource_id' - add_index :issues, :rule_id, :name => 'issues_rule_id' - add_index :issues, :severity, :name => 'issues_severity' - add_index :issues, :status, :name => 'issues_status' - add_index :issues, :assignee, :name => 'issues_assignee' - add_index :issues, :action_plan_key, :name => 'issues_action_plan_key' - add_index :issues, :issue_creation_date, :name => 'issues_creation_date' + add_index :issues, :kee, :name => 'issues_kee', :unique => true + add_index :issues, :resource_id, :name => 'issues_resource_id' + add_index :issues, :rule_id, :name => 'issues_rule_id' + add_index :issues, :severity, :name => 'issues_severity' + add_index :issues, [:status, :resolution], :name => 'issues_status_resolution' + add_index :issues, :assignee, :name => 'issues_assignee' + add_index :issues, :action_plan_key, :name => 'issues_action_plan_key' + add_index :issues, :issue_creation_date, :name => 'issues_creation_date' end end