aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2012-11-26 10:11:19 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2012-11-26 10:11:19 +0100
commita10b584e060f42b1c3e325e07853f643681d5b32 (patch)
tree1f1035bc3438e44a7a0834e10ff5cfd1f613565c
parentaff5bdd7ca4bdd5f435f00ec3469340beb14f086 (diff)
downloadsonarqube-a10b584e060f42b1c3e325e07853f643681d5b32.tar.gz
sonarqube-a10b584e060f42b1c3e325e07853f643681d5b32.zip
SONAR-3805 Cannot load the project bulk deletion page when there are more than 1,000 projects
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/project.rb1
2 files changed, 11 insertions, 9 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb
index 9cac2bb2a87..e6ba328970d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb
@@ -39,19 +39,20 @@ class BulkDeletionController < ApplicationController
@selected_tab = 'TRK' unless @tabs.include?(@selected_tab)
# Search for resources
- conditions = "qualifier=:qualifier"
+ conditions = "resource_index.qualifier=:qualifier"
values = {:qualifier => @selected_tab}
if params[:name_filter] && !params[:name_filter].blank?
- conditions += " AND kee LIKE :kee"
+ conditions += " AND resource_index.kee LIKE :kee"
values[:kee] = params[:name_filter].strip.downcase + '%'
end
-
- resource_ids = ResourceIndex.find(:all,
- :select => 'distinct(resource_id),name_size',
- :conditions => [conditions, values],
- :order => 'name_size').map {|rid| rid.resource_id}.uniq
-
- @resources = Project.find(:all, :conditions => ['id in (?) and enabled=?', resource_ids, true], :order => 'name ASC')
+
+ conditions += " AND projects.enabled=:enabled"
+ values[:enabled] = true
+ @resources = Project.find(:all,
+ :select => 'distinct(resource_index.resource_id),projects.id,projects.name,projects.kee',
+ :conditions => [conditions, values],
+ :joins => :resource_index,
+ :order => 'projects.name ASC')
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
index 902ad57de75..e37e69b3c8a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb
@@ -33,6 +33,7 @@ class Project < ActiveRecord::Base
belongs_to :person, :class_name => 'Project', :foreign_key => 'person_id'
has_many :authors, :foreign_key => 'person_id', :dependent => :delete_all
has_one :index, :class_name => 'ResourceIndex', :foreign_key => 'resource_id', :conditions => 'position=0', :select => 'kee'
+ has_many :resource_index, :foreign_key => 'resource_id'
def self.by_key(k)
begin