aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-01-29 17:55:12 +0100
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-02-07 11:32:38 +0100
commit8441bef88cbfc8fa87ff216088f4852b511910dd (patch)
tree6cf15f07d04ef5f1a5adec1170a96752e7ad9ddf /server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
parent8b3584e7ad88c5b97207101d6f6ed3f64e86060d (diff)
downloadsonarqube-8441bef88cbfc8fa87ff216088f4852b511910dd.tar.gz
sonarqube-8441bef88cbfc8fa87ff216088f4852b511910dd.zip
SONAR-10319 Display Analysis Scope on rules detail page (#2995)
* SONAR-10319 Display Analysis Scope on rules detail page * fix icons alignment
Diffstat (limited to 'server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx')
-rw-r--r--server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx21
1 files changed, 19 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
index 3728d1e8c0e..88d81b5faca 100644
--- a/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
+++ b/server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
@@ -20,9 +20,10 @@
import * as React from 'react';
import { Link } from 'react-router';
import { Query } from '../query';
-import { RuleDetails } from '../../../app/types';
+import { RuleDetails, RuleScope } from '../../../app/types';
import { getRuleUrl } from '../../../helpers/urls';
import LinkIcon from '../../../components/icons-components/LinkIcon';
+import RuleScopeIcon from '../../../components/icons-components/RuleScopeIcon';
import SimilarRulesFilter from './SimilarRulesFilter';
import Tooltip from '../../../components/controls/Tooltip';
import { translate } from '../../../helpers/l10n';
@@ -72,7 +73,10 @@ export default class RuleDetailsMeta extends React.PureComponent<Props, State> {
renderSeverity = () => (
<Tooltip overlay={translate('default_severity')}>
<li className="coding-rules-detail-property" data-meta="severity">
- <SeverityHelper severity={this.props.ruleDetails.severity} />
+ <SeverityHelper
+ className="display-inline-flex-center"
+ severity={this.props.ruleDetails.severity}
+ />
</li>
</Tooltip>
);
@@ -200,6 +204,18 @@ export default class RuleDetailsMeta extends React.PureComponent<Props, State> {
);
};
+ renderScope = () => {
+ const scope = this.props.ruleDetails.scope || RuleScope.Main;
+ return (
+ <Tooltip overlay={translate('coding_rules.scope.title')}>
+ <li className="coding-rules-detail-property">
+ <RuleScopeIcon className="little-spacer-right" />
+ {translate('coding_rules.scope', scope)}
+ </li>
+ </Tooltip>
+ );
+ };
+
render() {
const { ruleDetails } = this.props;
return (
@@ -223,6 +239,7 @@ export default class RuleDetailsMeta extends React.PureComponent<Props, State> {
{this.renderType()}
{this.renderSeverity()}
{this.renderStatus()}
+ {this.renderScope()}
{this.renderTags()}
{this.renderCreationDate()}
{this.renderRepository()}