aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-03-24 20:03:02 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-03-24 20:03:13 +0600
commit6c2b6ae4964679dbfd9a0f41db58605ad8bf38fa (patch)
tree55896a1b697844e93a3a58f300bd6bb9f9ef01fd /sonar-server
parent00ba6944ea221c2638596c9a8f6c1cd75ed8a8d1 (diff)
downloadsonarqube-6c2b6ae4964679dbfd9a0f41db58605ad8bf38fa.tar.gz
sonarqube-6c2b6ae4964679dbfd9a0f41db58605ad8bf38fa.zip
SONAR-5007 Update QP section
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/mockjax.coffee3
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profile-view.coffee11
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-quality-profiles-view.coffee1
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-detail-view.coffee22
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-list-item-view.coffee1
-rw-r--r--sonar-server/src/main/webapp/coffee/coding-rules/views/coding-rules-quality-profile-activation-view.coffee9
-rw-r--r--sonar-server/src/main/webapp/templates/coding-rules/coding-rules-quality-profile-activation.hbs26
7 files changed, 56 insertions, 17 deletions
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: '''
<p>
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
"<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{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 @@
<form>
<div class="modal-head">
- <h2>{{t 'coding_rules.activate_in_quality_profile'}}</h2>
+ {{#if key}}
+ <h2>{{t 'coding_rules.change_details'}}</h2>
+ {{else}}
+ <h2>{{t 'coding_rules.activate_in_quality_profile'}}</h2>
+ {{/if}}
</div>
<div class="modal-body">
@@ -10,11 +14,15 @@
<tr class="property">
<th><h3>{{t 'coding_rules.quality_profile'}}</h3></th>
<td>
- <select id="coding-rules-quality-profile-activation-select">
- {{#each qualityProfiles}}
- <option value="{{key}}">{{name}}</option>
- {{/each}}
- </select>
+ {{#if key}}
+ {{name}}
+ {{else}}
+ <select id="coding-rules-quality-profile-activation-select">
+ {{#each qualityProfiles}}
+ <option value="{{key}}">{{name}}</option>
+ {{/each}}
+ </select>
+ {{/if}}
</td>
</tr>
<tr class="property">
@@ -31,7 +39,7 @@
<tr class="property">
<th><h3>{{key}}</h3></th>
<td>
- <input type="text" {{#if default}}value="{{default}}"{{/if}}>
+ <input type="text" value="{{value}}" placeholder="{{default}}">
<div class="note">{{description}}</div>
{{#if extra}}
<div class="note">{{extra}}</div>
@@ -43,7 +51,9 @@
</div>
<div class="modal-foot">
- <button id="coding-rules-quality-profile-activation-activate">{{t 'coding_rules.activate'}}</button>
+ <button id="coding-rules-quality-profile-activation-activate">
+ {{#if key}}{{t 'save'}}{{else}}{{t 'coding_rules.activate'}}{{/if}}
+ </button>
<a id="coding-rules-quality-profile-activation-cancel" class="action">{{t 'cancel'}}</a>
</div>
</form> \ No newline at end of file