]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5209 Differential mode
authorStas Vilchik <vilchiks@gmail.com>
Mon, 16 Jun 2014 06:00:16 +0000 (12:00 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 16 Jun 2014 06:00:16 +0000 (12:00 +0600)
sonar-server/src/main/coffee/component-viewer/header.coffee
sonar-server/src/main/coffee/component-viewer/header/coverage-header.coffee
sonar-server/src/main/coffee/component-viewer/header/issues-header.coffee
sonar-server/src/main/coffee/component-viewer/header/scm-header.coffee
sonar-server/src/main/coffee/component-viewer/main.coffee
sonar-server/src/main/coffee/component-viewer/mixins/main-issues.coffee
sonar-server/src/main/coffee/component-viewer/mixins/main-scm.coffee

index f0487c4b8facc4272a13c0c461512361c51b53f4..8e2fa9457b8b957374f141d2765a973778d8933f 100644 (file)
@@ -125,10 +125,9 @@ define [
         @barRegion.show new bar.view
           main: @options.main, state: @state, component: @component, settings: @settings, source: @model, header: @
         @ui.expandLinks.filter("[data-scope=#{scope}]").addClass 'active'
-
-
-    enableBarItem: (item) ->
-      @$(item).click()
+        activeHeaderItem = @state.get 'activeHeaderItem'
+        if activeHeaderItem
+          @$(activeHeaderItem).addClass 'active'
 
 
     showExpandedBar: (e) ->
index ecf1b4b0618cf14c1ee982b45a52a5525ce6979f..9be848b52cc919c6a1beecd55574a8f36755e63e 100644 (file)
@@ -38,7 +38,7 @@ define [
         main: @options.main
         bottom: true
       popup.render()
-      popup.on 'change', (period) => @main.enableSCMPeriod period
+      popup.on 'change', (period) => @main.enablePeriod period
 
 
     filterByLinesToCover: (e) ->
index f9b20516a87cc922722a343c4547c7b7b0c72eb5..7f64b2bfebad89f15246347a6a01024ddbfa0382 100644 (file)
@@ -50,7 +50,7 @@ define [
         bottom: true
         prefix: 'Added'
       popup.render()
-      popup.on 'change', (period) => @main.enableIssuesPeriod period
+      popup.on 'change', (period) => @main.enablePeriod period
 
 
     filterByCurrentIssue: (e) ->
@@ -110,4 +110,4 @@ define [
 
 
     serializeData: ->
-      _.extend super, period: @state.get('issuesPeriod')?.toJSON()
\ No newline at end of file
+      _.extend super, period: @state.get('period')?.toJSON()
\ No newline at end of file
index a44ad648b6c34786f41ab5d5b3e23cc907158636..29e44cfa472412ad18084314f1d30a4487c2d968 100644 (file)
@@ -29,7 +29,7 @@ define [
         main: @options.main
         bottom: true
       popup.render()
-      popup.on 'change', (period) => @main.enableSCMPeriod period
+      popup.on 'change', (period) => @main.enablePeriod period
 
 
     serializeData: ->
index d4ec05e010953d2aff11607ce1b69254df239819..9d3c8c990e2ace6790db12ecca4cbe03856c2028 100644 (file)
@@ -249,6 +249,18 @@ define [
       @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'))).done =>
+        @headerView.render()
+        unless @state.get('activeHeaderItem')
+          if @state.get('activeHeaderTab') == 'issues'
+            @filterByUnresolvedIssues()
+          else
+            @filterBySCM()
+
+
     addTransition: (transition, options) ->
       @workspace.add
         key: @component.get 'key'
index c396afa3c6c3e6ccf44910579994a1358606775e..f242a91e1c052c79637480b8d88f6ce2b742867f 100644 (file)
@@ -45,13 +45,6 @@ define [], () ->
         @state.set rules: rules, severities: severities
 
 
-    enableIssuesPeriod: (periodKey) ->
-      period = if periodKey == '' then null else @periods.findWhere key: periodKey
-      @state.set 'issuesPeriod', period
-      periodKey = if period? then period.get 'key' else null
-      @requestIssuesPeriod(@key, periodKey).done => @headerView.render()
-
-
     filterLinesByIssues: ->
       issues = @source.get 'issues'
       @sourceView.resetShowBlocks()
@@ -62,11 +55,11 @@ define [], () ->
 
 
     filterByIssues: (predicate, requestIssues = true) ->
-      issuesPeriod = @state.get('issuesPeriod')
-      if issuesPeriod
+      period = @state.get('period')
+      if period
         p = predicate
         predicate = (issue) =>
-          (new Date(issue.creationDate) >= issuesPeriod.get('sinceDate')) && p issue
+          (new Date(issue.creationDate) >= period.get('sinceDate')) && p issue
 
       if requestIssues && !@state.get 'hasIssues'
         @requestIssues(@key).done => @_filterByIssues(predicate)
index 57833917494f02d73a4c73d57c8808e53e06a28b..b33e00906730935f7ac01474b92ae44d26beaa5a 100644 (file)
@@ -72,12 +72,4 @@ define [], () ->
           @sourceView.addShowBlock scmBlockLine, line.lineNumber - 1
       if predicate
         @sourceView.addShowBlock scmBlockLine, _.size @source.get 'source'
-      @sourceView.render()
-
-
-    enableSCMPeriod: (periodKey) ->
-      period = if periodKey == '' then null else @periods.findWhere key: periodKey
-      @state.set 'period', period
-      @requestMeasures(@key, period?.get('key')).done =>
-        @headerView.render()
-        @filterBySCM() unless @state.get('activeHeaderItem')
\ No newline at end of file
+      @sourceView.render()
\ No newline at end of file