]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3714 Execute bulk change from form
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 25 Jun 2013 15:38:07 +0000 (17:38 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 25 Jun 2013 15:38:07 +0000 (17:38 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/issues_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb

index 3bf89be75720c67199fcd21ef64995cd56d736ad..ee7789ab664c56a42817858b315b8bc2a56dd21a 100644 (file)
@@ -183,22 +183,26 @@ class IssuesController < ApplicationController
   def bulk_change_form
 
     # Load maximum number of issues
-    @criteria_params = criteria_params
+    @criteria_params = criteria_params_to_save
     @criteria_params['pageSize'] = -1
     issue_filter_result = Internal.issues.execute(@criteria_params)
     @issue_query = issue_filter_result.query
     @issues_result = issue_filter_result.result
 
-    @issue_keys = @issues_result.issues.map {|issue| issue.key()}.join(',')  if !@issues_result.issues.empty?
-
+    @issue_keys = @issues_result.issues.map {|issue| issue.key()}.join(',') unless @issues_result.issues.empty?
     render :partial => 'issues/bulk_change_form'
   end
 
   # POST /issues/bulk_change
   def bulk_change
     verify_post_request
-
-    render :text => '', :status => 200
+    result = Internal.issues.bulkChange(params, "")
+    if result.ok
+      render :text => params[:criteria_params], :status => 200
+    else
+      @errors = result.errors
+      render :partial => 'issues/bulk_change_form', :status => 400
+    end
   end
 
 
index ee68ea1d92d8d71d106e32801a35f2da9876402c..3a80795c07b0bf332021b5c681b42e5c59ba67a0 100644 (file)
@@ -1,5 +1,6 @@
 <form id="bulk-change-form" method="post" action="<%= ApplicationController.root_context -%>/issues/bulk_change">
   <input type="hidden" name="issues" value="<%= @issue_keys -%>">
+  <input type="hidden" name="criteria_params" value="<%= @criteria_params.to_query -%>">
   <fieldset>
     <div class="modal-head">
       <h2><%= message('issue_filter.bulk_change.form.title', {:params => @issues_result.issues.size.to_s}) -%></h2>
@@ -58,6 +59,6 @@
 </form>
 <script>
   $j("#bulk-change-form").modalForm({success:function (data) {
-    window.location = baseUrl + '/issues/search/' + data;
+    window.location = baseUrl + '/issues/search?' + data;
   }});
 </script>
\ No newline at end of file