]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5135 Fix availability of bulk operations
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Jun 2014 14:46:07 +0000 (16:46 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 11 Jun 2014 14:46:13 +0000 (16:46 +0200)
sonar-server/src/main/coffee/coding-rules/views/coding-rules-bulk-change-dropdown-view.coffee
sonar-server/src/main/coffee/coding-rules/views/filters/activation-filter-view.coffee
sonar-server/src/main/hbs/coding-rules/coding-rules-bulk-change-dropdown.hbs

index 865a7435546de826227b1e6017da0b28b1e18c2f..50ca633e694d6945c15bc9ac3e9d5e2388822b87 100644 (file)
@@ -44,9 +44,13 @@ define [
 
     serializeData: ->
       languages = @options.app.languageFilter.get('value')
-      activation = @options.app.activationFilter.get('value')
-      qualityProfile: @options.app.getQualityProfile()
+      activationValues = @options.app.activationFilter.get('value') or []
+      qualityProfile = @options.app.getQualityProfile()
+
+      qualityProfile: qualityProfile
       qualityProfileName: @options.app.qualityProfileFilter.view.renderValue()
-      singleLanguage: _.isArray(languages) && languages.length == 1
+      singleLanguage: _.isArray(languages) and languages.length == 1
       language: @options.app.languageFilter.view.renderValue()
-      activation: activation && activation.length == 1 && activation[0]
+      allowActivateOnProfile: qualityProfile and (activationValues.length == 0 or activationValues[0] == 'false')
+      allowDeactivateOnProfile: qualityProfile and (activationValues.length == 0 or activationValues[0] == 'true')
+      allowChangeSeverity: qualityProfile and activationValues.length > 0 and activationValues[0] == 'true'
index c1d274dba80b95afa8c445a7ad8edd5e4b9c64d4..7748b353fbe7777de7b82d213b17968e899b5aed 100644 (file)
@@ -29,7 +29,7 @@ define [
       @model.trigger 'change:enabled'
       unless @model.get 'value'
         @choices.each (model) -> model.set 'checked', model.id == 'true'
-        @model.set 'value', [true]
+        @model.set 'value', ['true']
       @$el.removeClass('navigator-filter-inactive').prop 'title', ''
       @options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
       @hideDetails()
index f0fd7ea9316a5dd2bdfec9c109bfc9523aadbd3a..9d17125884c7ebcd1d8300cfae9ff919abc73d8b 100644 (file)
@@ -1,39 +1,35 @@
 {{! activation }}
 
-{{#notEq activation 'false'}}
-  <a class="coding-rules-bulk-change-dropdown-link" data-action="activate">
-    {{t 'coding_rules.activate_in'}}
-  </a>
-{{/notEq}}
+<a class="coding-rules-bulk-change-dropdown-link" data-action="activate">
+  {{t 'coding_rules.activate_in'}}&#8230;
+</a>
 
-{{#eq activation 'false'}}
+{{#if allowActivateOnProfile}}
   <a class="coding-rules-bulk-change-dropdown-link" data-action="activate" data-param="{{qualityProfile}}">
     {{t 'coding_rules.activate_in'}} <strong>{{qualityProfileName}}</strong>
   </a>
-{{/eq}}
+{{/if}}
 
 
 
 {{! deactivation }}
 
-{{#notEq activation 'true'}}
-  <a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate">
-    {{t 'coding_rules.deactivate_in'}}
-  </a>
-{{/notEq}}
+<a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate">
+  {{t 'coding_rules.deactivate_in'}}&#8230;
+</a>
 
-{{#eq activation 'true'}}
+{{#if allowDeactivateOnProfile}}
   <a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate" data-param="{{qualityProfile}}">
     {{tp 'coding_rules.deactivate_in'}} <strong>{{qualityProfileName}}</strong>
   </a>
-{{/eq}}
+{{/if}}
 
 
 
 {{! severity }}
 
-{{#eq activation 'true'}}
+{{#if allowChangeSeverity}}
   <a class="coding-rules-bulk-change-dropdown-link" data-action="change-severity" data-param="{{qualityProfile}}">
     {{t 'coding_rules.change_severity_in'}} <strong>{{qualityProfileName}}</strong>
   </a>
-{{/eq}}
+{{/if}}