aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-03-25 12:31:31 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-03-25 12:31:31 +0600
commit88683a0b5fc278840fae7ec97271368f3217066e (patch)
tree2cf2fa16ec6a1ee26e14c9767219e337c1242745
parent52054f027f607fa47ac5f3b94e4fa237857d81a8 (diff)
downloadsonarqube-88683a0b5fc278840fae7ec97271368f3217066e.tar.gz
sonarqube-88683a0b5fc278840fae7ec97271368f3217066e.zip
SONAR-5007 Bulk action on found rules
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee4
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee28
-rw-r--r--sonar-server/src/main/webapp/less/style.less10
-rw-r--r--sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs4
4 files changed, 34 insertions, 12 deletions
diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee
index 3afb0615623..881b70c6293 100644
--- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee
+++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee
@@ -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
diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee
index dd341022c71..144cbfafb37 100644
--- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee
+++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee
@@ -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
diff --git a/sonar-server/src/main/webapp/less/style.less b/sonar-server/src/main/webapp/less/style.less
index 6c1aec34cd8..28d386b2c3d 100644
--- a/sonar-server/src/main/webapp/less/style.less
+++ b/sonar-server/src/main/webapp/less/style.less
@@ -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 {
diff --git a/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs b/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs
index ff7157676cf..0e3c9e7d54c 100644
--- a/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs
+++ b/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-bulk-change.hbs
@@ -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}}