]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5135 Display execution report after bulk change
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 18 Jun 2014 08:53:33 +0000 (10:53 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 18 Jun 2014 08:53:46 +0000 (10:53 +0200)
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee
sonar-server/src/main/hbs/coding-rules/coding-rules-bulk-change.hbs
sonar-server/src/main/less/style.less

index 68695d241888adb0f70d528ee86381d6163ba1c3..36814f63f5a2e0fd40068c6ce0200dce51037a14 100644 (file)
@@ -1695,6 +1695,8 @@ coding_rules.add_note=Add Note
 coding_rules.add_tags=Add Tags
 coding_rules.available_since=Available Since
 coding_rules.bulk_change=Bulk Change
+coding_rules.bulk_change.success={0} rule(s) changed
+coding_rules.bulk_change.warning={0} rule(s) changed, {1} rule(s) ignored
 coding_rules.change_severity=Change Severity
 coding_rules.change_severity_in=Change Severity In
 coding_rules.change_details=Change Details of Quality Profile
index 5c85d827d1c811d2936153c8031795d7f77054c4..8b26d3f0afaf2ae10cee7f36d0e4bcff134a521b 100644 (file)
@@ -10,10 +10,19 @@ define [
     className: 'modal'
     template: Templates['coding-rules-bulk-change']
 
+    ui:
+      modalFooter: '.modal-foot'
+      modalError: '.modal-error'
+      modalWarning: '.modal-warning'
+      modalNotice: '.modal-notice'
+      codingRulesSubmitBulkChange: '#coding-rules-submit-bulk-change'
+      codingRulesCancelBulkChange: '#coding-rules-cancel-bulk-change'
+      codingRulesCloseBulkChange: '#coding-rules-close-bulk-change'
 
     events:
       'submit form': 'onSubmit'
-      'click #coding-rules-cancel-bulk-change': 'hide'
+      'click @ui.codingRulesCancelBulkChange': 'hide'
+      'click @ui.codingRulesCloseBulkChange': 'close'
       'change select': 'enableAction'
 
 
@@ -54,6 +63,11 @@ define [
       @$el.dialog 'close'
 
 
+    close: ->
+      @options.app.fetchFirstPage(true)
+      @hide()
+
+
     prepareQuery: ->
       query = @options.app.getQuery()
 
@@ -75,18 +89,31 @@ define [
       wsAction = query.wsAction
       query = _.omit(query, 'wsAction')
 
-      origFooter = @$('.modal-foot').html()
-      @$('.modal-foot').html '<i class="spinner"></i>'
+      @ui.modalError.hide()
+      @ui.modalWarning.hide()
+      @ui.modalNotice.hide()
+
+      origFooter = @ui.modalFooter.html()
+      @ui.modalFooter.html '<i class="spinner"></i>'
 
       jQuery.ajax
         type: 'POST'
         url: "#{baseUrl}/api/qualityprofiles/#{wsAction}_rules"
         data: query
-      .done =>
-        @options.app.fetchFirstPage(true)
-        @hide()
+      .done (r) =>
+        if (r.failed)
+          @ui.modalWarning.show()
+          @ui.modalWarning.html tp('coding_rules.bulk_change.warning', r.succeeded, r.failed)
+        else
+          @ui.modalNotice.show()
+          @ui.modalNotice.html tp('coding_rules.bulk_change.success', r.succeeded)
+
+        @ui.modalFooter.html origFooter
+        @$(@ui.codingRulesSubmitBulkChange.selector).hide()
+        @$(@ui.codingRulesCancelBulkChange.selector).hide()
+        @$(@ui.codingRulesCloseBulkChange.selector).show()
       .fail =>
-        @$('.modal-foot').html origFooter
+        @ui.modalFooter.html origFooter
 
 
     onSubmit: (e) ->
index d5de084eaf1990a3a3906232aad55d4dd745430e..6abb8c38db0beeb72f2cc3b07228259ac403bd36 100644 (file)
@@ -13,6 +13,8 @@
 
   <div class="modal-body">
     <div class="modal-error"></div>
+    <div class="modal-warning"></div>
+    <div class="modal-notice"></div>
 
     <div class="modal-field">
       <h3><label for="coding-rules-bulk-change-profile">
@@ -48,7 +50,8 @@
   </div>
 
   <div class="modal-foot">
-    <button>{{t 'apply'}}</button>
+    <button id="coding-rules-submit-bulk-change">{{t 'apply'}}</button>
     <a id="coding-rules-cancel-bulk-change" class="action">{{t 'cancel'}}</a>
+    <a id="coding-rules-close-bulk-change" class="action" style="display:none">{{t 'close'}}</a>
   </div>
 </form>
index 317c2c1b29112ed015c7d4c634de8f1b80dfb91c..85f9005f50208b74274fa738142e2a6d6bd0f5fd 100644 (file)
@@ -278,7 +278,7 @@ h1 img, .h1 img, h2 img, .h2 img, h3 img, .h3 img, h4 img, .h4 img {
 }
 
 /* ------------------- MESSAGES ------------------- */
-.warning {
+.warning, .modal-warning {
   border: solid 1px #FFD324;
   background-color: #FFF6BF;
   color: #514721;
@@ -286,19 +286,19 @@ h1 img, .h1 img, h2 img, .h2 img, h3 img, .h3 img, h4 img, .h4 img {
   padding: 4px;
 }
 
-.error {
+.error, .modal-error {
   border: 1px solid red;
   background-color: #FF5252;
   color: #eee;
   margin: 0 0 4px;
   padding: 4px;
-}
 
-.error a {
-  color: #eee;
+  a {
+    color: #eee;
+  }
 }
 
-.notice {
+.notice, .modal-notice {
   border: 1px solid #9c9;
   background-color: #e2f9e3;
   color: #060;
@@ -2536,21 +2536,7 @@ ul.modal-head-metadata li {
   color: #777;
 }
 
-.modal-error {
-  border: 1px solid red;
-  background-color: #FF5252;
-  color: #eee;
-  margin: 0 0 4px;
-  padding: 4px;
-  display: none;
-}
-
-.modal-warning {
-  border: solid 1px #FFD324;
-  background-color: #FFF6BF;
-  color: #514721;
-  margin: 0 0 4px;
-  padding: 4px;
+.modal-error, .modal-warning, .modal-notice {
   display: none;
 }