aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-11-01 14:13:39 +0100
committerGitHub <noreply@github.com>2016-11-01 14:13:39 +0100
commit5da7c8f3f1ffc2975e1fdeef86d414230fe490d0 (patch)
tree392d154f5ad56c2e84d455085204077cefbca3aa /server/sonar-web/src/main
parentf52dd8d40f02f8112dd9fe791681f412b200903b (diff)
downloadsonarqube-5da7c8f3f1ffc2975e1fdeef86d414230fe490d0.tar.gz
sonarqube-5da7c8f3f1ffc2975e1fdeef86d414230fe490d0.zip
SONAR-8326 Drop all code related to IT/overall coverage on web side (#1348)
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/App.js6
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Component.js4
-rw-r--r--server/sonar-web/src/main/js/apps/code/components/Components.js6
-rw-r--r--server/sonar-web/src/main/js/apps/code/utils.js10
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/config/complementary.js24
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/config/domains.js33
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js22
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js8
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/Coverage.js70
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/main.js41
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js6
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js11
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/source.js11
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs30
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs4
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs4
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs15
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.js19
18 files changed, 56 insertions, 268 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/components/App.js b/server/sonar-web/src/main/js/apps/code/components/App.js
index 86563c2875f..7dc6b7158b3 100644
--- a/server/sonar-web/src/main/js/apps/code/components/App.js
+++ b/server/sonar-web/src/main/js/apps/code/components/App.js
@@ -27,7 +27,6 @@ import Search from './Search';
import ListFooter from '../../../components/controls/ListFooter';
import { retrieveComponentChildren, retrieveComponent, loadMoreChildren, parseError } from '../utils';
import { addComponent, addComponentBreadcrumbs } from '../bucket';
-import { selectCoverageMetric } from '../../../helpers/measures';
import '../code.css';
@@ -70,8 +69,6 @@ export default class App extends React.Component {
const isView = component.qualifier === 'VW' || component.qualifier === 'SVW';
retrieveComponentChildren(component.key, isView).then(r => {
addComponent(r.baseComponent);
- const prefix = selectCoverageMetric(r.baseComponent.measures);
- this.coverageMetric = `${prefix}coverage`;
this.handleUpdate();
}).catch(e => {
if (this.mounted) {
@@ -192,8 +189,7 @@ export default class App extends React.Component {
<Components
rootComponent={component}
baseComponent={baseComponent}
- components={components}
- coverageMetric={this.coverageMetric}/>
+ components={components}/>
</div>
)}
diff --git a/server/sonar-web/src/main/js/apps/code/components/Component.js b/server/sonar-web/src/main/js/apps/code/components/Component.js
index 11b975c81c2..14386f2b2f5 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Component.js
+++ b/server/sonar-web/src/main/js/apps/code/components/Component.js
@@ -66,7 +66,7 @@ export default class Component extends React.Component {
}
render () {
- const { component, rootComponent, selected, previous, coverageMetric, canBrowse } = this.props;
+ const { component, rootComponent, selected, previous, canBrowse } = this.props;
const isView = ['VW', 'SVW'].includes(rootComponent.qualifier);
let componentAction = null;
@@ -93,7 +93,7 @@ export default class Component extends React.Component {
{ metric: 'bugs', type: 'SHORT_INT' },
{ metric: 'vulnerabilities', type: 'SHORT_INT' },
{ metric: 'code_smells', type: 'SHORT_INT' },
- { metric: coverageMetric, type: 'PERCENT' },
+ { metric: 'coverage', type: 'PERCENT' },
{ metric: 'duplicated_lines_density', type: 'PERCENT' }
];
diff --git a/server/sonar-web/src/main/js/apps/code/components/Components.js b/server/sonar-web/src/main/js/apps/code/components/Components.js
index dc5a3da84e8..902ccccd345 100644
--- a/server/sonar-web/src/main/js/apps/code/components/Components.js
+++ b/server/sonar-web/src/main/js/apps/code/components/Components.js
@@ -23,7 +23,7 @@ import Component from './Component';
import ComponentsEmpty from './ComponentsEmpty';
import ComponentsHeader from './ComponentsHeader';
-const Components = ({ rootComponent, baseComponent, components, selected, coverageMetric }) => (
+const Components = ({ rootComponent, baseComponent, components, selected }) => (
<table className="data zebra">
<ComponentsHeader baseComponent={baseComponent} rootComponent={rootComponent}/>
{baseComponent && (
@@ -31,8 +31,7 @@ const Components = ({ rootComponent, baseComponent, components, selected, covera
<Component
key={baseComponent.key}
rootComponent={rootComponent}
- component={baseComponent}
- coverageMetric={coverageMetric}/>
+ component={baseComponent}/>
<tr className="blank">
<td colSpan="8">&nbsp;</td>
</tr>
@@ -47,7 +46,6 @@ const Components = ({ rootComponent, baseComponent, components, selected, covera
component={component}
selected={component === selected}
previous={index > 0 ? list[index - 1] : null}
- coverageMetric={coverageMetric}
canBrowse={true}/>
))
) : (
diff --git a/server/sonar-web/src/main/js/apps/code/utils.js b/server/sonar-web/src/main/js/apps/code/utils.js
index 80788455d4f..72c1f58425d 100644
--- a/server/sonar-web/src/main/js/apps/code/utils.js
+++ b/server/sonar-web/src/main/js/apps/code/utils.js
@@ -35,17 +35,11 @@ const METRICS = [
'code_smells',
'bugs',
'vulnerabilities',
+ 'coverage',
'duplicated_lines_density',
'alert_status'
];
-const METRICS_WITH_COVERAGE = [
- ...METRICS,
- 'coverage',
- 'it_coverage',
- 'overall_coverage'
-];
-
const VIEW_METRICS = [
'releasability_rating',
'alert_status',
@@ -117,7 +111,7 @@ function storeChildrenBreadcrumbs (parentComponentKey, children) {
}
function getMetrics (isView) {
- return isView ? VIEW_METRICS : METRICS_WITH_COVERAGE;
+ return isView ? VIEW_METRICS : METRICS;
}
/**
diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js b/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js
index b33de901b5f..67628c7e96e 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/config/complementary.js
@@ -18,18 +18,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
export default {
- 'overall_coverage': ['overall_uncovered_lines', 'overall_uncovered_conditions'],
- 'overall_line_coverage': ['overall_uncovered_lines'],
- 'overall_branch_coverage': ['overall_uncovered_conditions'],
- 'overall_uncovered_lines': ['overall_line_coverage'],
- 'overall_uncovered_conditions': ['overall_branch_coverage'],
-
- 'new_overall_coverage': ['new_overall_uncovered_lines', 'new_overall_uncovered_conditions'],
- 'new_overall_line_coverage': ['new_overall_uncovered_lines'],
- 'new_overall_branch_coverage': ['new_overall_uncovered_conditions'],
- 'new_overall_uncovered_lines': ['new_overall_line_coverage'],
- 'new_overall_uncovered_conditions': ['new_overall_branch_coverage'],
-
'coverage': ['uncovered_lines', 'uncovered_conditions'],
'line_coverage': ['uncovered_lines'],
'branch_coverage': ['uncovered_conditions'],
@@ -42,18 +30,6 @@ export default {
'new_uncovered_lines': ['new_line_coverage'],
'new_uncovered_conditions': ['new_branch_coverage'],
- 'it_coverage': ['it_uncovered_lines', 'it_uncovered_conditions'],
- 'it_line_coverage': ['it_uncovered_lines'],
- 'it_branch_coverage': ['it_uncovered_conditions'],
- 'it_uncovered_lines': ['it_line_coverage'],
- 'it_uncovered_conditions': ['it_branch_coverage'],
-
- 'new_it_coverage': ['new_it_uncovered_lines', 'new_it_uncovered_conditions'],
- 'new_it_line_coverage': ['new_it_uncovered_lines'],
- 'new_it_branch_coverage': ['new_it_uncovered_conditions'],
- 'new_it_uncovered_lines': ['new_it_line_coverage'],
- 'new_it_uncovered_conditions': ['new_it_branch_coverage'],
-
'duplicated_lines_density': ['duplicated_lines'],
'new_duplicated_lines_density': ['new_duplicated_lines'],
'duplicated_lines': ['duplicated_lines_density'],
diff --git a/server/sonar-web/src/main/js/apps/component-measures/config/domains.js b/server/sonar-web/src/main/js/apps/component-measures/config/domains.js
index 2c810ad9989..80a231995ec 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/config/domains.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/config/domains.js
@@ -68,27 +68,11 @@ export const domains = {
'Coverage': {
main: [
- 'overall_coverage',
'coverage',
- 'it_coverage',
- 'new_overall_coverage',
'new_coverage',
- 'new_it_coverage',
'tests'
],
order: [
- 'overall_coverage',
- 'new_overall_coverage',
- 'overall_line_coverage',
- 'new_overall_line_coverage',
- 'overall_branch_coverage',
- 'new_overall_branch_coverage',
- 'overall_uncovered_lines',
- 'new_overall_uncovered_lines',
- 'overall_uncovered_conditions',
- 'new_overall_uncovered_conditions',
- 'new_overall_lines_to_cover',
-
'coverage',
'new_coverage',
'line_coverage',
@@ -101,18 +85,6 @@ export const domains = {
'new_uncovered_conditions',
'new_lines_to_cover',
- 'it_coverage',
- 'new_it_coverage',
- 'it_line_coverage',
- 'new_it_line_coverage',
- 'it_branch_coverage',
- 'new_it_branch_coverage',
- 'it_uncovered_lines',
- 'new_it_uncovered_lines',
- 'it_uncovered_conditions',
- 'new_it_uncovered_conditions',
- 'new_it_lines_to_cover',
-
'lines_to_cover',
'tests',
@@ -122,11 +94,6 @@ export const domains = {
'skipped_tests',
'test_success_density',
'test_execution_time'
- ],
- spaces: [
- 'coverage',
- 'it_coverage',
- 'tests'
]
},
diff --git a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js
index 921a24f9f03..ce240293f58 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/home/HomeMeasuresList.js
@@ -33,26 +33,6 @@ function sortMeasures (measures, order) {
];
}
-function filterCoverageMeasures (measures) {
- const hasOverallCoverage = !!measures.find(measure => measure.metric.key === 'overall_coverage');
- const hasUTCoverage = !!measures.find(measure => measure.metric.key === 'coverage');
- const hasITCoverage = !!measures.find(measure => measure.metric.key === 'it_coverage');
-
- // display overall coverage only if all types of coverage exist
- const shouldShowOverallCoverage = hasOverallCoverage && hasUTCoverage && hasITCoverage;
-
- // skip if we should display overall coverage
- if (shouldShowOverallCoverage) {
- return measures;
- }
-
- // otherwise, hide all overall coverage measures
- return measures.filter(measure => {
- return measure.metric.key.indexOf('overall_') !== 0 &&
- measure.metric.key.indexOf('new_overall_') !== 0;
- });
-}
-
function filterIssuesMeasures (measures) {
const BANNED_MEASURES = [
'blocker_violations',
@@ -73,7 +53,7 @@ const HomeMeasuresList = ({ domain, component }) => {
const { measures, name } = domain;
const config = domains[name] || {};
- const filteredMeasures = filterCoverageMeasures(filterIssuesMeasures(measures));
+ const filteredMeasures = filterIssuesMeasures(measures);
const configMain = config.main || [];
const [mainMeasures, otherMeasures] = partition(filteredMeasures, measure => configMain.includes(measure.metric.key));
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 2c65059b388..a2791781168 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
@@ -57,15 +57,9 @@ const METRICS = [
'new_technical_debt',
// coverage
- 'overall_coverage',
- 'new_overall_coverage',
'coverage',
'new_coverage',
- 'it_coverage',
- 'new_it_coverage',
'new_lines_to_cover',
- 'new_it_lines_to_cover',
- 'new_overall_lines_to_cover',
'tests',
// duplications
@@ -83,8 +77,6 @@ const HISTORY_METRICS_LIST = [
'sqale_index',
'duplicated_lines_density',
'ncloc',
- 'overall_coverage',
- 'it_coverage',
'coverage'
];
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 1a6aaaee7d5..bfa8c94a754 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
@@ -26,41 +26,20 @@ import { formatMeasure, getPeriodValue } from '../../../helpers/measures';
import { translate } from '../../../helpers/l10n';
class Coverage extends React.Component {
- getCoverageMetricPrefix () {
+ getCoverage () {
const { measures } = this.props;
- const hasOverallCoverage = !!measures
- .find(measure => measure.metric.key === 'overall_coverage');
- const hasUTCoverage = !!measures
- .find(measure => measure.metric.key === 'coverage');
- const hasITCoverage = !!measures
- .find(measure => measure.metric.key === 'it_coverage');
-
- if (hasOverallCoverage && hasUTCoverage && hasITCoverage) {
- return 'overall_';
- } else if (hasITCoverage) {
- return 'it_';
- } else {
- return '';
- }
- }
-
- getCoverage (prefix) {
- const { measures } = this.props;
- const { value } = measures
- .find(measure => measure.metric.key === `${prefix}coverage`);
+ const { value } = measures.find(measure => measure.metric.key === 'coverage');
return Number(value);
}
- getNewCoverageMeasure (prefix) {
+ getNewCoverageMeasure () {
const { measures } = this.props;
- return measures
- .find(measure => measure.metric.key === `new_${prefix}coverage`);
+ return measures.find(measure => measure.metric.key === 'new_coverage');
}
- getNewLinesToCover (prefix) {
+ getNewLinesToCover () {
const { measures } = this.props;
- return measures
- .find(measure => measure.metric.key === `new_${prefix}lines_to_cover`);
+ return measures.find(measure => measure.metric.key === 'new_lines_to_cover');
}
renderHeader () {
@@ -69,9 +48,8 @@ class Coverage extends React.Component {
translate('metric.coverage.name'));
}
- renderTimeline (coverageMetricPrefix, range) {
- const metricKey = `${coverageMetricPrefix}coverage`;
- return this.props.renderTimeline(metricKey, range);
+ renderTimeline (range) {
+ return this.props.renderTimeline('coverage', range);
}
renderTests () {
@@ -86,10 +64,10 @@ class Coverage extends React.Component {
return this.props.renderDonut(data);
}
- renderCoverage (coverageMetricPrefix) {
+ renderCoverage () {
const { component } = this.props;
- const metric = `${coverageMetricPrefix}coverage`;
- const coverage = this.getCoverage(coverageMetricPrefix);
+ const metric = 'coverage';
+ const coverage = this.getCoverage();
return (
<div className="overview-domain-measure">
@@ -112,10 +90,10 @@ class Coverage extends React.Component {
);
}
- renderNewCoverage (coverageMetricPrefix) {
+ renderNewCoverage () {
const { component, leakPeriod } = this.props;
- const newCoverageMeasure = this.getNewCoverageMeasure(coverageMetricPrefix);
- const newLinesToCover = this.getNewLinesToCover(coverageMetricPrefix);
+ const newCoverageMeasure = this.getNewCoverageMeasure();
+ const newLinesToCover = this.getNewLinesToCover();
const newCoverageValue = newCoverageMeasure ?
getPeriodValue(newCoverageMeasure, leakPeriod.index) : null;
@@ -168,20 +146,20 @@ class Coverage extends React.Component {
);
}
- renderNutshell (coverageMetricPrefix) {
+ renderNutshell () {
return (
<div className="overview-domain-nutshell">
<div className="overview-domain-measures">
- {this.renderCoverage(coverageMetricPrefix)}
+ {this.renderCoverage()}
{this.renderTests()}
</div>
- {this.renderTimeline(coverageMetricPrefix, 'before')}
+ {this.renderTimeline('before')}
</div>
);
}
- renderLeak (coverageMetricPrefix) {
+ renderLeak () {
const { leakPeriod } = this.props;
if (leakPeriod == null) {
@@ -191,19 +169,17 @@ class Coverage extends React.Component {
return (
<div className="overview-domain-leak">
<div className="overview-domain-measures">
- {this.renderNewCoverage(coverageMetricPrefix)}
+ {this.renderNewCoverage()}
</div>
- {this.renderTimeline(coverageMetricPrefix, 'after')}
+ {this.renderTimeline('after')}
</div>
);
}
render () {
const { measures } = this.props;
- const coverageMetricPrefix = this.getCoverageMetricPrefix();
- const coverageMeasure =
- measures.find(measure => measure.metric.key === `${coverageMetricPrefix}coverage`);
+ const coverageMeasure = measures.find(measure => measure.metric.key === 'coverage');
if (coverageMeasure == null) {
return null;
@@ -214,8 +190,8 @@ class Coverage extends React.Component {
{this.renderHeader()}
<div className="overview-domain-panel">
- {this.renderNutshell(coverageMetricPrefix)}
- {this.renderLeak(coverageMetricPrefix)}
+ {this.renderNutshell()}
+ {this.renderLeak()}
</div>
</div>
);
diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js
index ca259f91d35..f1bdef0ea56 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/main.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/main.js
@@ -184,29 +184,15 @@ export default Marionette.LayoutView.extend({
return { from: 1, to: this.LINES_AROUND };
},
- getUTCoverageStatus (row) {
+ getCoverageStatus (row) {
let status = null;
- if (row.utLineHits > 0) {
+ if (row.lineHits > 0) {
status = 'partially-covered';
}
- if (row.utLineHits > 0 && row.utConditions === row.utCoveredConditions) {
+ if (row.lineHits > 0 && row.conditions === row.coveredConditions) {
status = 'covered';
}
- if (row.utLineHits === 0 || row.utCoveredConditions === 0) {
- status = 'uncovered';
- }
- return status;
- },
-
- getItCoverageStatus (row) {
- let status = null;
- if (row.itLineHits > 0) {
- status = 'partially-covered';
- }
- if (row.itLineHits > 0 && row.itConditions === row.itCoveredConditions) {
- status = 'covered';
- }
- if (row.itLineHits === 0 || row.itCoveredConditions === 0) {
+ if (row.lineHits === 0 || row.coveredConditions === 0) {
status = 'uncovered';
}
return status;
@@ -230,16 +216,14 @@ export default Marionette.LayoutView.extend({
}
source = source.map(function (row) {
return _.extend(row, {
- utCoverageStatus: that.getUTCoverageStatus(row),
- itCoverageStatus: that.getItCoverageStatus(row)
+ coverageStatus: that.getCoverageStatus(row),
});
});
const firstLine = _.first(source).line;
const linesRequested = data.to - data.from + 1;
that.model.set({
source,
- hasUTCoverage: that.model.hasUTCoverage(source),
- hasITCoverage: that.model.hasITCoverage(source),
+ hasCoverage: that.model.hasCoverage(source),
hasSourceBefore: firstLine > 1,
hasSourceAfter: data.sources.length === linesRequested
});
@@ -445,7 +429,6 @@ export default Marionette.LayoutView.extend({
const popup = new CoveragePopupView({
row,
collection: new Backbone.Collection(data.tests),
- tests: $(e.currentTarget).data('tests'),
triggerEl: $(e.currentTarget)
});
popup.render();
@@ -634,14 +617,12 @@ export default Marionette.LayoutView.extend({
}
source = source.map(function (row) {
return _.extend(row, {
- utCoverageStatus: that.getUTCoverageStatus(row),
- itCoverageStatus: that.getItCoverageStatus(row)
+ coverageStatus: that.getCoverageStatus(row)
});
});
that.model.set({
source,
- hasUTCoverage: that.model.hasUTCoverage(source),
- hasITCoverage: that.model.hasITCoverage(source),
+ hasCoverage: that.model.hasCoverage(source),
hasSourceBefore: (data.sources.length === that.LINES_AROUND) && (_.first(source).line > 0)
});
that.addIssuesPerLineMeta(that.issues);
@@ -680,14 +661,12 @@ export default Marionette.LayoutView.extend({
}
source = source.map(function (row) {
return _.extend(row, {
- utCoverageStatus: that.getUTCoverageStatus(row),
- itCoverageStatus: that.getItCoverageStatus(row)
+ coverageStatus: that.getCoverageStatus(row)
});
});
that.model.set({
source,
- hasUTCoverage: that.model.hasUTCoverage(source),
- hasITCoverage: that.model.hasITCoverage(source),
+ hasCoverage: that.model.hasCoverage(source),
hasSourceAfter: data.sources.length === that.LINES_AROUND
});
that.addIssuesPerLineMeta(that.issues);
diff --git a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js
index 1442ac49793..aaf665a5271 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/measures-overlay.js
@@ -131,12 +131,6 @@ export default ModalView.extend({
if (measures.conditions_to_cover && measures.uncovered_conditions) {
measures.covered_conditions = measures.conditions_to_cover - measures.uncovered_conditions;
}
- if (measures.it_lines_to_cover && measures.it_uncovered_lines) {
- measures.it_covered_lines = measures.it_lines_to_cover - measures.it_uncovered_lines;
- }
- if (measures.it_conditions_to_cover && measures.it_uncovered_conditions) {
- measures.it_covered_conditions = measures.it_conditions_to_cover - measures.it_uncovered_conditions;
- }
return measures;
},
diff --git a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js
index 891ebca66e6..4f1918625eb 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/popups/coverage-popup.js
@@ -54,16 +54,7 @@ export default Popup.extend({
tests: testSet
};
});
- _.extend(row, {
- lineHits: row[this.options.tests + 'LineHits'],
- conditions: row[this.options.tests + 'Conditions'],
- coveredConditions: row[this.options.tests + 'CoveredConditions']
- });
- return {
- testFiles,
- row,
- tests: this.options.tests
- };
+ return { testFiles, row };
}
});
diff --git a/server/sonar-web/src/main/js/components/source-viewer/source.js b/server/sonar-web/src/main/js/components/source-viewer/source.js
index 189c093f779..8a085468bb4 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/source.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/source.js
@@ -29,7 +29,6 @@ export default Backbone.Model.extend({
hasSource: false,
hasCoverage: false,
- hasITCoverage: false,
hasDuplications: false,
hasSCM: false,
@@ -94,15 +93,9 @@ export default Backbone.Model.extend({
this.set({ hasDuplications });
},
- hasUTCoverage (source) {
+ hasCoverage (source) {
return _.some(source, function (line) {
- return line.utCoverageStatus != null;
- });
- },
-
- hasITCoverage (source) {
- return _.some(source, function (line) {
- return line.itCoverageStatus != null;
+ return line.coverageStatus != null;
});
}
});
diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs
index 026a3de5310..7258237382a 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs
+++ b/server/sonar-web/src/main/js/components/source-viewer/templates/measures/_source-viewer-measures-coverage.hbs
@@ -1,15 +1,15 @@
-{{#any measures.coverage measures.it_coverage}}
+{{#if measures.coverage}}
<div class="measures">
<div class="measures-chart">
<span class="js-pie-chart"
- data-value="{{default measures.overall_coverage_raw measures.coverage_raw measures.it_coverage_raw}}"
+ data-value="{{measures.coverage_raw}}"
data-max="100"
data-color="#85bb43"
data-base-color="#d4333f"
data-size="47"></span>
</div>
<div class="measure measure-big" data-metric="coverage">
- <span class="measure-value">{{default measures.overall_coverage measures.coverage measures.it_coverage}}</span>
+ <span class="measure-value">{{measures.coverage}}</span>
<span class="measure-name">{{t 'metric.coverage.name'}}</span>
</div>
</div>
@@ -18,7 +18,7 @@
<div class="measures">
<div class="measures-list">
<div class="measure measure-one-line">
- <span class="measure-name">Covered by Unit Tests</span>
+ <span class="measure-name">Covered by Tests</span>
</div>
<div class="measure measure-one-line" data-metric="lines_to_cover">
<span class="measure-name">Lines</span>
@@ -33,24 +33,4 @@
</div>
</div>
{{/any}}
-
- {{#any measures.it_covered_lines measures.it_lines_to_cover measures.it_covered_conditions measures.it_conditions_to_cover}}
- <div class="measures">
- <div class="measures-list">
- <div class="measure measure-one-line">
- <span class="measure-name">Covered by Integration Tests</span>
- </div>
- <div class="measure measure-one-line" data-metric="it_lines_to_cover">
- <span class="measure-name">Lines</span>
- <span class="measure-value">{{measures.it_uncovered_lines}}/{{measures.it_lines_to_cover}}</span>
- </div>
- {{#if measures.it_conditions_to_cover}}
- <div class="measure measure-one-line" data-metric="it_conditions_to_cover">
- <span class="measure-name">Conditions</span>
- <span class="measure-value">{{default measures.it_uncovered_conditions 0}}/{{measures.it_conditions_to_cover}}</span>
- </div>
- {{/if}}
- </div>
- </div>
- {{/any}}
-{{/any}}
+{{/if}}
diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs
index 9906d547398..a0e7b62896e 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs
+++ b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-coverage-popup.hbs
@@ -1,12 +1,12 @@
<div class="bubble-popup-container">
<div class="bubble-popup-title">
{{#if row.lineHits}}
- {{t 'source_viewer' tests 'covered'}}
+ {{t 'source_viewer.covered'}}
{{#if row.conditions}}
({{default row.coveredConditions 0}} of {{row.conditions}} {{t 'source_viewer.conditions'}})
{{/if}}
{{else}}
- {{t 'source_viewer' tests 'not_covered'}}
+ {{t 'source_viewer.not_covered'}}
{{#if row.conditions}}
({{row.conditions}} {{t 'source_viewer.conditions'}})
{{/if}}
diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs
index a9dff3243e6..272abb83209 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs
+++ b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer-measures.hbs
@@ -31,13 +31,13 @@
{{> 'measures/_source-viewer-measures-issues'}}
</div>
- {{#any measures.coverage measures.it_coverage}}
+ {{#if measures.coverage}}
<div class="source-viewer-measures-section">
<div class="source-viewer-measures-card">
{{> 'measures/_source-viewer-measures-coverage'}}
</div>
</div>
- {{/any}}
+ {{/if}}
<div class="source-viewer-measures-section">
{{> 'measures/_source-viewer-measures-duplications'}}
diff --git a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs
index 15b73888633..ede6aeddde8 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs
+++ b/server/sonar-web/src/main/js/components/source-viewer/templates/source-viewer.hbs
@@ -27,18 +27,9 @@
{{/ifSCMChanged2}}
</td>
- {{#if ../hasUTCoverage}}
- <td class="source-meta source-line-coverage {{#notNull utCoverageStatus}}source-line-{{utCoverageStatus}}{{/notNull}}"
- data-tests="ut"
- data-line-number="{{line}}" {{#notNull utCoverageStatus}}title="{{t 'source_viewer.tooltip.ut' utCoverageStatus}}" data-placement="right" data-toggle="tooltip"{{/notNull}}>
- <div class="source-line-bar"></div>
- </td>
- {{/if}}
-
- {{#if ../hasITCoverage}}
- <td class="source-meta source-line-coverage {{#notNull itCoverageStatus}}source-line-{{itCoverageStatus}}{{/notNull}}"
- data-tests="it"
- data-line-number="{{line}}" {{#notNull itCoverageStatus}}title="{{t 'source_viewer.tooltip.it' itCoverageStatus}}" data-placement="right" data-toggle="tooltip"{{/notNull}}>
+ {{#if ../hasCoverage}}
+ <td class="source-meta source-line-coverage {{#notNull coverageStatus}}source-line-{{coverageStatus}}{{/notNull}}"
+ data-line-number="{{line}}" {{#notNull coverageStatus}}title="{{t 'source_viewer.tooltip' coverageStatus}}" data-placement="right" data-toggle="tooltip"{{/notNull}}>
<div class="source-line-bar"></div>
</td>
{{/if}}
diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js
index 8473c9e49ed..14cbd630c3a 100644
--- a/server/sonar-web/src/main/js/helpers/measures.js
+++ b/server/sonar-web/src/main/js/helpers/measures.js
@@ -113,25 +113,6 @@ export function isDiffMetric (metricKey) {
return metricKey.indexOf('new_') === 0;
}
-/**
- * Check all types of coverage and return most suitable one
- * @param {Array} measures
- * @returns {string}
- */
-export function selectCoverageMetric (measures) {
- const hasOverallCoverage = !!measures.find(measure => measure.metric === 'overall_coverage');
- const hasUTCoverage = !!measures.find(measure => measure.metric === 'coverage');
- const hasITCoverage = !!measures.find(measure => measure.metric === 'it_coverage');
-
- if (hasOverallCoverage && hasUTCoverage && hasITCoverage) {
- return 'overall_';
- } else if (hasITCoverage) {
- return 'it_';
- } else {
- return '';
- }
-}
-
/*
* Helpers
*/