]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2218 support GWT extensions + improve filters
authorsimonbrandhof <simon.brandhof@gmail.com>
Thu, 3 Mar 2011 15:39:41 +0000 (16:39 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Thu, 3 Mar 2011 15:39:41 +0000 (16:39 +0100)
21 files changed:
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/sonar/rule_priority.rb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_footer.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_resource_viewers.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
sonar-server/src/main/webapp/images/sep12.png [new file with mode: 0644]
sonar-server/src/main/webapp/stylesheets/style.css

index e53917bb95e5feab105555f5b88ddb2ae2024524..4f61cfb78027ea26983211aaedb7103f85784417 100644 (file)
@@ -34,7 +34,6 @@ import org.sonar.plugins.core.charts.XradarChart;
 import org.sonar.plugins.core.clouds.Clouds;
 import org.sonar.plugins.core.colorizers.JavaColorizerFormat;
 import org.sonar.plugins.core.coverageviewer.CoverageViewerDefinition;
-import org.sonar.plugins.core.defaultsourceviewer.DefaultSourceViewer;
 import org.sonar.plugins.core.duplicationsviewer.DuplicationsViewerDefinition;
 import org.sonar.plugins.core.hotspots.Hotspots;
 import org.sonar.plugins.core.metrics.UserManagedMetrics;
@@ -42,8 +41,6 @@ import org.sonar.plugins.core.security.ApplyProjectRolesDecorator;
 import org.sonar.plugins.core.sensors.*;
 import org.sonar.plugins.core.testdetailsviewer.TestsViewerDefinition;
 import org.sonar.plugins.core.timemachine.*;
-import org.sonar.plugins.core.ui.pageselector.GwtPageSelector;
-import org.sonar.plugins.core.violationsviewer.ViolationsViewerDefinition;
 import org.sonar.plugins.core.widgets.*;
 
 import java.util.List;
@@ -182,10 +179,6 @@ public class CorePlugin implements Plugin {
     extensions.add(UserManagedMetrics.class);
 
     // pages
-    extensions.add(GwtPageSelector.class);
-    extensions.add(DefaultSourceViewer.class);
-    extensions.add(CoverageViewerDefinition.class);
-    extensions.add(ViolationsViewerDefinition.class);
     extensions.add(DuplicationsViewerDefinition.class);
     extensions.add(TestsViewerDefinition.class);
     extensions.add(Clouds.class);
index e49af9fe149c9f04392843a345bce67ffabd6100..cc5d24a4f26e7b7401f5d7352e4640a8b8560761 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.ui;
 
 import org.sonar.api.measures.CoreMetrics;
+import org.sonar.api.resources.Qualifiers;
 import org.sonar.api.resources.Resource;
 import org.sonar.api.web.*;
 
@@ -34,9 +35,10 @@ public final class DefaultPages {
     return PAGES;
   }
 
-  @ResourceScope(Resource.SCOPE_ENTITY)
+  // should be qualifier FILE only but waiting for java refactoring
   @NavigationSection(NavigationSection.RESOURCE_TAB)
   @DefaultTab
+  @ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS, Qualifiers.UNIT_TEST_FILE})
   @UserRole(UserRole.CODEVIEWER)
   private static final class SourceTab implements RubyRailsPage {
     public String getTemplate() {
@@ -54,9 +56,13 @@ public final class DefaultPages {
   }
 
 
-  @ResourceQualifier(Resource.QUALIFIER_CLASS)
   @NavigationSection(NavigationSection.RESOURCE_TAB)
-  @DefaultTab(metrics = {CoreMetrics.COVERAGE_KEY, CoreMetrics.LINES_TO_COVER_KEY, CoreMetrics.UNCOVERED_LINES_KEY, CoreMetrics.LINE_COVERAGE_KEY, CoreMetrics.CONDITIONS_TO_COVER_KEY, CoreMetrics.UNCOVERED_CONDITIONS_KEY, CoreMetrics.BRANCH_COVERAGE_KEY})
+  @ResourceQualifier({Qualifiers.FILE, Qualifiers.CLASS})
+  @DefaultTab(metrics = {CoreMetrics.COVERAGE_KEY, CoreMetrics.LINES_TO_COVER_KEY, CoreMetrics.UNCOVERED_LINES_KEY, CoreMetrics.LINE_COVERAGE_KEY,
+      CoreMetrics.CONDITIONS_TO_COVER_KEY, CoreMetrics.UNCOVERED_CONDITIONS_KEY, CoreMetrics.BRANCH_COVERAGE_KEY,
+      CoreMetrics.NEW_COVERAGE_KEY, CoreMetrics.NEW_UNCOVERED_LINES_KEY, CoreMetrics.NEW_LINE_COVERAGE_KEY,
+      CoreMetrics.NEW_LINES_TO_COVER_KEY, CoreMetrics.NEW_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY
+  })
   @UserRole(UserRole.CODEVIEWER)
   private static final class CoverageTab implements RubyRailsPage {
     public String getTemplate() {
@@ -74,8 +80,11 @@ public final class DefaultPages {
   }
 
   @NavigationSection(NavigationSection.RESOURCE_TAB)
-  @DefaultTab(metrics = {CoreMetrics.VIOLATIONS_DENSITY_KEY, CoreMetrics.WEIGHTED_VIOLATIONS_KEY, CoreMetrics.VIOLATIONS_KEY, CoreMetrics.BLOCKER_VIOLATIONS_KEY, CoreMetrics.CRITICAL_VIOLATIONS_KEY, CoreMetrics.MAJOR_VIOLATIONS_KEY, CoreMetrics.MINOR_VIOLATIONS_KEY, CoreMetrics.INFO_VIOLATIONS_KEY})
-  @ResourceQualifier({Resource.QUALIFIER_CLASS, Resource.QUALIFIER_FILE})
+  @DefaultTab(metrics = {CoreMetrics.VIOLATIONS_DENSITY_KEY, CoreMetrics.WEIGHTED_VIOLATIONS_KEY, CoreMetrics.VIOLATIONS_KEY, CoreMetrics.BLOCKER_VIOLATIONS_KEY,
+      CoreMetrics.CRITICAL_VIOLATIONS_KEY, CoreMetrics.MAJOR_VIOLATIONS_KEY, CoreMetrics.MINOR_VIOLATIONS_KEY, CoreMetrics.INFO_VIOLATIONS_KEY,
+      CoreMetrics.NEW_VIOLATIONS_KEY, CoreMetrics.NEW_BLOCKER_VIOLATIONS_KEY, CoreMetrics.NEW_CRITICAL_VIOLATIONS_KEY, CoreMetrics.NEW_MAJOR_VIOLATIONS_KEY,
+      CoreMetrics.NEW_MINOR_VIOLATIONS_KEY, CoreMetrics.NEW_INFO_VIOLATIONS_KEY})
+  @ResourceQualifier({Qualifiers.VIEW, Qualifiers.SUBVIEW, Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.PACKAGE, Qualifiers.DIRECTORY, Qualifiers.FILE, Qualifiers.CLASS}) /* all exept unit tests...*/
   @UserRole(UserRole.CODEVIEWER)
   private static final class ViolationsTab implements RubyRailsPage {
     public String getTemplate() {
index a2df02fae1a69531a1559fcdbb94b964c76b3617..9ad4225569593ade8b53e869638706c3a36d9fc3 100644 (file)
@@ -73,14 +73,15 @@ class BrowseController < ApplicationController
     @extension=@extensions.find{|extension| extension.isDefaultTab()} if @extension==nil
   end
 
-  def load_sources
+  def load_sources(use_scm_for_periods=true)
     @period = params[:period].to_i unless params[:period].blank?
+    @display_scm=(params[:scm]=='true')
     @expanded=(params[:expand]=='true')
 
     @source = @snapshot.source
     if @source
       source_lines=Java::OrgSonarServerUi::JRubyFacade.new.colorizeCode(@source.data, @snapshot.project.language).split("\n")
-      load_scm()
+      init_scm((@period && use_scm_for_periods) || @display_scm)
 
       @lines=[]
       source_lines.each_with_index do |source, index|
@@ -96,10 +97,9 @@ class BrowseController < ApplicationController
      end
   end
 
-  def load_scm
+  def init_scm(scm)
     @scm_available=(@snapshot.measure('last_commit_datetimes_by_line')!=nil)
-    @display_scm=(params[:scm]=='true')
-    if @display_scm
+    if scm
       @authors_by_line=load_distribution('authors_by_line')
       @revisions_by_line=load_distribution('revisions_by_line')
       @dates_by_line=load_distribution('last_commit_datetimes_by_line')
@@ -116,7 +116,7 @@ class BrowseController < ApplicationController
   end
 
   def render_coverage
-    load_sources()
+    load_sources(true)
     @display_coverage=true
     @hits_by_line=load_distribution('coverage_line_hits_data')
     @conditions_by_line=load_distribution('conditions_by_line')
@@ -148,7 +148,7 @@ class BrowseController < ApplicationController
   
   
   def render_violations
-    load_sources()
+    load_sources(false)
     @display_violations=true
     @global_violations=[]
     @expandable=true
@@ -156,14 +156,14 @@ class BrowseController < ApplicationController
     conditions='snapshot_id=?'
     values=[@snapshot.id]
     unless params[:rule].blank?
-      if params[:rule].include?(':')
+      severity=Sonar::RulePriority.id(params[:rule])
+      if severity
+        conditions += ' AND failure_level=?'
+        values<<severity
+      else
         rule=Rule.by_key_or_id(params[:rule])
         conditions += ' AND rule_id=?'
         values<<(rule ? rule.id : -1)
-      else
-        # severity
-        conditions += ' AND failure_level=?'
-        values<<params[:rule].to_i
       end
     end
 
@@ -204,7 +204,7 @@ class BrowseController < ApplicationController
   
 
   def render_source
-    load_sources()
+    load_sources(true)
     filter_lines_by_date()
     render :action => 'index', :layout => !request.xhr?
   end
index a5bd62a826b17e83bc3d040f80f5700a58450f84..4cda2d6c6db1c05f7648b527acab1f6913fcc58d 100644 (file)
@@ -23,6 +23,12 @@ include_class "org.sonar.api.rules.RulePriority"
 
 class Sonar::RulePriority
 
+  INFO = Java::OrgSonarApiRules::RulePriority::INFO
+  MINOR = Java::OrgSonarApiRules::RulePriority::MINOR
+  MAJOR = Java::OrgSonarApiRules::RulePriority::MAJOR
+  CRITICAL = Java::OrgSonarApiRules::RulePriority::CRITICAL
+  BLOCKER = Java::OrgSonarApiRules::RulePriority::BLOCKER
+
   PRIORITY_INFO = Java::OrgSonarApiRules::RulePriority::INFO.ordinal()
   PRIORITY_MINOR = Java::OrgSonarApiRules::RulePriority::MINOR.ordinal()
   PRIORITY_MAJOR = Java::OrgSonarApiRules::RulePriority::MAJOR.ordinal()
@@ -45,7 +51,12 @@ class Sonar::RulePriority
   end
   
   def self.id(priority)
-    Java::OrgSonarApiRules::RulePriority.valueOf(priority).ordinal
+    begin
+      javaPriority=Java::OrgSonarApiRules::RulePriority.valueOf(priority)
+      javaPriority ? javaPriority.ordinal : nil
+    rescue
+      nil
+    end
   end
   
   def self.as_array
index 696f331c72c770b77bfcb6ec556aaa4fc6016c18..823295ed955fae6cf029132a26a7edb6765ab243 100644 (file)
@@ -1,4 +1,5 @@
 <div id="coverage_header" class="tab_header">
+  <%= render :partial => 'options' -%>
   <table class="col">
     <tr>
       <td class="big"><%= format_measure('coverage', :default => '-') -%></td>
index dd0e808d83a15a4b433d5bc367ed66bf579cc89f..4bcc974e1301f60f6c5477e6d27d83f3352fda0d 100644 (file)
@@ -1,4 +1,7 @@
 <div id="source_header" class="tab_header">
+
+  <%= render :partial => 'options' -%>
+  
   <table class="col">
       <% if m=measure('lines') %>
       <tr>
index d519d2566b4c182ee1ee85575b8129b7418ca5e9..b3d9872885dd00c1e3dd843826e9419530656747 100644 (file)
@@ -1,4 +1,7 @@
 <div id="violations_header" class="tab_header">
+
+  <%= render :partial => 'options' -%>
+
   <table class="col">
     <tr>
       <td><span class="big"><%= format_measure('violations', :default => '-') -%></span> violations</td>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb
new file mode 100644 (file)
index 0000000..030231d
--- /dev/null
@@ -0,0 +1,45 @@
+<div id="source_options">
+  <script>
+    applyOptions=function() {
+      $('resource-loading').show();
+      <% if request.xhr? %>
+        var params = Form.serialize($('options-form'));
+        new Ajax.Updater('resource_container', '<%= url_for :controller => 'browse', :id => @resource.key -%>', {asynchronous:true, parameters:params});
+        return true;
+      <% else %>
+        $('options-form').submit();
+        return false;
+      <% end %>
+    };
+  </script>
+  <form method="GET" action="<%= url_for :controller => 'browse', :id => @resource.key -%>" id="options-form">
+    <input type="hidden" name="tab" value="<%= params[:tab] -%>"/>
+    <input type="hidden" name="metric" value="<%= params[:metric] -%>"/>
+    <input type="hidden" name="period" value="<%= params[:period] -%>"/>
+
+    <% if @scm_available %>
+      <input type="checkbox" value="true" name="scm" id="scm" <%= 'checked' if @display_scm -%> onclick="applyOptions()"/>
+      <label for="scm">Show commits</label><br/>
+    <% end %>
+
+    <% if @snapshot.project_snapshot.periods? %>
+      <select id="period" name="period" class="small" onchange="applyOptions()">
+        <option value="">Time changes...</option>
+        <%= period_select_options(@snapshot, 1) -%>
+        <%= period_select_options(@snapshot, 2) -%>
+        <%= period_select_options(@snapshot, 3) -%>
+        <%= period_select_options(@snapshot, 4) -%>
+        <%= period_select_options(@snapshot, 5) -%>
+      </select>
+      <br/>
+    <% end %>
+
+    <% if @expandable %>
+      <input type="checkbox" value="true" name="expand" id="expand" <%= 'checked' if @expanded -%> onclick="applyOptions()"/>
+      <label for="expand">Expand</label>
+      <br/>
+    <% end %>
+
+    <%= render :partial => 'rules_filter' if @display_violations -%>
+  </form>
+</div>
index 5caa1f63b3bffcc99fd390f67a29952801a44f47..8741fa9819015435153435f637165c66e6a68f68 100644 (file)
 
    rule_options=[]
    rules.uniq.sort_by{|rule| rule.name}.each do |rule|
-     rule_options<<["#{h rule.name} (#{rule_counts[rule.id]})", rule.key]
+     rule_options<<["#{h rule.name} (#{rule_counts[rule.id]})", rule.id]
    end
 %>
 <select id="rule" name="rule" class="small" onchange="applyOptions()">
   <option value="">No filters</option>
   <optgroup label="Severity">
     <% if blocker_violations && blocker_violations.value>0 %>
-      <option value="<%= Sonar::RulePriority::PRIORITY_BLOCKER-%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::PRIORITY_BLOCKER.to_s -%>>Blocker (<%= blocker_violations.formatted_value -%>)</option>
+      <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>>Blocker (<%= blocker_violations.formatted_value -%>)</option>
     <% end %>
     <% if critical_violations && critical_violations.value>0 %>
-      <option value="<%= Sonar::RulePriority::PRIORITY_CRITICAL -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::PRIORITY_CRITICAL.to_s -%>>Critical (<%= critical_violations.formatted_value -%>)</option>
+      <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>>Critical (<%= critical_violations.formatted_value -%>)</option>
     <% end %>
     <% if major_violations && major_violations.value>0 %>
-      <option value="<%= Sonar::RulePriority::PRIORITY_MAJOR -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::PRIORITY_MAJOR.to_s -%>>Major (<%= major_violations.formatted_value -%>)</option>
+      <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>>Major (<%= major_violations.formatted_value -%>)</option>
     <% end %>
     <% if minor_violations && minor_violations.value>0 %>
-      <option value="<%= Sonar::RulePriority::PRIORITY_MINOR -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::PRIORITY_MINOR.to_s -%>>Minor (<%= minor_violations.formatted_value -%>)</option>
+      <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>>Minor (<%= minor_violations.formatted_value -%>)</option>
     <% end %>
     <% if info_violations && info_violations.value>0 %>
-      <option value="<%= Sonar::RulePriority::PRIORITY_INFO -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::PRIORITY_INFO.to_s -%>>Info (<%= info_violations.formatted_value -%>)</option>
+      <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>>Info (<%= info_violations.formatted_value -%>)</option>
     <% end %>
   </optgroup>
 
 
   <optgroup label="Rule">
-    <%= options_for_select(rule_options, params[:rule]) -%>
+    <%= options_for_select(rule_options, params[:rule].to_i) -%>
   </optgroup>
 </select>
\ No newline at end of file
index 7eb35e6517b8fe865c8a3a2d72c47ac06ce7bee1..576ded540ddfdb45dca755e97edaba5198bf6ea5 100644 (file)
@@ -129,7 +129,6 @@ span.rulename a:hover {
   vertical-align: sub;
 }
 .tab_header {
-  width: 100%;
   border: 1px solid #DDD;
   border-top-width: 0;
   background-color: #ECECEC;
@@ -152,16 +151,29 @@ span.rulename a:hover {
 .tab_header td.value {
   text-align: right;
 }
+#source_options {
+  float: right;
+}
 </style>
 
 <div id="source_title">
   <span class="h1"><%= qualifier_icon(@resource) -%> <%= @resource.long_name -%></span>
-  <% if @lines  %>
-    | <span class="source_link"><a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&format=txt">raw</a></span>
-  <% end %>
 </div>
 
-<ul id="source_tabs" class="tabs">
+<div id="source_tabs">
+  <ul class="tablinks">
+    <%
+       sep=false
+       if @lines
+         sep=true
+    %>
+      <li><a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&format=txt">Raw</a></li>
+    <% if request.xhr? %>
+      <li class="<%= 'withsep' if sep -%>"><a href="<%= ApplicationController.root_context -%>/browse/<%= @resource.key -%>" target="sonar">New Window</a></li>
+    <% end %>
+  <% end %>
+  </ul>
+  <ul class="tabs" >
   <% if request.xhr? %>
     <% @extensions.each do |extension| %>
       <li><a href="#" onclick="loadAjaxTab('<%= @resource.id -%>','<%= extension.getId() -%>')" class="<%= 'selected' if @extension.getId()==extension.getId() -%>"><%= extension.getTitle() -%></a></li>
@@ -172,5 +184,8 @@ span.rulename a:hover {
       <li><a href="#" onClick="loadTab('<%= url_for(:overwrite_params => {:tab => extension.getId()}) -%>')" class="<%= 'selected' if @extension.getId()==extension.getId() -%>"><%= extension.getTitle() -%></a></li>
     <% end %>
   <% end %>
-  <img src="<%= ApplicationController.root_context -%>/images/loading.gif" id="resource-loading" style="display:none"/>
-</ul>
+  <li>
+    <img src="<%= ApplicationController.root_context -%>/images/loading.gif" id="resource-loading" style="display:none"/>
+  </li>
+  </ul>
+</div>
index 9310d500de3cb73c967f0daa910b2583911dc3e6..d11593d2d813dc16b94b700e7316e6be297c9606 100644 (file)
@@ -8,6 +8,8 @@
 
   <% else %>
     <%= render :partial => 'gwt/base', :locals => {:resource => @resource, :popup => false, :metric => nil} -%>
+    <%= render :partial => 'gwt/resource_viewers' -%>
+
     <div id="gwtpage"> </div>
     <!-- for SmartGWT -->
     <script>var isomorphicDir = "<%= "#{ApplicationController.root_context}/deploy/gwt/#{@extension.getId()}" -%>/sc/";</script>
index b005c15c064cfc38858d78a993cd26d837ba8c2b..7d277da8b3af6166430506bde9431c3ff3a92f12 100644 (file)
   </table>
 <% end %>
 
-<div id="source_options">
-  <script>
-    applyOptions=function() {
-      $('resource-loading').show();
-      <% if request.xhr? %>
-        var params = Form.serialize($('options-form'));
-        new Ajax.Updater('resource_container', '<%= url_for :controller => 'browse', :id => @resource.key -%>', {asynchronous:true, parameters:params});
-        return true;
-      <% else %>
-        $('options-form').submit();
-        return false;
-      <% end %>
-    };
-  </script>
-  <form method="GET" action="<%= url_for :controller => 'browse', :id => @resource.key -%>" id="options-form">
-    <input type="hidden" name="tab" value="<%= params[:tab] -%>"/>
-    <input type="hidden" name="metric" value="<%= params[:metric] -%>"/>
-    <% if @scm_available %>
-      <input type="checkbox" value="true" name="scm" id="scm" <%= 'checked' if @display_scm -%> onclick="applyOptions()"/>
-      <label for="scm">Authors</label>
-    <% end %>
-
-    <% if @snapshot.project_snapshot.periods? %>
-      <select id="period" name="period" class="small" onchange="applyOptions()">
-        <option value="">Time changes...</option>
-        <%= period_select_options(@snapshot, 1) -%>
-        <%= period_select_options(@snapshot, 2) -%>
-        <%= period_select_options(@snapshot, 3) -%>
-        <%= period_select_options(@snapshot, 4) -%>
-        <%= period_select_options(@snapshot, 5) -%>
-      </select>
-    <% end %>
-
-    <% if @expandable %>
-      <input type="checkbox" value="true" name="expand" id="expand" <%= 'checked' if @expanded -%> onclick="applyOptions()"/>
-      <label for="expand">Expand</label>
-    <% end %>
-
-    <%= render :partial => 'rules_filter' if @display_violations -%>
-  </form>
-</div>
-
 <% if @lines && @lines.size>0 %>
 <table id="sources" class="sources2 code" cellpadding="0" cellspacing="0" border="0">
   <%
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_footer.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_footer.html.erb
new file mode 100644 (file)
index 0000000..d0854f7
--- /dev/null
@@ -0,0 +1 @@
+<div id="resource_container"> </div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb
new file mode 100644 (file)
index 0000000..ce63877
--- /dev/null
@@ -0,0 +1,23 @@
+<%= render :partial => 'gwt/base', :locals => {:popup => false, :metric => @metric.key} -%>
+<%= render :partial => 'gwt/resource_viewers' -%>
+
+<script>
+  /* display resource */
+  function d(resourceId) {
+    new Ajax.Updater('resource_container', '<%= ApplicationController.root_context-%>/browse/' + resourceId + '?metric=<%= @metric.id if @metric -%>&rule=<%= @rule ? @rule.id : params[:priority] -%>&period=<%= @period -%>', {asynchronous:true, evalScripts:true});
+    return false;
+  }
+
+  function loadAjaxTab(resourceId, tab) {
+    $('resource-loading').show();
+    new Ajax.Updater('resource_container', '<%= ApplicationController.root_context-%>/browse/' + resourceId + '?tab=' + tab, {asynchronous:true, evalScripts:true});
+    return false;
+  }
+
+  /* display GWT component, executed from tabs */
+  function loadGWT(gwtId, resourceId, resourceKey, resourceName, resourceScope, resourceQualifier, resourceLanguage) {
+    config["resource"]=[{"id": resourceId, "key": resourceKey, "name" : resourceName, "scope": resourceScope, "qualifier": resourceQualifier, "lang": resourceLanguage}];
+    config["resource_key"]=resourceId;
+    modules[gwtId]();
+  }
+</script>
index 12fa8ac1ec215da6d4bdad12706eb5c0756c5136..cc6a0287ccbef3a940aaabe94fafe87458d048c2 100644 (file)
@@ -1,25 +1,5 @@
-<%= render :partial => 'gwt/base', :locals => {:resource => @highlighted_resource, :popup => false, :metric => @metric.key} %>
-<%= render :partial => 'gwt/resource_viewers', :locals => {:resource => @drilldown.highlighted_resource || @project} %>
+<%= render :partial => 'header' -%>
 
-<script>
-  /* display resource */
-  function d(resourceId) {
-    new Ajax.Updater('resource_container', '<%= ApplicationController.root_context-%>/browse/' + resourceId + '?metric=<%= @metric.key -%>', {asynchronous:true, evalScripts:true});
-    return false;
-  }
-
-  function loadAjaxTab(resourceId, tab) {
-    $('resource-loading').show();
-    new Ajax.Updater('resource_container', '<%= ApplicationController.root_context-%>/browse/' + resourceId + '?tab=' + tab, {asynchronous:true, evalScripts:true});
-    return false;
-  }
-
-  /* display GWT component, executed from tabs */
-  function loadGWT(gwtId, resourceId, resourceKey, resourceName, resourceScope, resourceQualifier, resourceLanguage) {
-    config["resource"]=[{"id": resourceId, "key": resourceKey, "name" : resourceName, "scope": resourceScope, "qualifier": resourceQualifier, "lang": resourceLanguage}];
-    modules[gwtId]();
-  }
-</script>
 <div class="dashbox">
   <% if @characteristic %>
     <h3><%= @highlighted_metric.short_name -%> / <%= h(@characteristic.name(true)) -%></h3>
@@ -90,4 +70,4 @@ $$('#col_<%= column.scope -%> tr.selected').each(function(item) {item.scrollInto
 <% end %>
 </script>
 
-<div id="resource_container"> </div>
+<%= render :partial => 'footer' -%>
index 3b84bf7f90b22fa07e202aada6101c5c90f3e8a8..46e63d4213a550d54fef5046f2db5de5bb2ad077 100644 (file)
@@ -1,3 +1,6 @@
+<%= render :partial => 'header' -%>
+
+
 <div id="snapshot_title" class="page_title">
 <h4>
 <%
@@ -24,8 +27,6 @@
   <div class="warning">This service is experimental. <a target="faq"  href="http://docs.codehaus.org/display/SONAR/Frequently+Asked+Questions#FrequentlyAskedQuestions-Iamnotgettingexpectednewviolationsinthedifferentialviewsofdrilldown%3F">More</a>.</div>
 <% end %>
 
-<%= render :partial => 'gwt/base', :locals => {:resource => @highlighted_resource, :popup => false, :metric => 'violations'} %>
-<%= render :partial => 'gwt/resource_viewers', :locals => {:resource => @project} %>
 
 <table width="100%" cellpadding="0" cellspacing="0" id="columns">
 <tr>
        <%= link_to(h(resource.name), {:only_path => true, :overwrite_params => {:rids => nil, :id => resource.copy_resource_id}}) -%>
      <% else %>
        <%= qualifier_icon(resource) %>
-       <a href="#" onclick="sr('<%= resource.id -%>');" alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) %></a>
+       <a href="#" onclick="d(<%= resource.id -%>, '<%= @period_index -%>', '<%= @rule ? @rule.key : params[:priority] -%>');" alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) %></a>
    <%
      end
    else %>
@@ -199,4 +200,5 @@ $$('#col_rules tr.selected').each(function(item) {item.scrollIntoView(true);});
 $$('#col_<%= column.scope -%> tr.selected').each(function(item) {item.scrollIntoView(true);});
 <% end %>
 </script>
-<div id="pageselector"> </div>
\ No newline at end of file
+
+<%= render :partial => 'footer' -%>
\ No newline at end of file
index eaa8e3d76369258258a37d58781b4b6b9804bff1..d859f69708a8b71ae267af6dd320e9382a4dbfc4 100644 (file)
@@ -2,37 +2,10 @@
   var config = {
     "sonar_url":"<%= url_for(:controller => '/', :action => '', :only_path => true, :trailing_slash => false)[0...-2] -%>",
     "version":"<%= sonar_version -%>",
-    "popup":<%= popup -%>
+    "popup": "<%= popup -%>"
 <% if metric %>
     ,"metric": "<%= metric -%>"
-<% end
-   if resource
-%>
-    ,"resource_key": "<%= resource.id -%>",
-    "resource":[{"id": <%= resource.id -%>, "key":"<%= resource.key -%>","scope": "<%= resource.scope -%>", "qualifier": "<%= resource.qualifier -%>", "name": "<%= resource.name -%>", "lang":"<%= resource.language -%>"}]
-    <% end %>
-    <% if @snapshot %>
-      <% if @snapshot.project_snapshot.period1_mode %>
-        ,"period1": "<%= period_label(@snapshot, 1) -%>"
-        ,"period1_date": "<%= @snapshot.project_snapshot.period1_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>"
-      <% end
-         if @snapshot.project_snapshot.period2_mode %>
-        ,"period2": "<%= period_label(@snapshot, 2) -%>"
-        ,"period2_date": "<%= @snapshot.project_snapshot.period2_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>"
-      <% end
-         if @snapshot.project_snapshot.period3_mode %>
-        ,"period3": "<%= period_label(@snapshot, 3) -%>"
-        ,"period3_date": "<%= @snapshot.project_snapshot.period3_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>"
-      <% end
-         if @snapshot.project_snapshot.period4_mode %>
-        ,"period4": "<%= period_label(@snapshot, 4) -%>"
-        ,"period4_date": "<%= @snapshot.project_snapshot.period4_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>"
-      <% end
-         if @snapshot.project_snapshot.period5_mode %>
-        ,"period5": "<%= period_label(@snapshot, 5) -%>"
-        ,"period5_date": "<%= @snapshot.project_snapshot.period5_date.strftime("%Y-%m-%dT%H:%M:%S%z") -%>"
-      <% end %>
-    <% end %>
+<% end %>
   };
 
   var rp = {
index b7eeb72827e116b416642b6ca899887d422aa82f..085bb7ff1ee2c12a86d366d9f0ae09f4eabbbf00 100644 (file)
@@ -1,27 +1,11 @@
-<script type="text/javascript">
-  var pages = [
-  {"id": "dashboard", "name": "Dashboard", "gwt": false, "url": "/dashboard/index?hd=false&layout=false&id=", "m":[], "s":['PRJ','DIR'], "q": [], "l": []},
-    <%
-      gwt_pages=[]
-      page_index=0
-      controller.java_facade.getResourceTabs().each do |tab|
-        show_page=false
-        tab.getUserRoles().each do |role|
-          if has_role?(role, resource)
-            show_page=true
-          end
-        end
-        if show_page
-          gwt_pages<<tab if tab.isGwt()
-    %>
-    <%= ',' if page_index>0 -%>{"id": "<%= tab.getId() -%>", "name": "<%= tab.getTitle() -%>", "gwt": <%= tab.isGwt() -%>, "d":<%= tab.isDefaultTab() -%>,"m":[<%= tab.getDefaultTabForMetrics().map{|s| "\"#{s}\""}.join(',') -%>], "s":[<%= tab.getResourceScopes().map{|s| "\"#{s}\""}.join(',') -%>], "q": [<%= tab.getResourceQualifiers().map{|s| "\"#{s}\""}.join(',') -%>], "l": [<%= tab.getResourceLanguages().map{|s| "\"#{s}\""}.join(',') -%>]}
-    <%
-          page_index+=1
-        end
-      end %>
-  ];
-</script>
-<script src="<%= ApplicationController.root_context -%>/deploy/gwt/org.sonar.plugins.core.ui.pageselector.PageSelector/org.sonar.plugins.core.ui.pageselector.PageSelector.nocache.js?<%= sonar_version -%>"></script>
-<% gwt_pages.each do |gwt_page| %>
-<script src="<%= ApplicationController.root_context -%>/deploy/gwt/<%= gwt_page.getId() -%>/<%= gwt_page.getId() -%>.nocache.js?<%= sonar_version -%>"></script>
-<% end %>
+<%
+  gwt_pages=[]
+  controller.java_facade.getResourceTabs().each do |tab|
+    if tab.isGwt()
+%>
+    <script src="<%= ApplicationController.root_context -%>/deploy/gwt/<%= tab.getId() -%>/<%= tab.getId() -%>.nocache.js"></script>
+
+<%
+    end
+  end
+%>
\ No newline at end of file
index 4c6de8ef3742ce266cc795bf03acfdcaeb707b49..36d9d613da0031ea0335940ab5a23e5b9a3881b5 100644 (file)
@@ -6,6 +6,8 @@
     title="Sonar - #{h(@page_title)}"
   elsif @project
     title="Sonar - #{h(@project.name)}"
+  elsif @resource
+    title="#{h(@resource.long_name)}"
   else
     title='Sonar'
   end
diff --git a/sonar-server/src/main/webapp/images/sep12.png b/sonar-server/src/main/webapp/images/sep12.png
new file mode 100644 (file)
index 0000000..bb10431
Binary files /dev/null and b/sonar-server/src/main/webapp/images/sep12.png differ
index 765e060731b5b0f6e6febd75c6df60242119e4d5..1341a32e98e8242971f23f199b8f7d2df15917ae 100644 (file)
@@ -1015,9 +1015,18 @@ ul.bullet li {
 }
 .tablinks {
   float:right;
-  padding-right: 10px;
-  align: right;
+  padding: 0 5px 0 10px;
+  text-align: right;
+}
+.tablinks li {
+  float:left;
+  padding: 0 7px;
+  text-align: right;
 }
+.tablinks li.withsep {
+  background: url("../images/sep12.png") no-repeat scroll 0 50% transparent;
+}
+
 .tablinks a {
   text-decoration: underline;
   color: #555;