From: Stas Vilchik Date: Mon, 16 May 2016 13:15:08 +0000 (+0200) Subject: display number of new lines to cover on overview page X-Git-Tag: 5.6-RC1~73 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=54182e421c652e100091196e45ff2474b2cc9608;p=sonarqube.git display number of new lines to cover on overview page --- 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 fdd667d396d..19603ac1fcc 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 @@ -65,6 +65,9 @@ const METRICS = [ 'new_coverage', 'it_coverage', 'new_it_coverage', + 'new_lines_to_cover', + 'new_it_lines_to_cover', + 'new_overall_lines_to_cover', 'tests', // duplications diff --git a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js index d86fb2b88ff..d6aee6495a1 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/Coverage.js +++ b/server/sonar-web/src/main/js/apps/overview/main/Coverage.js @@ -57,6 +57,12 @@ class Coverage extends React.Component { .find(measure => measure.metric.key === `new_${prefix}coverage`); } + getNewLinesToCover (prefix) { + const { measures } = this.props; + return measures + .find(measure => measure.metric.key === `new_${prefix}lines_to_cover`); + } + renderHeader () { return this.props.renderHeader( 'Coverage', @@ -109,29 +115,50 @@ class Coverage extends React.Component { renderNewCoverage (coverageMetricPrefix) { const { component, leakPeriod } = this.props; const newCoverageMeasure = this.getNewCoverageMeasure(coverageMetricPrefix); + const newLinesToCover = this.getNewLinesToCover(coverageMetricPrefix); const value = newCoverageMeasure ? ( - - - {formatMeasure(getPeriodValue(newCoverageMeasure, leakPeriod.index), 'PERCENT')} - - +
+ + + {formatMeasure(getPeriodValue(newCoverageMeasure, leakPeriod.index), 'PERCENT')} + + +
) : ( — ); + const label = newLinesToCover ? ( +
+ {translate('overview.coverage_on')} +
+ + + {formatMeasure(getPeriodValue(newLinesToCover, leakPeriod.index), 'SHORT_INT')} + + + {getMetricName('new_ncloc')} +
+ ) : ( +
+ {getMetricName('new_coverage')} +
+ ); + return (
{value}
- -
- {getMetricName('new_coverage')} -
+ {label}
); } diff --git a/server/sonar-web/src/main/js/apps/overview/styles.css b/server/sonar-web/src/main/js/apps/overview/styles.css index 7e09cd5241c..d31c9a404c8 100644 --- a/server/sonar-web/src/main/js/apps/overview/styles.css +++ b/server/sonar-web/src/main/js/apps/overview/styles.css @@ -180,6 +180,12 @@ font-weight: 300; } +.overview-domain-secondary-measure-value { + line-height: 1; + font-size: 20px; + font-weight: 300; +} + .overview-domain-leak .overview-domain-measure-value { text-align: center; } diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index c9d6cab70c7..442e81d8f83 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3132,7 +3132,9 @@ overview.metric.new_coverage=Coverage on New Code overview.metric.duplications=Duplications overview.metric.duplicated_blocks=Duplicated Blocks overview.metric.ncloc=Lines of Code +overview.metric.new_ncloc=New Lines of Code overview.metric.files=Files +overview.coverage_on=Coverage on overview.period.previous_version=since {0} overview.period.previous_version_only_date=since previous version