aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-01-26 15:06:24 +0100
committerStas Vilchik <stas-vilchik@users.noreply.github.com>2017-01-31 13:31:17 +0100
commit4599fde053e7308859b5fd15a38bb91ea9c9a2c8 (patch)
tree3ca652f72bf88eb36fd02b8908e8069ec0a5336b /server
parentcbaebde0219b22b32553d4c3f5aa737f00b00950 (diff)
downloadsonarqube-4599fde053e7308859b5fd15a38bb91ea9c9a2c8.tar.gz
sonarqube-4599fde053e7308859b5fd15a38bb91ea9c9a2c8.zip
SONAR-8370 Display ratings on new code on a project dashbord
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js10
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/enhance.js10
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.js6
5 files changed, 24 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js
index f65429c3c25..b966b07d037 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js
+++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js
@@ -43,16 +43,19 @@ const METRICS = [
'bugs',
'new_bugs',
'reliability_rating',
+ 'new_reliability_rating',
// vulnerabilities
'vulnerabilities',
'new_vulnerabilities',
'security_rating',
+ 'new_security_rating',
// code smells
'code_smells',
'new_code_smells',
'sqale_rating',
+ 'new_maintainability_rating',
'sqale_index',
'new_technical_debt',
diff --git a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js
index 953cffb8188..5d8174a1df4 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js
+++ b/server/sonar-web/src/main/js/apps/overview/main/BugsAndVulnerabilities.js
@@ -63,7 +63,10 @@ class BugsAndVulnerabilities extends React.Component {
<div className="overview-domain-measures">
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.props.renderIssues('new_bugs', 'BUG')}
+ <span style={{ marginLeft: 30 }}>
+ {this.props.renderIssues('new_bugs', 'BUG')}
+ </span>
+ {this.props.renderRating('new_reliability_rating')}
</div>
<div className="overview-domain-measure-label">
<span className="little-spacer-right"><BugIcon/></span>
@@ -73,7 +76,10 @@ class BugsAndVulnerabilities extends React.Component {
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.props.renderIssues('new_vulnerabilities', 'VULNERABILITY')}
+ <span style={{ marginLeft: 30 }}>
+ {this.props.renderIssues('new_vulnerabilities', 'VULNERABILITY')}
+ </span>
+ {this.props.renderRating('new_security_rating')}
</div>
<div className="overview-domain-measure-label">
<span className="little-spacer-right"><VulnerabilityIcon/></span>
diff --git a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js
index 7994903186a..4ba9c9b358d 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js
+++ b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js
@@ -86,7 +86,10 @@ class CodeSmells extends React.Component {
<div className="overview-domain-measures">
<div className="overview-domain-measure">
<div className="overview-domain-measure-value">
- {this.renderDebt('new_technical_debt', 'CODE_SMELL')}
+ <span style={{ marginLeft: 30 }}>
+ {this.renderDebt('new_technical_debt', 'CODE_SMELL')}
+ </span>
+ {this.props.renderRating('new_maintainability_rating')}
</div>
<div className="overview-domain-measure-label">
{getMetricName('new_effort')}
diff --git a/server/sonar-web/src/main/js/apps/overview/main/enhance.js b/server/sonar-web/src/main/js/apps/overview/main/enhance.js
index 47850e7dd2f..f747e0f2834 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/enhance.js
+++ b/server/sonar-web/src/main/js/apps/overview/main/enhance.js
@@ -128,14 +128,14 @@ export default function enhance (ComposedComponent) {
return null;
}
- const title = getRatingTooltip(metricKey, measure.value);
+ const value = this.getValue(measure);
+
+ const title = getRatingTooltip(metricKey, value);
return (
- <div className="overview-domain-measure-sup"
- title={title}
- data-toggle="tooltip">
+ <div className="overview-domain-measure-sup" title={title} data-toggle="tooltip">
<DrilldownLink className="link-no-underline" component={component.key} metric={metricKey}>
- <Rating value={measure.value}/>
+ <Rating value={value}/>
</DrilldownLink>
</div>
);
diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js
index 505ebaf6bfc..cf3188c45bb 100644
--- a/server/sonar-web/src/main/js/helpers/measures.js
+++ b/server/sonar-web/src/main/js/helpers/measures.js
@@ -394,7 +394,9 @@ function getMaintainabilityRatingTooltip (rating) {
export function getRatingTooltip (metricKey, value) {
const ratingLetter = formatMeasure(value, 'RATING');
- return metricKey === 'sqale_rating' ?
+ const finalMetricKey = metricKey.startsWith('new_') ? metricKey.substr(4) : metricKey;
+
+ return (finalMetricKey === 'sqale_rating' || finalMetricKey === 'maintainability_rating') ?
getMaintainabilityRatingTooltip(value) :
- translate('metric', metricKey, 'tooltip', ratingLetter);
+ translate('metric', finalMetricKey, 'tooltip', ratingLetter);
}