aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-03-03 16:39:41 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-03-03 16:39:41 +0100
commitc14fe1997982cfb211b5a781e147c9f9f6200f1f (patch)
tree56d3553d4694a4130139ba647bf86de2b3139759 /sonar-server
parent60b4d628841dd0463591825fa29cff5899e5d301 (diff)
downloadsonarqube-c14fe1997982cfb211b5a781e147c9f9f6200f1f.tar.gz
sonarqube-c14fe1997982cfb211b5a781e147c9f9f6200f1f.zip
SONAR-2218 support GWT extensions + improve filters
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb26
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/sonar/rule_priority.rb13
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb45
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb14
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb29
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb42
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_footer.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb23
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb24
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb31
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_resource_viewers.html.erb38
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb2
-rw-r--r--sonar-server/src/main/webapp/images/sep12.pngbin0 -> 118 bytes
-rw-r--r--sonar-server/src/main/webapp/stylesheets/style.css13
20 files changed, 180 insertions, 159 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java b/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
index e49af9fe149..cc5d24a4f26 100644
--- a/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
+++ b/sonar-server/src/main/java/org/sonar/server/ui/DefaultPages.java
@@ -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() {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb
index a2df02fae1a..9ad42255695 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb
@@ -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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/rule_priority.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/rule_priority.rb
index a5bd62a826b..4cda2d6c6db 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/rule_priority.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/rule_priority.rb
@@ -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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb
index 696f331c72c..823295ed955 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb
@@ -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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb
index dd0e808d83a..4bcc974e130 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb
@@ -1,4 +1,7 @@
<div id="source_header" class="tab_header">
+
+ <%= render :partial => 'options' -%>
+
<table class="col">
<% if m=measure('lines') %>
<tr>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb
index d519d2566b4..b3d9872885d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb
@@ -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
index 00000000000..030231d8570
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb
@@ -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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb
index 5caa1f63b3b..8741fa98190 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb
@@ -15,31 +15,31 @@
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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb
index 7eb35e6517b..576ded540dd 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb
@@ -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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb
index 9310d500de3..d11593d2d81 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb
@@ -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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb
index b005c15c064..7d277da8b3a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb
@@ -13,48 +13,6 @@
</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
index 00000000000..d0854f7855d
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_footer.html.erb
@@ -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
index 00000000000..ce638773e8d
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_header.html.erb
@@ -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>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
index 12fa8ac1ec2..cc6a0287ccb 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb
@@ -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' -%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
index 3b84bf7f90b..46e63d4213a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb
@@ -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>
@@ -153,7 +154,7 @@
<%= 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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb
index eaa8e3d7636..d859f69708a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_base.html.erb
@@ -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 = {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_resource_viewers.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_resource_viewers.html.erb
index b7eeb72827e..085bb7ff1ee 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_resource_viewers.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/gwt/_resource_viewers.html.erb
@@ -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
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
index 4c6de8ef374..36d9d613da0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
@@ -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
index 00000000000..bb10431c778
--- /dev/null
+++ b/sonar-server/src/main/webapp/images/sep12.png
Binary files differ
diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css
index 765e060731b..1341a32e98e 100644
--- a/sonar-server/src/main/webapp/stylesheets/style.css
+++ b/sonar-server/src/main/webapp/stylesheets/style.css
@@ -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;