From: Stas Vilchik Date: Wed, 23 Jul 2014 08:51:31 +0000 (+0200) Subject: Fix SCM header, add "modified lines" filter X-Git-Tag: 4.4~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1e17189d70805099efd4a770e9cc5e35b9795548;p=sonarqube.git Fix SCM header, add "modified lines" filter --- 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 a7ee0612df5..698c89fe519 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2650,6 +2650,8 @@ component_viewer.header.toggle_coverage=Toggle coverage component_viewer.header.toggle_duplications=Toggle duplications component_viewer.header.toggle_scm=Toggle SCM +component_viewer.scm.modified_lines=Modified Lines + component_viewer.transition.coverage=Covered By component_viewer.transition.covers=Covers component_viewer.transition.duplication=Duplicated By diff --git a/sonar-server/src/main/coffee/component-viewer/header/scm-header.coffee b/sonar-server/src/main/coffee/component-viewer/header/scm-header.coffee index 29e44cfa472..07523ce8cf5 100644 --- a/sonar-server/src/main/coffee/component-viewer/header/scm-header.coffee +++ b/sonar-server/src/main/coffee/component-viewer/header/scm-header.coffee @@ -20,6 +20,8 @@ define [ events: 'click .js-scm-time-changes': 'scmTimeChanges' + 'click .js-filter-modified-lines': 'filterByModifiedLines' + scmTimeChanges: (e) -> e.stopPropagation() @@ -32,5 +34,10 @@ define [ popup.on 'change', (period) => @main.enablePeriod period + filterByModifiedLines: (e) -> + @header.filterLines e, 'filterByModifiedLines' + @state.set 'activeHeaderItem', '.js-filter-modified-lines' + + serializeData: -> _.extend super, period: @state.get('period')?.toJSON() diff --git a/sonar-server/src/main/coffee/component-viewer/main.coffee b/sonar-server/src/main/coffee/component-viewer/main.coffee index 32e4cd8697c..f7ebd36315f 100644 --- a/sonar-server/src/main/coffee/component-viewer/main.coffee +++ b/sonar-server/src/main/coffee/component-viewer/main.coffee @@ -301,8 +301,7 @@ define [ $.when(@requestMeasures(@key, period?.get('key')), @requestIssuesPeriod(@key, period?.get('key')), @requestSCM(@key)).done => if activeHeaderItem? @state.set 'activeHeaderItem', activeHeaderItem - @headerView.render() - else @filterBySCM() + @headerView.render() addTransition: (transition, options) -> diff --git a/sonar-server/src/main/coffee/component-viewer/mixins/main-scm.coffee b/sonar-server/src/main/coffee/component-viewer/mixins/main-scm.coffee index 23c899f185f..d13be6b4e18 100644 --- a/sonar-server/src/main/coffee/component-viewer/mixins/main-scm.coffee +++ b/sonar-server/src/main/coffee/component-viewer/mixins/main-scm.coffee @@ -47,6 +47,10 @@ define [], () -> @sourceView.render() + filterByModifiedLines: -> + @filterBySCM() + + filterBySCM: -> requests = [@requestSCM(@key)] if @settings.get('issues') && !@state.get('hasIssues') @@ -76,4 +80,4 @@ define [], () -> @sourceView.addShowBlock scmBlockLine, line.lineNumber - 1 if predicate @sourceView.addShowBlock scmBlockLine, _.size @source.get 'source' - @sourceView.render() \ No newline at end of file + @sourceView.render() 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 d5802abdd57..599f9f71e33 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 @@ -2,4 +2,13 @@ {{#if period}}Δ {{period.label}}{{else}} {{t 'component_viewer.time_changes'}}{{/if}} - \ No newline at end of file + + +
+ +