diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-06-18 10:53:33 +0200 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-06-18 10:53:46 +0200 |
commit | 3c543c17d49121084014a979cc814955444c762a (patch) | |
tree | 05659944109259d213f14e41c8b7bd5d3af4dfb5 | |
parent | 8dee812b1bb3350dfc125a403126f12fd940f6bd (diff) | |
download | sonarqube-3c543c17d49121084014a979cc814955444c762a.tar.gz sonarqube-3c543c17d49121084014a979cc814955444c762a.zip |
SONAR-5135 Display execution report after bulk change
4 files changed, 47 insertions, 29 deletions
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 68695d24188..36814f63f5a 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -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 diff --git a/sonar-server/src/main/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee b/sonar-server/src/main/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee index 5c85d827d1c..8b26d3f0afa 100644 --- a/sonar-server/src/main/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee +++ b/sonar-server/src/main/coffee/coding-rules/views/coding-rules-bulk-change-view.coffee @@ -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) -> diff --git a/sonar-server/src/main/hbs/coding-rules/coding-rules-bulk-change.hbs b/sonar-server/src/main/hbs/coding-rules/coding-rules-bulk-change.hbs index d5de084eaf1..6abb8c38db0 100644 --- a/sonar-server/src/main/hbs/coding-rules/coding-rules-bulk-change.hbs +++ b/sonar-server/src/main/hbs/coding-rules/coding-rules-bulk-change.hbs @@ -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> diff --git a/sonar-server/src/main/less/style.less b/sonar-server/src/main/less/style.less index 317c2c1b291..85f9005f502 100644 --- a/sonar-server/src/main/less/style.less +++ b/sonar-server/src/main/less/style.less @@ -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; } |