From 71606c2451d08d0c6c35970afc88b20d76bc3928 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Mon, 2 Mar 2015 13:12:11 +0100 Subject: [PATCH] SONAR-5884 show ut and it coverage separately --- .../main/hbs/source-viewer/source-viewer.hbs | 17 ++++++--- .../src/main/js/source-viewer/source.js | 13 +++++++ .../src/main/js/source-viewer/viewer.js | 35 +++++++++++++++++-- .../resources/org/sonar/l10n/core.properties | 9 +++-- 4 files changed, 64 insertions(+), 10 deletions(-) diff --git a/server/sonar-web/src/main/hbs/source-viewer/source-viewer.hbs b/server/sonar-web/src/main/hbs/source-viewer/source-viewer.hbs index 0f239f255df..7e57cd08867 100644 --- a/server/sonar-web/src/main/hbs/source-viewer/source-viewer.hbs +++ b/server/sonar-web/src/main/hbs/source-viewer/source-viewer.hbs @@ -17,10 +17,19 @@ {{/ifSCMChanged2}} - -
- + {{#if ../hasCoverage}} + +
+ + {{/if}} + + {{#if ../hasITCoverage}} + +
+ + {{/if}} {{#if ../hasDuplications}} 0) { + status = 'partially-covered'; + } + if (row.itLineHits > 0 && row.itConditions === row.itCoveredConditions) { + status = 'covered'; + } + if (row.itLineHits === 0 || row.itCoveredConditions === 0) { + status = 'uncovered'; + } + return status; + }, + requestSource: function () { var that = this, url = baseUrl + '/api/sources/lines', @@ -190,12 +204,17 @@ define([ source.unshift({line: 0}); } source = source.map(function (row) { - return _.extend(row, { coverageStatus: that.getCoverageStatus(row) }); + return _.extend(row, { + coverageStatus: that.getCoverageStatus(row), + itCoverageStatus: that.getItCoverageStatus(row) + }); }); var firstLine = _.first(source).line, linesRequested = options.to - options.from + 1; that.model.set({ source: source, + hasCoverage: that.model.hasCoverage(source), + hasITCoverage: that.model.hasITCoverage(source), hasSourceBefore: firstLine > 1, hasSourceAfter: data.sources.length === linesRequested }); @@ -573,10 +592,15 @@ define([ source.unshift({line: 0}); } source = source.map(function (row) { - return _.extend(row, { coverageStatus: that.getCoverageStatus(row) }); + return _.extend(row, { + coverageStatus: that.getCoverageStatus(row), + itCoverageStatus: that.getItCoverageStatus(row) + }); }); that.model.set({ source: source, + hasCoverage: that.model.hasCoverage(source), + hasITCoverage: that.model.hasITCoverage(source), hasSourceBefore: (data.sources.length === that.LINES_AROUND) && (_.first(source).line > 0) }); that.addIssuesPerLineMeta(that.issues); @@ -611,10 +635,15 @@ define([ that.model.set({ hasSourceBefore: true }); } source = source.map(function (row) { - return _.extend(row, { coverageStatus: that.getCoverageStatus(row) }); + return _.extend(row, { + coverageStatus: that.getCoverageStatus(row), + itCoverageStatus: that.getItCoverageStatus(row) + }); }); that.model.set({ source: source, + hasCoverage: that.model.hasCoverage(source), + hasITCoverage: that.model.hasITCoverage(source), hasSourceAfter: data.sources.length === that.LINES_AROUND }); that.addIssuesPerLineMeta(that.issues); 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 daa7a8c7a4a..545f6985999 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2900,9 +2900,12 @@ source_viewer.conditions=conditions source_viewer.tooltip.duplicated_line=This line is duplicated. Click to see duplicated blocks. source_viewer.tooltip.duplicated_block=Duplicated block. Click for details. -source_viewer.tooltip.covered=Fully covered by tests. Click for details. -source_viewer.tooltip.partially-covered=Partially covered by tests. Click for details. -source_viewer.tooltip.uncovered=Not covered by tests. +source_viewer.tooltip.ut.covered=Fully covered by unit tests. Click for details. +source_viewer.tooltip.ut.partially-covered=Partially covered by unit tests. Click for details. +source_viewer.tooltip.ut.uncovered=Not covered by unit tests. +source_viewer.tooltip.it.covered=Fully covered by integration tests. Click for details. +source_viewer.tooltip.it.partially-covered=Partially covered by integration tests. Click for details. +source_viewer.tooltip.it.uncovered=Not covered by integration tests. source_viewer.tooltip.new_code=New {0}. -- 2.39.5