aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-server/src/main')
-rw-r--r--sonar-server/src/main/java/org/sonar/server/ui/ResourceDefinitionRepository.java8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb14
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/measures.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb9
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb7
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb12
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/lib/treemap/node.rb4
-rw-r--r--sonar-server/src/main/webapp/javascripts/application.js4
9 files changed, 43 insertions, 27 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/ui/ResourceDefinitionRepository.java b/sonar-server/src/main/java/org/sonar/server/ui/ResourceDefinitionRepository.java
index 4ef8b9d62d0..8f79ca0b526 100644
--- a/sonar-server/src/main/java/org/sonar/server/ui/ResourceDefinitionRepository.java
+++ b/sonar-server/src/main/java/org/sonar/server/ui/ResourceDefinitionRepository.java
@@ -19,17 +19,23 @@
*/
package org.sonar.server.ui;
+import com.google.common.annotations.Beta;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import org.sonar.api.BatchComponent;
import org.sonar.api.ServerComponent;
import org.sonar.api.resources.ResourceDefinition;
import java.util.Collection;
import java.util.Map;
-public class ResourceDefinitionRepository implements ServerComponent {
+/**
+ * @since 2.14
+ */
+@Beta
+public class ResourceDefinitionRepository implements BatchComponent, ServerComponent {
private final Map<String, ResourceDefinition> descriptionsByQualifier;
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb
index 1a084c21378..3bfbc684303 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb
@@ -108,7 +108,7 @@ class Sonar::Treemap
:tooltip => tooltip(resource, size_measure, color_measure),
:color => html_color(color_measure),
:rid => resource.switch_resource_or_self.id,
- :browsable => resource.display_dashboard?)
+ :leaf => resource.source_code?)
node.add_child(child)
end
end
@@ -153,8 +153,8 @@ class Sonar::HtmlOutput < Treemap::HtmlOutput
html += "background-color:#FFF;\">"
html += "<div rid='#{node.rid}' id=\"tm-node-#{node.id}\" style='margin: 1px;background-color: #{node.color}; height: #{node.bounds.height-4}px;
border: 1px solid #{node.color};' alt=\"#{node.tooltip}\" title=\"#{node.tooltip}\""
- if node.browsable
- html += "b=1 "
+ if node.leaf
+ html += "l=1 "
end
if @details_at_depth==node.depth
html += "onmouseover=\"this.style.borderColor='#444';\" onmouseout=\"this.style.borderColor='#{node.color}';\""
@@ -171,11 +171,11 @@ border: 1px solid #{node.color};' alt=\"#{node.tooltip}\" title=\"#{node.tooltip
end
def draw_label(node)
- if node.browsable
- "<a href='#{ApplicationController.root_context}/dashboard/index/#{node.rid}'>#{node_label(node)}</a>"
- else
+ if node.leaf
"<a onclick=\"window.open(this.href,'resource','height=800,width=900,scrollbars=1,resizable=1');return false;\" " +
- "href=\"#{ApplicationController.root_context}/resource/index/#{node.rid}\">#{node_label(node)}</a>"
+ "href=\"#{ApplicationController.root_context}/resource/index/#{node.rid}\">#{node_label(node)}</a>"
+ else
+ "<a href='#{ApplicationController.root_context}/dashboard/index/#{node.rid}'>#{node_label(node)}</a>"
end
end
end \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb
index 0b2c1b1d556..5077905767d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb
@@ -47,7 +47,7 @@
</td>
<td class="left" x="<%= u(snapshot.project.name) -%>">
<%= qualifier_icon(snapshot) %>
- <% if snapshot.project.display_dashboard? %>
+ <% if snapshot.display_dashboard? %>
<a href="<%= ApplicationController.root_context + "/dashboard/index/#{snapshot.project.id}" -%>"><%= snapshot.project.name -%></a>
<% else %>
<%= snapshot.project.name %>
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 e6d9c4650e6..c3848b0c1ed 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
@@ -63,13 +63,13 @@
%>
<tr class="<%= clazz -%>">
<td nowrap>
- <%
- if !resource.display_dashboard? %>
- <%= qualifier_icon(resource) -%>&nbsp;
+ <% unless resource.source_code? %>
+ <%= link_to(image_tag('zoom.png'), {:id => resource.id, :metric => @metric.id}, {:class => 'nolink'}) -%>
+ <% end %>
+ <%= qualifier_icon(resource) -%>&nbsp;
+ <% if resource.source_code? %>
<a href="#" onclick="d(<%= resource.id -%>)" alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) -%></a>
<% else %>
- <%= link_to(image_tag('zoom.png'), {:id => resource.id, :metric => @metric.id}, {:class => 'nolink'}) -%>
- <%= qualifier_icon(resource) -%>&nbsp;
<%= link_to(resource.name, {:only_path => true, :overwrite_params => {:rids => (selected ? rids-[resource.id] : rids+[resource.id])}}) -%>
<% end %>
</td>
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 8d300485af4..b79d399a1d1 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
@@ -140,12 +140,13 @@
%>
<tr class="<%= clazz -%>">
<td nowrap>
- <% if !resource.display_dashboard? %>
- <%= qualifier_icon(resource) -%>&nbsp;
+ <% unless resource.source_code? %>
+ <%= link_to(image_tag('zoom.png'), {:id => resource.id}, {:class => 'nolink'}) %>
+ <% end %>
+ <%= qualifier_icon(resource) -%>&nbsp;
+ <% if resource.source_code? %>
<a href="#" onclick="d(<%= resource.id -%>, '<%= @period_index -%>', '<%= @rule ? @rule.key : @severity -%>');" alt="<%= resource.name(true) -%>" title="<%= resource.name(true) -%>"><%= resource.name(false) %></a>
<% else %>
- <%= link_to(image_tag('zoom.png'), {:id => resource.id}, {:class => 'nolink'}) %>
- <%= qualifier_icon(resource) %>&nbsp;
<%= link_to(h(resource.name), {:only_path => true, :overwrite_params => {:rids => (selected ? rids-[resource.id] : rids+[resource.id])}}) -%>
<% end %>
</td>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
index f1e4d260c2c..0cd94a80fba 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_tabs.html.erb
@@ -7,11 +7,14 @@
selected_project_id = params[:project].to_i
if @resource.project && selected_project_id != @resource.project.id %>
<div class="subtitle">
+ <!-- vertical alignment with title -->
+ <img src="<%= ApplicationController.root_context -%>/images/e16.gif">
+ <% if logged_in? %><img src="<%= ApplicationController.root_context -%>/images/e16.gif"><% end %>
+
<%= @resource.ancestor_projects.select{|p| p.id != selected_project_id}.reverse.map{|p| p.name(true)}.join(' / ') -%>
</div>
<% end %>
- <% if logged_in? %><%= link_to_favourite(@resource) -%>
- <% end %>
+ <% if logged_in? %><%= link_to_favourite(@resource) -%><% end %>
<span class="h3"><%= qualifier_icon(@resource) -%> <%= @resource.name(true) -%></span>
</div>
<% end %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb b/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb
index 6e44e392bae..c232c7fc8dd 100644
--- a/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/lib/resourceable.rb
@@ -89,12 +89,18 @@ module Resourceable
qualifier==QUALIFIER_FILE
end
- NO_DASHBOARD_QUALIFIERS=[QUALIFIER_FILE, QUALIFIER_CLASS, QUALIFIER_UNIT_TEST_CLASS]
+ def source_code?
+ java_definition.hasSourceCode()
+ end
def display_dashboard?
- @display_dashboard ||=
+ !source_code?
+ end
+
+ def java_definition
+ @java_definition ||=
begin
- !NO_DASHBOARD_QUALIFIERS.include?(qualifier)
+ Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceDefinition(qualifier)
end
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/lib/treemap/node.rb b/sonar-server/src/main/webapp/WEB-INF/lib/treemap/node.rb
index 223288212d5..3fdfe001a0a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/lib/treemap/node.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/lib/treemap/node.rb
@@ -37,7 +37,7 @@ module Treemap
#
#
class Treemap::Node
- attr_accessor :id, :label, :color, :size, :bounds, :parent, :tooltip, :url, :title, :rid, :browsable
+ attr_accessor :id, :label, :color, :size, :bounds, :parent, :tooltip, :url, :title, :rid, :leaf
attr_reader :children
#
@@ -65,7 +65,7 @@ module Treemap
@tooltip = opts[:tooltip]
@children = []
@rid = opts[:rid]
- @browsable = opts[:browsable]
+ @leaf = opts[:leaf]
if(@id.nil?)
make_id
end
diff --git a/sonar-server/src/main/webapp/javascripts/application.js b/sonar-server/src/main/webapp/javascripts/application.js
index 6cfcf872ab0..75a5024e407 100644
--- a/sonar-server/src/main/webapp/javascripts/application.js
+++ b/sonar-server/src/main/webapp/javascripts/application.js
@@ -233,8 +233,8 @@ Treemap.prototype.handleClick = function (event) {
var elt = event.findElement('div');
var rid = elt.readAttribute('rid');
- var browsable = elt.hasAttribute('b');
- if (browsable) {
+ var leaf = elt.hasAttribute('l');
+ if (!leaf) {
var label = elt.innerText || elt.textContent;
var context = new TreemapContext('resource', rid, label);
this.breadcrumb.push(context);