aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-07-18 15:45:56 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-07-18 15:46:06 +0600
commit28d8c2c9a55973f5aebe8316001a40432f007cbe (patch)
treea81ce6f672fba1268390945ba8fe7d35364bfd30 /server
parent8e042f2ca93c7f4422fe7e9c264013f3887a8c46 (diff)
downloadsonarqube-28d8c2c9a55973f5aebe8316001a40432f007cbe.tar.gz
sonarqube-28d8c2c9a55973f5aebe8316001a40432f007cbe.zip
SONAR-3513 Sort unit tests based on name or execution time
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/coffee/component-viewer/header/tests-header.coffee22
-rw-r--r--server/sonar-web/src/main/hbs/component-viewer/header/tests-header.hbs7
2 files changed, 28 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/coffee/component-viewer/header/tests-header.coffee b/server/sonar-web/src/main/coffee/component-viewer/header/tests-header.coffee
index cb8b4832ab0..d297e53bc35 100644
--- a/server/sonar-web/src/main/coffee/component-viewer/header/tests-header.coffee
+++ b/server/sonar-web/src/main/coffee/component-viewer/header/tests-header.coffee
@@ -24,11 +24,20 @@ define [
events:
'click @ui.unitTests': 'showCoveredFiles'
+ 'click .js-sort-tests-duration': 'sortTestsByDuration'
+ 'click .js-sort-tests-name': 'sortTestsByName'
+
+
+ initialize: ->
+ super
+ @tests = _.sortBy @component.get('tests'), 'name'
+ @activeSort = '.js-sort-tests-name'
onRender: ->
@header.enableUnitTest = (testName) =>
@ui.unitTests.filter("[data-name=#{testName}]").click()
+ @$(@activeSort).addClass 'active-link' if @activeSort
onClose: ->
@@ -50,6 +59,18 @@ define [
popup.render()
+ sortTestsByDuration: ->
+ @activeSort = '.js-sort-tests-duration'
+ @tests = _.sortBy @tests, 'durationInMs'
+ @render()
+
+
+ sortTestsByName: ->
+ @activeSort = '.js-sort-tests-name'
+ @tests = _.sortBy @tests, 'name'
+ @render()
+
+
hasCoveragePerTestData: ->
hasData = false
@component.get('tests').forEach (test) ->
@@ -59,4 +80,5 @@ define [
serializeData: ->
_.extend super,
+ tests: @tests
hasCoveragePerTestData: @hasCoveragePerTestData()
diff --git a/server/sonar-web/src/main/hbs/component-viewer/header/tests-header.hbs b/server/sonar-web/src/main/hbs/component-viewer/header/tests-header.hbs
index a894e1ffea2..0b8659bb2a6 100644
--- a/server/sonar-web/src/main/hbs/component-viewer/header/tests-header.hbs
+++ b/server/sonar-web/src/main/hbs/component-viewer/header/tests-header.hbs
@@ -50,7 +50,7 @@
{{/if}}
</div>
<ul class="component-viewer-header-expanded-bar-section-list">
- {{#each component.tests}}
+ {{#each tests}}
{{#eq status 'SKIPPED'}}
<li><span class="item" title="{{name}}" data-status="{{status}}">
<span class="label">{{testStatusIcon status}}
@@ -77,4 +77,9 @@
{{/eq}}
{{/each}}
</ul>
+ <div class="component-viewer-header-expanded-bar-section-title">
+ <span>{{t 'component_viewer.tests.sort_by'}}</span>
+ <a class="js-sort-tests-name underlined-link">{{t 'component_viewer.tests.test_name'}}</a>
+ <a class="js-sort-tests-duration underlined-link">{{t 'component_viewer.tests.duration'}}</a>
+ </div>
</div>