aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-05-31 11:38:34 +0200
committerEric Hartmann <hartmann.eric@gmail.com>2017-06-14 15:43:12 +0200
commitd4133c63eb8e7b6acc54195da3206f1b3a5f7689 (patch)
tree457933dbfb31b94ecdf3a319adb0302ed549d765 /server/sonar-web
parentae85f66a8dbef6f7533cb6cb1eb9ab623ad8d447 (diff)
downloadsonarqube-d4133c63eb8e7b6acc54195da3206f1b3a5f7689.tar.gz
sonarqube-d4133c63eb8e7b6acc54195da3206f1b3a5f7689.zip
SONAR-9303 Do not display activation actions for built-in quality profiles on rules page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js3
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs32
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/templates/facets/coding-rules-quality-profile-facet.hbs2
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs37
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js9
-rw-r--r--server/sonar-web/src/main/less/components/badges.less1
-rw-r--r--server/sonar-web/src/main/less/pages/coding-rules.less4
7 files changed, 53 insertions, 35 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
index 0921e346de5..5b1ce432a7a 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/facets/quality-profile-facet.js
@@ -41,8 +41,9 @@ export default BaseFacet.extend({
const values = this.options.app.qualityProfiles
.filter(profile => (lang != null ? profile.lang === lang : true))
.map(profile => ({
- label: profile.name,
extra: that.options.app.languages[profile.lang],
+ isBuiltIn: profile.isBuiltIn,
+ label: profile.name,
val: profile.key
}));
return sortBy(values, 'label');
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs
index 9bb20b2bd79..23324db3e9e 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs
+++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/coding-rules-workspace-list-item.hbs
@@ -47,21 +47,23 @@
{{#any activation selectedProfile}}
{{#if canWrite}}
- <td class="coding-rule-table-meta-cell coding-rule-activation-actions">
- <div class="button-group">
- {{#if activation}}
- {{#eq activation.inherit 'NONE'}}
- <button class="coding-rules-detail-quality-profile-deactivate button-red">
- {{t 'coding_rules.deactivate'}}
- </button>
- {{/eq}}
- {{else}}
- {{#unless isTemplate}}
- <button class="coding-rules-detail-quality-profile-activate">{{t 'coding_rules.activate'}}</button>
- {{/unless}}
- {{/if}}
- </div>
- </td>
+ {{#unless isSelectedProfileBuiltIn}}
+ <td class="coding-rule-table-meta-cell coding-rule-activation-actions">
+ <div class="button-group">
+ {{#if activation}}
+ {{#eq activation.inherit 'NONE'}}
+ <button class="coding-rules-detail-quality-profile-deactivate button-red">
+ {{t 'coding_rules.deactivate'}}
+ </button>
+ {{/eq}}
+ {{else}}
+ {{#unless isTemplate}}
+ <button class="coding-rules-detail-quality-profile-activate">{{t 'coding_rules.activate'}}</button>
+ {{/unless}}
+ {{/if}}
+ </div>
+ </td>
+ {{/unless}}
{{/if}}
{{/any}}
</tr>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/facets/coding-rules-quality-profile-facet.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/facets/coding-rules-quality-profile-facet.hbs
index b83bf1cf51b..23caeed013d 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/templates/facets/coding-rules-quality-profile-facet.hbs
+++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/facets/coding-rules-quality-profile-facet.hbs
@@ -3,7 +3,7 @@
<div class="search-navigator-facet-list">
{{#each values}}
<a class="facet search-navigator-facet js-facet" data-value="{{val}}" title="{{default label val}}">
- <span class="facet-name">{{default label val}}{{#if extra}} <span class="note">{{extra}}</span>{{/if}}</span>
+ <span class="facet-name">{{default label val}}{{#if extra}} <span class="note">{{extra}}</span>{{/if}}{{#if isBuiltIn}} <span class="note">({{t 'quality_profiles.built_in'}})</span>{{/if}}</span>
<span class="facet-stat">
<span class="js-active facet-toggle facet-toggle-green {{#if ../toggled}}facet-toggle-active{{/if}}">active</span>
<span class="js-inactive facet-toggle facet-toggle-red {{#unless ../toggled}}facet-toggle-active{{/unless}}">inactive</span>
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs
index 12d1fe950d5..9c800325ba5 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs
+++ b/server/sonar-web/src/main/js/apps/coding-rules/templates/rule/coding-rules-rule-profile.hbs
@@ -2,6 +2,7 @@
<a href="{{profilePath}}">
{{name}}
</a>
+ {{#if isBuiltIn}}<span class="built-in-badge spacer-left">{{t 'quality_profiles.built_in'}}</span>{{/if}}
{{#if parent}}
<div class="coding-rules-detail-quality-profile-inheritance">
{{#eq inherit 'OVERRIDES'}}
@@ -47,24 +48,26 @@
{{/unless}}
{{#if canWrite}}
- <td class="coding-rules-detail-quality-profile-actions">
- <div class="button-group">
- {{#unless isTemplate}}
- <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
- {{/unless}}
- {{#if parent}}
- {{#eq inherit 'OVERRIDES'}}
- <button class="coding-rules-detail-quality-profile-revert button-red">
- {{t 'coding_rules.revert_to_parent_definition'}}
+ {{#unless isBuiltIn}}
+ <td class="coding-rules-detail-quality-profile-actions">
+ <div class="button-group">
+ {{#unless isTemplate}}
+ <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
+ {{/unless}}
+ {{#if parent}}
+ {{#eq inherit 'OVERRIDES'}}
+ <button class="coding-rules-detail-quality-profile-revert button-red">
+ {{t 'coding_rules.revert_to_parent_definition'}}
+ </button>
+ {{/eq}}
+ {{else}}
+ <button class="coding-rules-detail-quality-profile-deactivate button-red">
+ {{t 'coding_rules.deactivate'}}
</button>
- {{/eq}}
- {{else}}
- <button class="coding-rules-detail-quality-profile-deactivate button-red">
- {{t 'coding_rules.deactivate'}}
- </button>
- {{/if}}
- </div>
- </td>
+ {{/if}}
+ </div>
+ </td>
+ {{/unless}}
{{/if}}
{{else}}
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
index 77c0b59d6a5..b5d0fafe2ee 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
+++ b/server/sonar-web/src/main/js/apps/coding-rules/workspace-list-item-view.js
@@ -112,11 +112,18 @@ export default WorkspaceListItemView.extend(RuleFilterMixin).extend({
},
serializeData() {
+ const selectedProfileKey = this.options.app.state.get('query').qprofile;
+ const selectedProfile =
+ selectedProfileKey &&
+ this.options.app.qualityProfiles.find(profile => profile.key === selectedProfileKey);
+ const isSelectedProfileBuiltIn = selectedProfile != null && selectedProfile.isBuiltIn;
+
return {
...WorkspaceListItemView.prototype.serializeData.apply(this, arguments),
tags: union(this.model.get('sysTags'), this.model.get('tags')),
canWrite: this.options.app.canWrite,
- selectedProfile: this.options.app.state.get('query').qprofile
+ selectedProfile: selectedProfileKey,
+ isSelectedProfileBuiltIn
};
}
});
diff --git a/server/sonar-web/src/main/less/components/badges.less b/server/sonar-web/src/main/less/components/badges.less
index c164191afef..2b640be062d 100644
--- a/server/sonar-web/src/main/less/components/badges.less
+++ b/server/sonar-web/src/main/less/components/badges.less
@@ -117,4 +117,5 @@
box-sizing: border-box;
color: #777;
font-size: 12px;
+ font-weight: 400;
}
diff --git a/server/sonar-web/src/main/less/pages/coding-rules.less b/server/sonar-web/src/main/less/pages/coding-rules.less
index 892582972f8..2cfddf3e9b0 100644
--- a/server/sonar-web/src/main/less/pages/coding-rules.less
+++ b/server/sonar-web/src/main/less/pages/coding-rules.less
@@ -316,6 +316,10 @@
white-space: nowrap;
}
+.coding-rules-detail-quality-profile-severity i {
+ margin-top: 4px;
+}
+
.coding-rules-detail-quality-profile-parameters,
.coding-rules-detail-list-parameters {
vertical-align: top;