aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--it/it-tests/src/test/resources/projectOverview/ProjectOverviewTest/test_project_overview_after_first_analysis.html108
-rw-r--r--server/sonar-web/src/main/js/apps/overview/general/coverage.js16
-rw-r--r--server/sonar-web/src/main/js/libs/application.js6
3 files changed, 70 insertions, 60 deletions
diff --git a/it/it-tests/src/test/resources/projectOverview/ProjectOverviewTest/test_project_overview_after_first_analysis.html b/it/it-tests/src/test/resources/projectOverview/ProjectOverviewTest/test_project_overview_after_first_analysis.html
index 2b218e58e1d..ddbe51f8e0b 100644
--- a/it/it-tests/src/test/resources/projectOverview/ProjectOverviewTest/test_project_overview_after_first_analysis.html
+++ b/it/it-tests/src/test/resources/projectOverview/ProjectOverviewTest/test_project_overview_after_first_analysis.html
@@ -2,61 +2,65 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="http://localhost:49506" />
-<title>test_project_overview_after_first_analysis</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+ <link rel="selenium.base" href="http://localhost:49506"/>
+ <title>test_project_overview_after_first_analysis</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">test_project_overview_after_first_analysis</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/sonar/overview?id=project-for-overview</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*Quality Gate*Passed*</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*A*0*Issues*0*Debt*</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*Blocker*0*Critical*0*Major*0*Minor*0*Info*0*</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*0.0%*Duplications*0*Duplicated Blocks*</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*13*Lines of Code*1*Files*</td>
- <td></td>
-</tr>
-<tr>
- <td>assertTextNotPresent</td>
- <td>*Coverage*</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*Quality Gate*SonarQube way*</td>
- <td></td>
-</tr>
-<tr>
- <td>waitForTextPresent</td>
- <td>*Quality Profiles*Xoo*Basic*</td>
- <td></td>
-</tr>
+ <thead>
+ <tr>
+ <td rowspan="1" colspan="3">test_project_overview_after_first_analysis</td>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>open</td>
+ <td>/sonar/overview?id=project-for-overview</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Quality Gate*Passed*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*A*0*Issues*0*Debt*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Blocker*0*Critical*0*Major*0*Minor*0*Info*0*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*0.0%*Duplications*0*Duplicated Blocks*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*13*Lines of Code*1*Files*</td>
+ </tr>
+ <tr>
+ <td>assertNotText</td>
+ <td>id=content</td>
+ <td>*Coverage*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Quality Gate*SonarQube way*</td>
+ </tr>
+ <tr>
+ <td>waitForText</td>
+ <td>id=content</td>
+ <td>*Quality Profiles*Xoo*Basic*</td>
+ </tr>
-</tbody></table>
+ </tbody>
+</table>
</body>
</html>
diff --git a/server/sonar-web/src/main/js/apps/overview/general/coverage.js b/server/sonar-web/src/main/js/apps/overview/general/coverage.js
index bec2f468bf1..5637d4c227d 100644
--- a/server/sonar-web/src/main/js/apps/overview/general/coverage.js
+++ b/server/sonar-web/src/main/js/apps/overview/general/coverage.js
@@ -15,6 +15,16 @@ export const GeneralCoverage = React.createClass({
leakPeriodDate: React.PropTypes.object
},
+ renderNewCoverage () {
+ if (this.props.leak['new_overall_coverage'] != null) {
+ return <DrilldownLink component={this.props.component.key} metric="new_overall_coverage" period="1">
+ {window.formatMeasure(this.props.leak['new_overall_coverage'], 'PERCENT')}
+ </DrilldownLink>;
+ } else {
+ return <span>—</span>;
+ }
+ },
+
renderLeak () {
if (!this.hasLeakPeriod()) {
return null;
@@ -22,11 +32,7 @@ export const GeneralCoverage = React.createClass({
return <DomainLeak>
<MeasuresList>
- <Measure label={getMetricName('new_coverage')}>
- <DrilldownLink component={this.props.component.key} metric="new_overall_coverage" period="1">
- {window.formatMeasure(this.props.leak['new_overall_coverage'], 'PERCENT')}
- </DrilldownLink>
- </Measure>
+ <Measure label={getMetricName('new_coverage')}>{this.renderNewCoverage()}</Measure>
</MeasuresList>
{this.renderTimeline('after')}
</DomainLeak>;
diff --git a/server/sonar-web/src/main/js/libs/application.js b/server/sonar-web/src/main/js/libs/application.js
index 8d2236d9710..9613272304c 100644
--- a/server/sonar-web/src/main/js/libs/application.js
+++ b/server/sonar-web/src/main/js/libs/application.js
@@ -461,7 +461,7 @@ function closeModalWindow () {
*/
var shortDurationVariationFormatter = function (value) {
if (value === 0) {
- return '0';
+ return '+0';
}
var formatted = shortDurationFormatter(value);
return formatted[0] !== '-' ? '+' + formatted : formatted;
@@ -545,10 +545,10 @@ function closeModalWindow () {
},
'SHORT_INT': shortIntVariationFormatter,
'FLOAT': function (value) {
- return value === 0 ? '0' : numeral(value).format('+0,0.0');
+ return value === 0 ? '+0.0' : numeral(value).format('+0,0.0');
},
'PERCENT': function (value) {
- return value === 0 ? '+0%' : numeral(+value / 100).format('+0,0.0%');
+ return value === 0 ? '+0.0%' : numeral(+value / 100).format('+0,0.0%');
},
'WORK_DUR': durationVariationFormatter,
'SHORT_WORK_DUR': shortDurationVariationFormatter