aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-07-22 13:05:30 +0200
committerStas Vilchik <vilchiks@gmail.com>2014-07-22 13:05:30 +0200
commitb3bbe32f490ef117d4bc66ba33923bc7bdeeffd9 (patch)
tree3b6e6da4903212d39e7894cd1eb0489de696759a /server
parente24f017a3d20d9320a4dee91596d33d4e27b32bf (diff)
downloadsonarqube-b3bbe32f490ef117d4bc66ba33923bc7bdeeffd9.tar.gz
sonarqube-b3bbe32f490ef117d4bc66ba33923bc7bdeeffd9.zip
SONAR-5400 Add overall coverage to the new Component Viewer
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/coffee/component-viewer/header/coverage-header.coffee26
-rw-r--r--server/sonar-web/src/main/coffee/component-viewer/main.coffee4
-rw-r--r--server/sonar-web/src/main/coffee/component-viewer/mixins/main-coverage.coffee26
-rw-r--r--server/sonar-web/src/main/hbs/component-viewer/header/cw-coverage-header.hbs53
4 files changed, 107 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/coffee/component-viewer/header/coverage-header.coffee b/server/sonar-web/src/main/coffee/component-viewer/header/coverage-header.coffee
index 9f77bc9dd7d..330f8b0f71a 100644
--- a/server/sonar-web/src/main/coffee/component-viewer/header/coverage-header.coffee
+++ b/server/sonar-web/src/main/coffee/component-viewer/header/coverage-header.coffee
@@ -24,11 +24,17 @@ define [
'click .js-filter-uncovered-lines': 'filterByUncoveredLines'
'click .js-filter-branches-to-cover': 'filterByBranchesToCover'
'click .js-filter-uncovered-branches': 'filterByUncoveredBranches'
+
'click .js-filter-lines-to-cover-it': 'filterByLinesToCoverIT'
'click .js-filter-uncovered-lines-it': 'filterByUncoveredLinesIT'
'click .js-filter-branches-to-cover-it': 'filterByBranchesToCoverIT'
'click .js-filter-uncovered-branches-it': 'filterByUncoveredBranchesIT'
+ 'click .js-filter-lines-to-cover-overall': 'filterByLinesToCoverOverall'
+ 'click .js-filter-uncovered-lines-overall': 'filterByUncoveredLinesOverall'
+ 'click .js-filter-branches-to-cover-overall': 'filterByBranchesToCoverOverall'
+ 'click .js-filter-uncovered-branches-overall': 'filterByUncoveredBranchesOverall'
+
coverageTimeChanges: (e) ->
e.stopPropagation()
@@ -81,5 +87,25 @@ define [
@state.set 'activeHeaderItem', '.js-filter-uncovered-branches-it'
+ filterByLinesToCoverOverall: (e) ->
+ @header.filterLines e, 'filterByLinesToCoverOverall'
+ @state.set 'activeHeaderItem', '.js-filter-lines-to-cover-overall'
+
+
+ filterByUncoveredLinesOverall: (e) ->
+ @header.filterLines e, 'filterByUncoveredLinesOverall'
+ @state.set 'activeHeaderItem', '.js-filter-uncovered-lines-overall'
+
+
+ filterByBranchesToCoverOverall: (e) ->
+ @header.filterLines e, 'filterByBranchesToCoverOverall'
+ @state.set 'activeHeaderItem', '.js-filter-branches-to-cover-overall'
+
+
+ filterByUncoveredBranchesOverall: (e) ->
+ @header.filterLines e, 'filterByUncoveredBranchesOverall'
+ @state.set 'activeHeaderItem', '.js-filter-uncovered-branches-overall'
+
+
serializeData: ->
_.extend super, period: @state.get('period')?.toJSON()
diff --git a/server/sonar-web/src/main/coffee/component-viewer/main.coffee b/server/sonar-web/src/main/coffee/component-viewer/main.coffee
index ff35d806b79..fcf5ca96c13 100644
--- a/server/sonar-web/src/main/coffee/component-viewer/main.coffee
+++ b/server/sonar-web/src/main/coffee/component-viewer/main.coffee
@@ -54,7 +54,9 @@ define [
COVERAGE_METRIC_LIST = 'coverage,line_coverage,lines_to_cover,covered_lines,uncovered_lines,' +
'branch_coverage,conditions_to_cover,uncovered_conditions,' +
'it_coverage,it_line_coverage,it_lines_to_cover,it_covered_lines,it_uncovered_lines,' +
- 'it_branch_coverage,it_conditions_to_cover,it_uncovered_conditions'
+ 'it_branch_coverage,it_conditions_to_cover,it_uncovered_conditions,' +
+ 'overall_coverage,overall_line_coverage,overall_lines_to_cover,overall_covered_lines,overall_uncovered_lines,' +
+ 'overall_branch_coverage,overall_conditions_to_cover,overall_uncovered_conditions'
ISSUES_METRIC_LIST = 'blocker_violations,critical_violations,major_violations,minor_violations,info_violations,' +
'false_positive_issues'
diff --git a/server/sonar-web/src/main/coffee/component-viewer/mixins/main-coverage.coffee b/server/sonar-web/src/main/coffee/component-viewer/mixins/main-coverage.coffee
index 9e3390f77e0..63a4bc5f78a 100644
--- a/server/sonar-web/src/main/coffee/component-viewer/mixins/main-coverage.coffee
+++ b/server/sonar-web/src/main/coffee/component-viewer/mixins/main-coverage.coffee
@@ -62,6 +62,14 @@ define [], () ->
@_filterByCoverage(predicate)
+ filterByCoverageOverall: (predicate) ->
+ requests = [@requestCoverage(@key, 'OVERALL')]
+ if @settings.get('issues') && !@state.get('hasIssues')
+ requests.push @requestIssues @key
+ $.when.apply($, requests).done =>
+ @_filterByCoverage(predicate)
+
+
_filterByCoverage: (predicate) ->
period = @state.get('period')
if period
@@ -114,3 +122,21 @@ define [], () ->
filterByUncoveredBranchesIT: ->
@filterByCoverageIT (line) -> line?.coverage?.branches? && line.coverage.coveredBranches? &&
line.coverage.branches > line.coverage.coveredBranches
+
+
+ # Overall
+ filterByLinesToCoverOverall: ->
+ @filterByCoverageOverall (line) -> line?.coverage?.covered?
+
+
+ filterByUncoveredLinesOverall: ->
+ @filterByCoverageOverall (line) -> line?.coverage?.covered? && !line.coverage.covered
+
+
+ filterByBranchesToCoverOverall: ->
+ @filterByCoverageOverall (line) -> line?.coverage?.branches?
+
+
+ filterByUncoveredBranchesOverall: ->
+ @filterByCoverageOverall (line) -> line?.coverage?.branches? && line.coverage.coveredBranches? &&
+ line.coverage.branches > line.coverage.coveredBranches
diff --git a/server/sonar-web/src/main/hbs/component-viewer/header/cw-coverage-header.hbs b/server/sonar-web/src/main/hbs/component-viewer/header/cw-coverage-header.hbs
index f43fcf32b12..2873c9b4cfe 100644
--- a/server/sonar-web/src/main/hbs/component-viewer/header/cw-coverage-header.hbs
+++ b/server/sonar-web/src/main/hbs/component-viewer/header/cw-coverage-header.hbs
@@ -7,15 +7,66 @@
{{/if}}
{{#with component.measures}}
- {{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines branch_coverage conditions_to_cover covered_conditions uncovered_conditions it_coverage it_line_coverage it_lines_to_cover it_covered_lines it_uncovered_lines it_branch_coverage it_conditions_to_cover it_covered_conditions it_uncovered_conditions}}
+ {{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines branch_coverage conditions_to_cover
+ covered_conditions uncovered_conditions it_coverage it_line_coverage it_lines_to_cover it_covered_lines
+ it_uncovered_lines it_branch_coverage it_conditions_to_cover it_covered_conditions it_uncovered_conditions
+ overall_coverage overall_line_coverage overall_lines_to_cover overall_covered_lines overall_uncovered_lines
+ overall_branch_coverage overall_conditions_to_cover overall_covered_conditions overall_uncovered_conditions}}
{{else}}
<div class="component-viewer-header-expanded-bar-section">
<div class="component-viewer-header-expanded-bar-section-title">
{{t 'component_viewer.no_coverage'}}
</div>
+ </div>
{{/any}}
<span class="nowrap">
+ {{#any overall_coverage overall_line_coverage overall_lines_to_cover overall_covered_lines overall_uncovered_lines}}
+ <div class="component-viewer-header-expanded-bar-section">
+ <div class="component-viewer-header-expanded-bar-section-title">
+ {{t 'component_viewer.measure_section.overall'}}
+ </div>
+ <ul class="component-viewer-header-expanded-bar-section-list">
+ {{{componentViewerHeaderItem overall_coverage 'coverage'}}}
+ {{{componentViewerHeaderItem overall_line_coverage 'line_coverage'}}}
+ {{#if ../../state.hasSource}}
+ {{{componentViewerHeaderLink overall_lines_to_cover 'lines_to_cover' 'js-filter-lines-to-cover-overall'}}}
+ {{{componentViewerHeaderLink overall_uncovered_lines 'uncovered_lines' 'js-filter-uncovered-lines-overall'}}}
+ {{else}}
+ {{{componentViewerHeaderItem overall_lines_to_cover 'lines_to_cover'}}}
+ {{{componentViewerHeaderItem overall_uncovered_lines 'uncovered_lines'}}}
+ {{/if}}
+ </ul>
+ </div>
+ {{/any}}
+
+ {{#any overall_branch_coverage overall_conditions_to_cover overall_covered_conditions overall_uncovered_conditions}}
+ <div class="component-viewer-header-expanded-bar-section">
+ <div class="component-viewer-header-expanded-bar-section-title">
+ {{#any overall_coverage overall_line_coverage overall_lines_to_cover overall_covered_lines overall_uncovered_lines}}
+ &nbsp;
+ {{else}}
+ {{t 'component_viewer.measure_section.overall'}}
+ {{/any}}
+ </div>
+ <ul class="component-viewer-header-expanded-bar-section-list">
+ {{#any overall_coverage overall_line_coverage overall_lines_to_cover overall_covered_lines overall_uncovered_lines}}
+ <li><span class="item">&nbsp;</span></li>
+ {{/any}}
+ {{{componentViewerHeaderItem overall_branch_coverage 'branch_coverage'}}}
+ {{#if ../../state.hasSource}}
+ {{{componentViewerHeaderLink overall_conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover-overall'}}}
+ {{{componentViewerHeaderLink overall_uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches-overall'}}}
+ {{else}}
+ {{{componentViewerHeaderItem overall_conditions_to_cover 'conditions_to_cover'}}}
+ {{{componentViewerHeaderItem overall_uncovered_conditions 'uncovered_conditions'}}}
+ {{/if}}
+ </ul>
+ </div>
+ {{/any}}
+ </span>
+
+ <span class="nowrap">
{{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines}}
<div class="component-viewer-header-expanded-bar-section">
<div class="component-viewer-header-expanded-bar-section-title">