diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-11-02 10:17:58 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-11-02 10:26:53 +0100 |
commit | 914ff85f6b8fd65c31a64fbd9276249260b66707 (patch) | |
tree | 0753995b56a16e42b48fa88a499ce02666069eab /server | |
parent | 787da65b0d08e14cabe9f45e27514f8e418c1375 (diff) | |
download | sonarqube-914ff85f6b8fd65c31a64fbd9276249260b66707.tar.gz sonarqube-914ff85f6b8fd65c31a64fbd9276249260b66707.zip |
SONAR-6331 improve display of measures on the project overview page
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/src/main/js/apps/overview/general/coverage.js | 16 | ||||
-rw-r--r-- | server/sonar-web/src/main/js/libs/application.js | 6 |
2 files changed, 14 insertions, 8 deletions
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 |