From ad25f2106c30038dd0bcd09d36a935d1893f6178 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Thu, 14 Feb 2013 16:10:09 +0100 Subject: [PATCH] Replace snapshot id by component key and add a link on a test to directly list files covered by this test --- .../sonar/plugins/core/web/tests_viewer.html.erb | 2 +- .../WEB-INF/app/controllers/test_controller.rb | 13 +++++++------ .../WEB-INF/app/views/resource/_index.html.erb | 2 +- .../WEB-INF/app/views/test/_testable.html.erb | 8 +++++--- .../WEB-INF/app/views/test/_testcase.html.erb | 4 ++-- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb index b3387b12c4f..8a98b8ccda7 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb @@ -96,7 +96,7 @@ <%= test_case[:time] -%> ms <% if has_covered_lines %> - <%= number_with_precision(test_case[:covered_lines], :precision => 0) -%> 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? %> <% if line.covered_lines > 0 %> - <%= line.covered_lines -%> <% end %> 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| %>
<% resource_key = test_plan.component.key %> - <%= test_plan.component.longName %> + <%= h test_plan.component.longName %>
@@ -22,7 +22,9 @@ <% 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 @@ "> -- 2.39.5
<%= test_case.durationInMs -%> ms - <%= test_case.name -%> + <%= h test_case.name -%> +
<%= cover.lines.size -%> - <%= cover.testable.component.longName -%> + <%= h cover.testable.component.longName -%>