From: Stas Vilchik Date: Mon, 24 Mar 2014 14:03:02 +0000 (+0600) Subject: SONAR-5007 Update QP section X-Git-Tag: 4.3~299 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6c2b6ae4964679dbfd9a0f41db58605ad8bf38fa;p=sonarqube.git SONAR-5007 Update QP section --- diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/mockjax.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/mockjax.coffee index acefc6dd9f1..2163fac2a64 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/mockjax.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/mockjax.coffee @@ -97,6 +97,7 @@ define ['jquery.mockjax'], -> 'edit': 'Edit' 'markdown.helplink': 'Markdown Help' 'moreCriteria': '+ More Criteria' + 'save': 'Save' 'search_verb': 'Search' 'severity': 'Severity' 'update': 'Update' @@ -115,6 +116,7 @@ define ['jquery.mockjax'], -> 'coding_rules.bulk_change': 'Bulk Change' 'coding_rules.change_severity': 'Change Severity' 'coding_rules.change_severity_in': 'Change Severity In' + 'coding_rules.change_details': 'Change Details of Quality Profile' 'coding_rules.extend_description': 'Extend Description' 'coding_rules.deactivate_in': 'Deactivate In' 'coding_rules.deactivate': 'Deactivate' @@ -222,7 +224,6 @@ define ['jquery.mockjax'], -> key: 'S1190' parameters: [ { key: 'someParameter', type: 'INT', default: 4, description: 'Some parameter description' } - { key: 'boolParameter', type: 'BOOL', description: 'Bool parameter description' } ] description: '''

diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profile-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profile-view.coffee index 2f3ec432cd4..063b8378929 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profile-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profile-view.coffee @@ -6,7 +6,7 @@ define [ Templates ) -> - class CodingRulesDetailQualityProfilesView extends Marionette.ItemView + class CodingRulesDetailQualityProfileView extends Marionette.ItemView className: 'coding-rules-detail-quality-profile' template: Templates['coding-rules-detail-quality-profile'] @@ -15,6 +15,15 @@ define [ change: '.coding-rules-detail-quality-profile-change' + events: + 'click @ui.change': 'change' + + + change: -> + @options.app.codingRulesQualityProfileActivationView.model = @model + @options.app.codingRulesQualityProfileActivationView.show() + + enableUpdate: -> @ui.update.prop 'disabled', false diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profiles-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profiles-view.coffee index 0b6f7ec680e..71b0b311062 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profiles-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profiles-view.coffee @@ -10,4 +10,5 @@ define [ itemView: CodingRulesDetailQualityProfileView itemViewOptions: -> + app: @options.app qualityProfiles: @collection \ No newline at end of file diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-view.coffee index 641748825c9..4cf361c7a5c 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-view.coffee @@ -33,7 +33,8 @@ define [ extendDescriptionSpinner: '#coding-rules-detail-extend-description-spinner' cancelExtendDescription: '#coding-rules-detail-extend-description-cancel' - qualityProfileActivate: '#coding-rules-quality-profile-activate' + activateQualityProfile: '#coding-rules-quality-profile-activate' + changeQualityProfile: '.coding-rules-detail-quality-profile-update' events: @@ -44,11 +45,13 @@ define [ 'click @ui.cancelExtendDescription': 'hideExtendDescriptionForm' 'click @ui.extendDescriptionSubmit': 'submitExtendDescription' - 'click @ui.qualityProfileActivate': 'activateQualityProfile' + 'click @ui.activateQualityProfile': 'activateQualityProfile' + 'click @ui.changeQualityProfile': 'changeQualityProfile' initialize: (options) -> @qualityProfilesView = new CodingRulesDetailQualityProfilesView + app: @options.app collection: new Backbone.Collection options.model.get 'qualityProfiles' @@ -104,16 +107,25 @@ define [ @render() + getContextQualilyProfile: -> + contextQualityProfile = @options.app.getQualityProfile() + _.findWhere @model.get('qualityProfiles'), key: contextQualityProfile + + activateQualityProfile: -> - @options.app.codingRulesQualityProfileActivationView.model = @model + @options.app.codingRulesQualityProfileActivationView.model = null + @options.app.codingRulesQualityProfileActivationView.show() + + + changeQualityProfile: -> + @options.app.codingRulesQualityProfileActivationView.model = new Backbone.Model @getContextQualilyProfile() @options.app.codingRulesQualityProfileActivationView.show() serializeData: -> contextQualityProfile = @options.app.getQualityProfile() - qualityProfile = _.findWhere @model.get('qualityProfiles'), key: contextQualityProfile _.extend super, contextQualityProfile: contextQualityProfile contextQualityProfileName: @options.app.qualityProfileFilter.view.renderValue() - qualityProfile: qualityProfile \ No newline at end of file + qualityProfile: @getContextQualilyProfile() \ No newline at end of file diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-list-item-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-list-item-view.coffee index 5331efec1e7..69a9e5fdaff 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-list-item-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-list-item-view.coffee @@ -27,6 +27,7 @@ define [ url: "#{baseUrl}/api/codingrules/show" .done (r) => @model.set r.codingrule + @options.app.codingRulesQualityProfileActivationView.rule = @model detailView = new CodingRulesDetailView app: @options.app model: @model diff --git a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-quality-profile-activation-view.coffee b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-quality-profile-activation-view.coffee index f314464e3d7..70aa55a5daf 100644 --- a/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-quality-profile-activation-view.coffee +++ b/sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-quality-profile-activation-view.coffee @@ -52,7 +52,8 @@ define [ return state.text unless state.id " #{state.text}" - @ui.qualityProfileSeverity.val @model.get 'severity' + severity = if @model then @model.get 'severity' else @rule.get 'severity' + @ui.qualityProfileSeverity.val severity @ui.qualityProfileSeverity.select2 width: '250px' minimumResultsForSearch: 999 @@ -71,10 +72,14 @@ define [ getAvailableQualityProfiles: -> _.reject @options.app.qualityProfiles, (profile) => - _.findWhere @model.get('qualityProfiles'), key: profile.key + _.findWhere @rule.get('qualityProfiles'), key: profile.key serializeData: -> + parameters = if @model then @model.get('parameters') else @rule.get('parameters') + _.extend super, + rule: @rule.toJSON() + parameters: parameters qualityProfiles: @getAvailableQualityProfiles() severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO'] diff --git a/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-quality-profile-activation.hbs b/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-quality-profile-activation.hbs index 0360cab6f3b..cfd8d6df01d 100644 --- a/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-quality-profile-activation.hbs +++ b/sonar-server/src/main/webapp/templates/coding-rules/coding-rules-quality-profile-activation.hbs @@ -1,6 +1,10 @@

\ No newline at end of file