diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2014-06-19 12:37:10 +0600 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2014-06-19 12:37:10 +0600 |
commit | 2f90b1d6cf95f275d8dfc891c9b4f116ff3d7d0d (patch) | |
tree | 49796db7f0a83f5279833afc79a9e69bb854624c /sonar-server | |
parent | b373de2d0cc912708315b2ce45b6b48e9bda6849 (diff) | |
download | sonarqube-2f90b1d6cf95f275d8dfc891c9b4f116ff3d7d0d.tar.gz sonarqube-2f90b1d6cf95f275d8dfc891c9b4f116ff3d7d0d.zip |
SONAR-5209 Differential mode feedback
Diffstat (limited to 'sonar-server')
8 files changed, 67 insertions, 28 deletions
diff --git a/sonar-server/src/main/coffee/component-viewer/header.coffee b/sonar-server/src/main/coffee/component-viewer/header.coffee index f46a87fa4bb..47483ea3a14 100644 --- a/sonar-server/src/main/coffee/component-viewer/header.coffee +++ b/sonar-server/src/main/coffee/component-viewer/header.coffee @@ -131,7 +131,11 @@ define [ enableBarItem: (item) -> - @$(item).click() + $item = @$(item) + if $item.length > 0 + @$(item).click() + else + @options.main.hideAllLines() showExpandedBar: (e) -> diff --git a/sonar-server/src/main/coffee/component-viewer/header/coverage-header.coffee b/sonar-server/src/main/coffee/component-viewer/header/coverage-header.coffee index 9be848b52cc..1c426b35379 100644 --- a/sonar-server/src/main/coffee/component-viewer/header/coverage-header.coffee +++ b/sonar-server/src/main/coffee/component-viewer/header/coverage-header.coffee @@ -38,7 +38,7 @@ define [ main: @options.main bottom: true popup.render() - popup.on 'change', (period) => @main.enablePeriod period + popup.on 'change', (period) => @main.enablePeriod period, 'coverage' filterByLinesToCover: (e) -> diff --git a/sonar-server/src/main/coffee/component-viewer/header/issues-header.coffee b/sonar-server/src/main/coffee/component-viewer/header/issues-header.coffee index 54e2c93dc25..fa066fe0298 100644 --- a/sonar-server/src/main/coffee/component-viewer/header/issues-header.coffee +++ b/sonar-server/src/main/coffee/component-viewer/header/issues-header.coffee @@ -48,7 +48,7 @@ define [ triggerEl: $(e.currentTarget) main: @options.main bottom: true - prefix: 'Added' + prefix: t 'component_viewer.added' popup.render() popup.on 'change', (period) => @main.enablePeriod period, 'issues' @@ -110,4 +110,6 @@ define [ serializeData: -> - _.extend super, period: @state.get('period')?.toJSON()
\ No newline at end of file + _.extend super, + period: @state.get('period')?.toJSON() + hasIssues: @state.get('severities')?.length || @state.get('rules')?.length
\ No newline at end of file diff --git a/sonar-server/src/main/coffee/component-viewer/main.coffee b/sonar-server/src/main/coffee/component-viewer/main.coffee index 68a95f0f34c..8dd9ad705e1 100644 --- a/sonar-server/src/main/coffee/component-viewer/main.coffee +++ b/sonar-server/src/main/coffee/component-viewer/main.coffee @@ -184,7 +184,7 @@ define [ measures = @component.get 'measures' measuresList.forEach (m) -> key = m.key.substr(4) - variation = "var#{period}" + variation = "fvar#{period}" measures[key] = m[variation] @component.set 'measures', measures @@ -251,15 +251,22 @@ define [ @sourceView.render() + hideAllLines: -> + @sourceView.resetShowBlocks() + @sourceView.render() + + enablePeriod: (periodKey, scope = 'scm') -> period = if periodKey == '' then null else @periods.findWhere key: periodKey @state.set 'period', period $.when(@requestMeasures(@key, period?.get('key')), @requestIssuesPeriod(@key, period?.get('key')), @requestSCM(@key)).done => - @headerView.render() if scope == 'issues' - @filterByUnresolvedIssues() unless @state.get('activeHeaderItem') - else - @filterBySCM() + @state.set 'activeHeaderItem', '.js-filter-unresolved-issues' + @headerView.render() + else if scope == 'coverage' + @state.set 'activeHeaderItem', '.js-filter-lines-to-cover' + @headerView.render() + else @filterBySCM() addTransition: (transition, options) -> diff --git a/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs b/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs index c2b0a87ab81..f2b084d9c2b 100644 --- a/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs +++ b/sonar-server/src/main/hbs/component-viewer/header/coverage-header.hbs @@ -1,10 +1,18 @@ <div class="component-viewer-header-time-changes"> <a class="highlighted-link js-coverage-time-changes"> - {{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> Time Changes{{/if}} + {{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}} </a> </div> {{#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}} + {{else}} + <div class="component-viewer-header-expanded-bar-section"> + <div class="component-viewer-header-expanded-bar-section-title"> + {{t 'component_viewer.no_coverage'}} + </div> + {{/any}} + <span class="nowrap"> {{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines}} <div class="component-viewer-header-expanded-bar-section"> @@ -22,9 +30,17 @@ {{#any branch_coverage conditions_to_cover covered_conditions uncovered_conditions}} <div class="component-viewer-header-expanded-bar-section"> - <div class="component-viewer-header-expanded-bar-section-title"> </div> + <div class="component-viewer-header-expanded-bar-section-title"> + {{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines}} + + {{else}} + {{t 'component_viewer.measure_section.unit_tests'}} + {{/any}} + </div> <ul class="component-viewer-header-expanded-bar-section-list"> - <li><span class="item"> </span></li> + {{#any coverage line_coverage lines_to_cover covered_lines uncovered_lines}} + <li><span class="item"> </span></li> + {{/any}} {{{componentViewerHeaderItem branch_coverage 'branch_coverage'}}} {{{componentViewerHeaderLink conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover'}}} {{{componentViewerHeaderLink uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches'}}} @@ -50,9 +66,17 @@ {{#any it_branch_coverage it_conditions_to_cover it_covered_conditions it_uncovered_conditions}} <div class="component-viewer-header-expanded-bar-section"> - <div class="component-viewer-header-expanded-bar-section-title"> </div> + <div class="component-viewer-header-expanded-bar-section-title"> + {{#any it_coverage it_line_coverage it_lines_to_cover it_covered_lines it_uncovered_lines}} + + {{else}} + {{t 'component_viewer.measure_section.integration_tests'}} + {{/any}} + </div> <ul class="component-viewer-header-expanded-bar-section-list"> - <li><span class="item"> </span></li> + {{#any it_coverage it_line_coverage it_lines_to_cover it_covered_lines it_uncovered_lines}} + <li><span class="item"> </span></li> + {{/any}} {{{componentViewerHeaderItem it_branch_coverage 'branch_coverage'}}} {{{componentViewerHeaderLink it_conditions_to_cover 'conditions_to_cover' 'js-filter-branches-to-cover-it'}}} {{{componentViewerHeaderLink it_uncovered_conditions 'uncovered_conditions' 'js-filter-uncovered-branches-it'}}} diff --git a/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs b/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs index bca87c9c4a0..3a6236b6779 100644 --- a/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs +++ b/sonar-server/src/main/hbs/component-viewer/header/issues-header.hbs @@ -1,6 +1,6 @@ <div class="component-viewer-header-time-changes"> <a class="highlighted-link js-issues-time-changes"> - {{#if period}}Added {{period.label}}{{else}}<i class="icon-period"></i> Time Changes{{/if}} + {{#if period}}{{t 'component_viewer.added'}} {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}} </a> </div> @@ -40,7 +40,7 @@ <div class="component-viewer-header-expanded-bar-section"> <div class="component-viewer-header-expanded-bar-section-title"> - {{t 'component_viewer.measure_section.issues'}} + {{#if hasIssues}} {{else}}{{t 'component_viewer.no_issues'}}{{/if}} </div> <ul class="component-viewer-header-expanded-bar-section-list"> {{#if currentIssue}} @@ -65,13 +65,15 @@ </ul> </div> -<div class="component-viewer-header-expanded-bar-section component-viewer-header-expanded-bar-section-actions"> - <div class="component-viewer-header-expanded-bar-section-title"> </div> - <ul class="component-viewer-header-expanded-bar-section-list"> - {{#if state.canBulkChange}} - <li><a class="link-action js-issues-bulk-change"> - <span><i class="icon-bulk-change"></i> {{t 'bulk_change'}}</span> - </a></li> - {{/if}} - </ul> -</div> +{{#if hasIssues}} + <div class="component-viewer-header-expanded-bar-section component-viewer-header-expanded-bar-section-actions"> + <div class="component-viewer-header-expanded-bar-section-title"> </div> + <ul class="component-viewer-header-expanded-bar-section-list"> + {{#if state.canBulkChange}} + <li><a class="link-action js-issues-bulk-change"> + <span><i class="icon-bulk-change"></i> {{t 'bulk_change'}}</span> + </a></li> + {{/if}} + </ul> + </div> +{{/if}} diff --git a/sonar-server/src/main/hbs/component-viewer/header/scm-header.hbs b/sonar-server/src/main/hbs/component-viewer/header/scm-header.hbs index 8f60976ae3b..d5802abdd57 100644 --- a/sonar-server/src/main/hbs/component-viewer/header/scm-header.hbs +++ b/sonar-server/src/main/hbs/component-viewer/header/scm-header.hbs @@ -1,5 +1,5 @@ <div class="component-viewer-header-time-changes"> <a class="highlighted-link js-scm-time-changes"> - {{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> Time Changes{{/if}} + {{#if period}}Δ {{period.label}}{{else}}<i class="icon-period"></i> {{t 'component_viewer.time_changes'}}{{/if}} </a> </div>
\ No newline at end of file diff --git a/sonar-server/src/main/js/common/handlebars-extensions.js b/sonar-server/src/main/js/common/handlebars-extensions.js index 9f6348a61c8..b0fc9ccb818 100644 --- a/sonar-server/src/main/js/common/handlebars-extensions.js +++ b/sonar-server/src/main/js/common/handlebars-extensions.js @@ -138,7 +138,7 @@ define(['handlebars', 'moment'], function (Handlebars, moment) { notEmpty = args.reduce(function(prev, current) { return prev || (current && current.length > 0); }, false); - return notEmpty ? options.fn(this) : ''; + return notEmpty ? options.fn(this) : options.inverse(this); }); Handlebars.registerHelper('join', function(array, separator) { |