]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4301 Add resolution on issues search page, add resolution to status index
authorJulien Lancelot <julien.lancelot@gmail.com>
Thu, 23 May 2013 13:29:37 +0000 (15:29 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Thu, 23 May 2013 13:29:37 +0000 (15:29 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
sonar-plugin-api/src/main/java/org/sonar/api/issue/Issue.java
sonar-server/src/main/java/org/sonar/server/issue/InternalRubyIssueService.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/issue_filter.rb
sonar-server/src/main/webapp/WEB-INF/app/views/issues/_list.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/issues/_sidebar.html.erb
sonar-server/src/main/webapp/WEB-INF/db/migrate/398_create_issues.rb

index 43e989126b63e03bdcf4429342998062e1b4f213..24bf89edfc5397fd4fc26002d108cb4d728c631b 100644 (file)
@@ -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.
 
 
 #------------------------------------------------------------------------------
index a451c3ce6e663a2e50a657960b9473aefdc6c091..4273361092d5ac27168273568be9b7f8ba1afcff 100644 (file)
@@ -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");
 
index 4122e73212aa5feb37d17073648e97c3e4424017..a517eaa7111884a8b40690ae279c8e79fad961df 100644 (file)
@@ -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<String> RESOLUTIONS = ImmutableList.of(RESOLUTION_FALSE_POSITIVE, RESOLUTION_FIXED);
+
   /**
    * Unique generated key
    */
index e0ba5b35c0eef06103b4ef2a20772bd943adbac3..c81de2d16df65843c7d4a18c4bdc23e976914909 100644 (file)
@@ -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<String> listResolutions() {
+    return Issue.RESOLUTIONS;
+  }
+
   public Issue doTransition(String issueKey, String transitionKey) {
     return issueService.doTransition(issueKey, transitionKey, UserSession.get());
   }
index c954e70c7e3d782dbaebf85f0f2d5e692f345757..11241ff6379f289982c18da874c152ae756f60fa 100644 (file)
@@ -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
index 21c884afda891e48a06bb39cbbffd1532d35ba90..09423ffc8630b3e044301c218b9706b24b8d93c8 100644 (file)
@@ -73,8 +73,6 @@ class IssueFilter
     @paging = nil
     @issues = nil
     criteria['pageSize'] = 100
-    criteria['sort'] ||= 'SEVERITY'
-    criteria['asc'] ||= 'false'
     self
   end
 
index 7e57d1e0146007c98d5fbfec062b43d6f299823c..dea011f0b658dff136b8ad251ef10943c8c47a54 100644 (file)
@@ -31,6 +31,9 @@
           <th width="1%" nowrap>
             <%= column_html(@filter, message('status'), message('status'), 'STATUS') %>
           </th>
+          <th width="1%" nowrap>
+            <%= message('issue_filter.header.resolution') -%>
+          </th>
           <th>
             <%= message('description') -%>
           </th>
             <%= message("issue.status.#{issue.status}") -%>
           </td>
           <td>
-            <%= link_to h(truncate(issue.message, :length => 200)), :controller => 'issue', :action => 'view', :id => issue.key -%>
+            <%= message("issue.resolution.#{issue.resolution}") if issue.resolution -%>
+          </td>
+          <td>
+            <%= link_to h(truncate(issue.message, :length => 100)), :controller => 'issue', :action => 'view', :id => issue.key -%>
           </td>
           <td>
             <%= h (truncate(@filter.issues_result.project(issue).name, :length => 100)) -%>
 <%
    elsif @filter.issues
 %>
-  <p><%= message('no_results') -%></p>
+  <p><%= message('issue_filter.no_result') -%></p>
 <%
    end
 %>
index 7abcd58515bfea723e41bd6749d0b195f1a9c4e9..9a6a66ede1dfd6fae180bd0e3e01434da9daca89 100644 (file)
     </li>
     <li id="criteria-status" class="marginbottom5">
       <%= 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}-%>
     </li>
+    <li id="criteria-resolution" class="marginbottom5">
+      <%= 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}-%>
+    </li>
     <li>
       <%= message 'issue_filter.criteria.assignee' -%>:
       <% selected_assignee = @filter.issues_result.user(@filter.criteria('assignees')) if @filter.issues_result %>
index 4f60847a2cbf1d6d823a7a50970850a70194ca61..beb3811c47880e6ecde5997556bcdf5178fe16c1 100644 (file)
@@ -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