]> source.dussan.org Git - sonarqube.git/commitdiff
Replace snapshot id by component key and add a link on a test to directly list files...
authorJulien Lancelot <julien.lancelot@gmail.com>
Thu, 14 Feb 2013 15:10:09 +0000 (16:10 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Thu, 14 Feb 2013 15:10:09 +0000 (16:10 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb
sonar-server/src/main/webapp/WEB-INF/app/controllers/test_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testcase.html.erb

index b3387b12c4fd54509d9ad1089b786e93deb15b45..8a98b8ccda7c641ae75ebda7abf29c4405f83e99 100644 (file)
@@ -96,7 +96,7 @@
         <td id="test_time_<%= index -%>" class="thin right" nowrap><%= test_case[:time] -%> ms</td>
         <% if has_covered_lines %>
           <td id="test_covered_lines_<%= index -%>" class="thin right" nowrap>
-            <a id="test_covered_lines_link_<%= index -%>" href="<%= ApplicationController.root_context -%>/test/testcase/?sid=<%= @snapshot.id -%>&test=<%= test_case[:name] -%>"
+            <a id="test_covered_lines_link_<%= index -%>" href="<%= ApplicationController.root_context -%>/test/testcase/<%= h @snapshot.resource.key -%>?test=<%= test_case[:name] -%>"
                onclick="openAccordionItem(this.href, this); return false;"><%= number_with_precision(test_case[:covered_lines], :precision => 0) -%>
             </a>
           </td>
index 388cb8d3782a305a8926de141634696a6b3d0785..c5f62d0944c076dbb9ece269ea0861d0469c217c 100644 (file)
@@ -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
index de83de7d7dca89d5a877a55c9a748b819c2884bd..8be3444791c332b218ff90de5a9d3f5b9eaef145 100644 (file)
               <% 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>
index e6d51a4088d922410188e23a718c493c51ef30fa..ae2a64056a078f94c1c87e55652686dc809f0777 100644 (file)
@@ -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/<%= resource_key -%>?display_title=true&tab=source"
+           onclick="openAccordionItem(this.href, this); return false;"><%= 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 %>
index e83d168bc0867a23b724ae6ac8cb7019afd6c29e..9a65051b266ffd5cdea598cadfca9dbabc266f51 100644 (file)
@@ -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/<%= 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>
         </td>
       </tr>