aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-02-14 16:10:09 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2013-02-14 16:10:09 +0100
commitad25f2106c30038dd0bcd09d36a935d1893f6178 (patch)
tree79c6dd9d81f8e328d3b4ab38d44de8440e5575b4 /sonar-server
parent41e8ce4038388713844e636ae5e3979a9d74eaf6 (diff)
downloadsonarqube-ad25f2106c30038dd0bcd09d36a935d1893f6178.tar.gz
sonarqube-ad25f2106c30038dd0bcd09d36a935d1893f6178.zip
Replace snapshot id by component key and add a link on a test to directly list files covered by this test
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb13
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_index.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb4
4 files changed, 15 insertions, 12 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb
index 388cb8d3782..c5f62d0944c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb
@@ -21,22 +21,23 @@ class TestController < ApplicationController
def testcase
verify_ajax_request
- require_parameters :sid, :test
- snapshot_id = params[:sid].to_i
+ require_parameters :id, :test
+ component_key = params[:id].to_s
@test = params[:test].to_s
- @test_plan = java_facade.testPlan(snapshot_id)
+ @test_plan = java_facade.testPlan(component_key)
+
@test_case = @test_plan.testCasesByName(@test).first
render :partial => 'test/testcase'
end
def testable
verify_ajax_request
- require_parameters :sid, :line
- snapshot_id = params[:sid].to_i
+ require_parameters :id, :line
+ component_key = params[:id].to_s
@line = params[:line].to_i
- @testable = java_facade.testable(snapshot_id)
+ @testable = java_facade.testable(component_key)
@test_case_by_test_plan = {}
@testable.testCasesOfLine(@line).each do |test_case|
test_plan = test_case.testPlan
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_index.html.erb
index de83de7d7dc..8be3444791c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_index.html.erb
@@ -105,7 +105,7 @@
<% if line.highlighted? %>
<td class="ind <%= hits_status -%>" title="<%= message('coverage_viewer.line_covered_by_x_tests', {:params => line.covered_lines.to_s}) if line.covered_lines > 0 -%>">
<% if line.covered_lines > 0 %>
- <a href="<%= ApplicationController.root_context -%>/test/testable/?sid=<%= @snapshot.id -%>&line=<%= index+1 -%>"
+ <a href="<%= ApplicationController.root_context -%>/test/testable/<%= h @snapshot.resource.key -%>?line=<%= index+1 -%>"
onclick="openAccordionItem(this.href, this); return false;"><%= line.covered_lines -%></a>
<% end %>
</td>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb
index e6d51a4088d..ae2a64056a0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb
@@ -8,8 +8,8 @@
<% @test_case_by_test_plan.sort_by { |test_plan, test_cases| test_plan.component.longName }.each do |test_plan, test_cases| %>
<div class="source_title">
<% resource_key = test_plan.component.key %>
- <a href="<%= ApplicationController.root_context -%>/resource/index/<%= resource_key -%>?display_title=true&tab=source"
- onclick="openAccordionItem(this.href, this); return false;"><%= test_plan.component.longName %>
+ <a href="<%= ApplicationController.root_context -%>/resource/index/<%= h resource_key -%>?display_title=true&tab=source"
+ onclick="openAccordionItem(this.href, this); return false;"><%= h test_plan.component.longName %>
</a>
</div>
<table class="data marginbottom10">
@@ -22,7 +22,9 @@
</td>
<td class="thin right" nowrap><%= test_case.durationInMs -%> ms</td>
<td>
- <%= test_case.name -%>
+ <a href="<%= ApplicationController.root_context -%>/test/testcase/<%= h resource_key -%>?test=<%= test_case.name -%>"
+ onclick="openAccordionItem(this.href, this); return false;"><%= h test_case.name -%>
+ </a>
</td>
</tr>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb
index e83d168bc08..9a65051b266 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb
@@ -17,8 +17,8 @@
<tr class="<%= cycle("even", "odd") -%>">
<td><%= cover.lines.size -%></td>
<td>
- <a href="<%= ApplicationController.root_context -%>/resource/index/<%= cover.testable.component.key -%>?display_title=true&tab=coverage&coverage_filter=lines_covered_per_test&test_case_filter=<%= @test -%>"
- onclick="openAccordionItem(this.href, this); return false;"><%= cover.testable.component.longName -%>
+ <a href="<%= ApplicationController.root_context -%>/resource/index/<%= h cover.testable.component.key -%>?display_title=true&tab=coverage&coverage_filter=lines_covered_per_test&test_case_filter=<%= @test -%>"
+ onclick="openAccordionItem(this.href, this); return false;"><%= h cover.testable.component.longName -%>
</a>
</td>
</tr>