]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3714 add first screen of bulk change
authorJulien Lancelot <julien.lancelot@gmail.com>
Fri, 21 Jun 2013 15:38:26 +0000 (17:38 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Fri, 21 Jun 2013 15:38:26 +0000 (17:38 +0200)
plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties
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/views/issues/_bulk_change_form.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
sonar-server/src/test/java/org/sonar/server/issue/InternalRubyIssueServiceTest.java

index 7528990291e44c7614fcb08d01b818ea5b170600..53f55b0016244331e68cb3c3f5dcfa4e8c664646 100644 (file)
@@ -547,6 +547,7 @@ issue_filter.private=Private
 issue_filter.shared_with_all_users=Shared with all users
 issue_filter.sharing=Sharing
 issue_filter.manage.shared_filters=Shared Filters
+issue_filter.bulk_change=Bulk change
 
 #------------------------------------------------------------------------------
 #
index d3b9ca5d0cbb173edc371eeb562ef9f717d3638d..72c6a60ea333f602f31ee515e7e7fd5055fe7567 100644 (file)
@@ -588,7 +588,7 @@ public class InternalRubyIssueService implements ServerComponent {
   /**
    * Execute a bulk change
    */
-  public Result<List<Issue>> executebulkChange(Map<String, Object> props) {
+  public Result<List<Issue>> executeBulkChange(Map<String, Object> props) {
     Result<List<Issue>> result = Result.of();
     try {
       IssueBulkChangeQuery issueBulkChangeQuery = toIssueBulkChangeQuery(props);
index f5a0ee450d381a98f51686789ea7c80efe0ac855..a40844c658301fe8e27171ad4940494368ebf297 100644 (file)
@@ -178,6 +178,12 @@ class IssuesController < ApplicationController
     end
   end
 
+  # GET /issues/bulk_change_form?[&criteria]
+  def bulk_change_form
+
+    render :partial => 'issues/bulk_change_form'
+  end
+
 
   private
 
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
new file mode 100644 (file)
index 0000000..0f23790
--- /dev/null
@@ -0,0 +1,17 @@
+<form id="bulk-change-form" method="post" action="<%= ApplicationController.root_context -%>/issues/bulk_change">
+  <input type="hidden" name="data" value="<%= params[:data] || u(@filter_query_serialized) -%>">
+  <fieldset>
+    <div class="modal-head">
+      <h2><%= message('issue_filter.bulk_change') -%></h2>
+    </div>
+    <div class="modal-foot">
+      <input type="submit" value="<%= message('submit') -%>" id="bulk-change-submit"/>
+      <a href="#" onclick="return closeModalWindow()" id="bulk-change-cancel"><%= message('cancel') -%></a>
+    </div>
+  </fieldset>
+</form>
+<script>
+  $j("#bulk-change-form").modalForm({success:function (data) {
+    window.location = baseUrl + '/issues/filter/' + data;
+  }});
+</script>
\ No newline at end of file
index 4b49d74a11c425a810d542d7330c418731a99a42..21b9303d8e8bbcfeb2676e14d6b1fd5eca30983b 100644 (file)
@@ -23,6 +23,9 @@
                 <a id="save-as" href="<%= url_for params.merge({:action => 'save_as_form'}) -%>" class="link-action open-modal"><%= message('save_as') -%></a>
               </li>
             <% end %>
+            <!--<li>-->
+              <!--<a id="bulk-change" href="<%= url_for params.merge({:action => 'bulk_change_form'}) -%>" class="link-action open-modal"><%= message('bulk_change') -%></a>-->
+            <!--</li>-->
           </ul>
 
           <div class="page_title" id="filter-title">
index bd53b68fce5ae1343fee7c64f70c26cbc77bd2fa..47c70fb907684b57dcf0b0e730c33a90180bc256 100644 (file)
@@ -534,7 +534,7 @@ public class InternalRubyIssueServiceTest {
 
   @Test
   public void should_execute_bulk_change() {
-    service.executebulkChange(Maps.<String, Object>newHashMap());
+    service.executeBulkChange(Maps.<String, Object>newHashMap());
     verify(issueBulkChangeService).execute(any(IssueBulkChangeQuery.class), any(UserSession.class));
   }
 
@@ -542,7 +542,7 @@ public class InternalRubyIssueServiceTest {
   public void should_no_execute_bulk_change_if_unexpected_error() {
     doThrow(new RuntimeException("Error")).when(issueBulkChangeService).execute(any(IssueBulkChangeQuery.class), any(UserSession.class));
 
-    Result result = service.executebulkChange(Maps.<String, Object>newHashMap());
+    Result result = service.executeBulkChange(Maps.<String, Object>newHashMap());
     assertThat(result.ok()).isFalse();
     assertThat(((Result.Message) result.errors().get(0)).text()).contains("Error");
   }