]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 SONAR-5137 Link activate/deactivate buttons
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 21 May 2014 14:55:58 +0000 (16:55 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 21 May 2014 14:56:12 +0000 (16:56 +0200)
sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-quality-profile-view.coffee
sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-quality-profiles-view.coffee
sonar-server/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee
sonar-server/src/main/coffee/coding-rules/views/coding-rules-quality-profile-activation-view.coffee
sonar-server/src/main/hbs/coding-rules/coding-rules-detail-quality-profile.hbs

index 3974e84236b578f10f945cd3ffc6da9edd35119e..a56c7df47d4e12ef315371d82093a9e18107f09b 100644 (file)
@@ -46,7 +46,14 @@ define [
 
     deactivate: ->
       if confirm t 'are_you_sure'
-        @model.destroy()
+        jQuery.ajax
+          type: 'POST'
+          url: "#{baseUrl}/api/qualityprofiles/deactivate_rule"
+          data:
+            profile_key: @model.get('qProfile')
+            rule_key: @options.rule.get('key')
+        .done =>
+          @model.destroy()
 
 
     enableUpdate: ->
index 71b0b311062683f746b3084db20b28b22d94ff87..1a5a9f69462420dc812aebb18d8972bfeb2dc622 100644 (file)
@@ -11,4 +11,5 @@ define [
 
     itemViewOptions: ->
       app: @options.app
-      qualityProfiles: @collection
\ No newline at end of file
+      rule: @options.rule
+      qualityProfiles: @collection
index 711a10c5b62698749df6aca8f0203c58cf258256..3c830c60b02b4f46b8926995d1d30e51c22d1796 100644 (file)
@@ -59,6 +59,7 @@ define [
       @qualityProfilesView = new CodingRulesDetailQualityProfilesView
         app: @options.app
         collection: qualityProfiles
+        rule: @model
 
       qualityProfile = @options.app.getQualityProfile()
       if qualityProfile
@@ -69,6 +70,7 @@ define [
         @contextQualityProfileView = new CodingRulesDetailQualityProfileView
           app: @options.app
           model: @contextProfile
+          rule: @model
         @listenTo @contextProfile, 'destroy', @hideContext
 
       @model.set 'lang', @options.app.languages[@model.get 'lang']
index 3d92ffe0ac05c08a604e3f63b43811f9fe2a9f41..00180916d3302a1829bd94d4d5ee972ce9fee53f 100644 (file)
@@ -24,23 +24,29 @@ define [
 
 
     activate: ->
+      profileKey = @ui.qualityProfileSelect.val()
+      if @model
+        profileKey = @model.get('qProfile')
+      severity = @ui.qualityProfileSeverity.val()
+
       @$('.modal-foot').html '<i class="spinner"></i>'
       jQuery.ajax
         type: 'POST'
-        url: "#{baseUrl}/api/rules/activate"
-        data: id: 1
+        url: "#{baseUrl}/api/qualityprofiles/activate_rule"
+        data:
+            profile_key: profileKey
+            rule_key: @rule.get('key')
+            severity: severity
       .done =>
-          severity = @ui.qualityProfileSeverity.val()
           parameters = @ui.qualityProfileParameters.map(->
             key: jQuery(@).prop('name'), value: jQuery(@).val() || jQuery(@).prop('placeholder')).get()
 
           if @model
             @model.set severity: severity, parameters: parameters
           else
-            key = @ui.qualityProfileSelect.val()
             model = new Backbone.Model
-              name: _.findWhere(@options.app.qualityProfiles, key: key).name
-              key: key
+              name: _.findWhere(@options.app.qualityProfiles, key: profileKey).name
+              key: profileKey
               severity: severity
               parameters: parameters
             @options.app.detailView.qualityProfilesView.collection.add model
index 3f174cfce279672a10da04c5907a7eab4dd6e6bc..61ef4429c51d84dfdac452103292ac7f92db5bea 100644 (file)
@@ -36,7 +36,7 @@
 
       <td class="coding-rules-detail-quality-profile-actions">
         <div class="button-group">
-          <button class="coding-rules-detail-quality-profile-change">{{t 'change'}}</button>
+          <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
           {{#if parent}}
             <button class="coding-rules-detail-quality-profile-revert button-red">
               {{t 'coding_rules.revert_to_parent_definition'}}
@@ -56,4 +56,4 @@
     {{/if}}
   </tr>
   </tbody>
-</table>
\ No newline at end of file
+</table>