]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 Bulk action on found rules
authorStas Vilchik <vilchiks@gmail.com>
Tue, 25 Mar 2014 06:31:31 +0000 (12:31 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 25 Mar 2014 06:31:31 +0000 (12:31 +0600)
sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee
sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee
sonar-server/src/main/webapp/less/style.less
sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs

index 3afb06156239b33d6e7f6162277f7dc7259dd068..881b70c6293d36ffde0bebba572fdd3f725d7060 100644 (file)
@@ -16,8 +16,8 @@ define [
 
 
     doAction: (e) ->
-      action = jQuery(e.target).data 'action'
-      param = jQuery(e.target).data 'param'
+      action = jQuery(e.currentTarget).data 'action'
+      param = jQuery(e.currentTarget).data 'param'
       unless param
         @options.app.codingRulesBulkChangeView.show action
       else
index dd341022c71b4c2c44e8ceaf453dc49caf70b2cc..144cbfafb37ce9c551167f0871dc5e8ad78f0c00 100644 (file)
@@ -14,7 +14,6 @@ define [
     events:
       'submit form': 'onSubmit'
       'click #coding-rules-cancel-bulk-change': 'hide'
-      'click label': 'enableAction'
       'change select': 'enableAction'
 
 
@@ -56,10 +55,23 @@ define [
 
     prepareQuery: ->
       query = @options.app.getQuery()
-      switch @action
-        when 'activate' then _.extend query, bulk_activate: @$('#coding-rules-bulk-change-activate-on').val()
-        when 'deactivate' then _.extend query, bulk_deactivate: @$('#coding-rules-bulk-change-deactivate-on').val()
-        when 'change-severity' then _.extend query, bulk_change_severity: @$('#coding-rules-bulk-change-severity').val()
+
+      if @action == 'activate'
+        if @$('#coding-rules-bulk-change-activate-all').is ':checked'
+          _.extend query, bulk_activate: _.pluck @options.app.qualityProfiles, 'key'
+        else
+          _.extend query, bulk_activate: @$('#coding-rules-bulk-change-activate-on').val()
+
+      if @action == 'deactivate'
+        if @$('#coding-rules-bulk-change-deactivate-all').is ':checked'
+          _.extend query, bulk_deactivate: _.pluck @options.app.qualityProfiles, 'key'
+        else
+          _.extend query, bulk_deactivate: @$('#coding-rules-bulk-change-deactivate-on').val()
+
+      if @action == 'change-severity'
+        _.extend query, bulk_change_severity: @$('#coding-rules-bulk-change-severity').val()
+
+      query
 
 
     bulkChange: (query) ->
@@ -70,16 +82,12 @@ define [
       .done =>
         @options.app.fetchFirstPage()
 
+
     onSubmit: (e) ->
       e.preventDefault()
       @bulkChange(@prepareQuery()).done => @hide()
 
 
-
-    enableAction: (e) ->
-      jQuery(e.target).siblings('input[type=checkbox]').prop 'checked', true
-
-
     serializeData: ->
       action: @action
 
index 6c1aec34cd8319fc08af05b7c879e0120953ca5d..28d386b2c3da690a0fdeb3e1c66ec7c2545cd082 100644 (file)
@@ -2460,6 +2460,16 @@ ul.modal-head-metadata li {
   word-wrap: break-word;
   position: relative;
   padding-top: 5px;
+
+  &.simple-label {
+    display: inline-block;
+    vertical-align: middle;
+    float: none;
+    position: static;
+    margin: 0 0 0 -5px;
+    padding: 0;
+    text-align: left;
+  }
 }
 
 .modal-field input {
index ff7157676cf5a51b70661aadd396b6b5e9170094..0e3c9e7d54cdbc1c7f6eb7d31370d2d760325393 100644 (file)
@@ -22,6 +22,8 @@
             <option value="{{key}}">{{name}} ({{lang}})</option>
           {{/each}}
         </select>
+        <input id="coding-rules-bulk-change-activate-all" type="checkbox">
+        <label class="simple-label" for="coding-rules-bulk-change-activate-all">{{t 'all'}}</label>
       </div>
     {{/eq}}
 
@@ -33,6 +35,8 @@
             <option value="{{key}}">{{name}} ({{lang}})</option>
           {{/each}}
         </select>
+        <input id="coding-rules-bulk-change-deactivate-all" type="checkbox">
+        <label class="simple-label" for="coding-rules-bulk-change-deactivate-all">{{t 'all'}}</label>
       </div>
     {{/eq}}