From: Jean-Baptiste Vilain Date: Tue, 23 Jul 2013 15:50:27 +0000 (+0200) Subject: SONAR-4453 Notify user when the selection exceeds the max number of projects updatabl... X-Git-Tag: 3.7~22 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c2f09598513b1883198a9cda86495335f9dc4932;p=sonarqube.git SONAR-4453 Notify user when the selection exceeds the max number of projects updatable in a row --- 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 38febb52930..6c511ff2322 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 @@ -2263,6 +2263,7 @@ projects_role.bulk_change=Bulk Change projects_role.apply_template=Apply Permission Template projects_role.apply_template_to_xxx=Apply Permission Template To "{0}" projects_role.no_projects=There are currently no results to apply the permission template to. +projects_role.exceeds_projects_limit_xxx=The current selection exceeds the limit of {0} projects that can be updated in a row. Please narrow your search before applying the permission template. diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb index 4bc03f900c2..8c935f270ee 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/roles_controller.rb @@ -21,6 +21,7 @@ class RolesController < ApplicationController helper RolesHelper SECTION=Navigation::SECTION_CONFIGURATION + BULK_LIMIT=1 before_filter :admin_required verify :method => :post, :only => [:set_users, :set_groups], :redirect_to => {:action => 'global'} @@ -85,11 +86,17 @@ class RolesController < ApplicationController params['qualifiers'] ||= 'TRK' params['pageSize'] = 500 - @query_result = Internal.component_api.find(params).components().to_a - @projects_ids = @query_result.collect{|component| component.getId()} + query_result = Internal.component_api.find(params) + components = query_result.components().to_a + total_results_count = query_result.paging.total.to_i + + @projects_ids = components.collect{|component| component.getId()} + @qualifier = params[:qualifiers] render :partial => 'apply_template_form', - :locals => {:components => @projects_ids, :project_name => @query_result.size == 1 ? @query_result[0].name : nil, :qualifier => params[:qualifiers]} + :locals => {:project_name => components.size == 1 ? components[0].name : nil, + :empty => @projects_ids.nil? || @projects_ids.size == 0, + :overflow => total_results_count > BULK_LIMIT} end # POST /roles/apply_template?criteria diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb index 338e287b279..c8796ae10eb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/_apply_template_form.html.erb @@ -1,6 +1,6 @@
- <% unless components.nil? %> - + <% unless @projects_ids.nil? %> + <% end %>