aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorFabrice Bellingard <bellingard@gmail.com>2012-07-11 17:27:12 +0200
committerFabrice Bellingard <bellingard@gmail.com>2012-07-12 10:33:31 +0200
commitabfd8acf57b61da9b4d1a50993a8111493d98602 (patch)
tree5b6d68f1eecf0bdb4a5c448a2a068b0a47879a66 /sonar-server
parentf742c257aed16bcc1794487462331ffafcb15c4a (diff)
downloadsonarqube-abfd8acf57b61da9b4d1a50993a8111493d98602.tar.gz
sonarqube-abfd8acf57b61da9b4d1a50993a8111493d98602.zip
SONAR-2614 Use the ResourceIndex to search for deletable resources
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb19
1 files changed, 12 insertions, 7 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 e7a1619d83f..010a4d31403 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,9 +39,9 @@ class BulkDeletionController < ApplicationController
@should_display_views_tab = Project.count(:all, :conditions => {:qualifier => 'VW'}) > 0
@should_display_devs_tab = Project.count(:all, :conditions => {:qualifier => 'DEV'}) > 0
- # Search for resources
- conditions = "scope=:scope AND qualifier=:qualifier"
- values = {:scope => 'PRJ'}
+ # Search for resources
+ values = {}
+ conditions = "qualifier=:qualifier"
qualifier = 'TRK'
if @selected_tab == 'views'
qualifier = 'VW'
@@ -50,11 +50,16 @@ class BulkDeletionController < ApplicationController
end
values[:qualifier] = qualifier
if params[:name_filter]
- conditions += " AND name LIKE :name"
- values[:name] = '%' + params[:name_filter].strip + '%'
+ conditions += " AND kee LIKE :kee"
+ values[:kee] = '%' + params[:name_filter].strip.downcase + '%'
end
-
- @resources = Project.find(:all, :conditions => [conditions, values], :order => 'name ASC')
+
+ resource_ids = ResourceIndex.find(:all,
+ :select => 'resource_id',
+ :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')
end
end