From 3c543c17d49121084014a979cc814955444c762a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Lievremont Date: Wed, 18 Jun 2014 10:53:33 +0200 Subject: [PATCH] SONAR-5135 Display execution report after bulk change --- .../resources/org/sonar/l10n/core.properties | 2 + .../coding-rules-bulk-change-view.coffee | 41 +++++++++++++++---- .../coding-rules/coding-rules-bulk-change.hbs | 5 ++- sonar-server/src/main/less/style.less | 28 ++++--------- 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 '' + @ui.modalError.hide() + @ui.modalWarning.hide() + @ui.modalNotice.hide() + + origFooter = @ui.modalFooter.html() + @ui.modalFooter.html '' 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 @@