From 60b4d628841dd0463591825fa29cff5899e5d301 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Thu, 3 Mar 2011 12:04:28 +0100 Subject: [PATCH] SONAR-2218 integrate new resource viewers to measures drilldown --- .../app/controllers/browse_controller.rb | 22 ++++++++++------- .../views/browse/_header_violations.html.erb | 18 ++++++++++---- .../app/views/browse/_rules_filter.html.erb | 2 +- .../WEB-INF/app/views/browse/_tabs.html.erb | 12 ++++++++-- .../app/views/browse/extension.html.erb | 17 +++++++------ .../WEB-INF/app/views/browse/index.html.erb | 22 +++++++++++++---- .../app/views/drilldown/measures.html.erb | 24 +++++++++++++++++-- 7 files changed, 88 insertions(+), 29 deletions(-) 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 4a1642a57ea..a2df02fae1a 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 @@ -26,9 +26,9 @@ class BrowseController < ApplicationController @resource = Project.by_key(params[:id]) if (@resource && has_role?(:user, @resource)) + params[:layout]='false' @snapshot=@resource.last_snapshot - params[:layout]='false' load_extensions() if @extension @@ -62,8 +62,14 @@ class BrowseController < ApplicationController end end - selected_tab_id=params[:tab] - @extension=@extensions.find{|extension| extension.getId()==selected_tab_id} unless selected_tab_id.blank? + if !params[:tab].blank? + @extension=@extensions.find{|extension| extension.getId()==params[:tab]} + + elsif !params[:metric].blank? + metric=Metric.by_key(params[:metric]) + @extension=@extensions.find{|extension| extension.getDefaultTabForMetrics().include?(metric.key)} + + end @extension=@extensions.find{|extension| extension.isDefaultTab()} if @extension==nil end @@ -136,7 +142,7 @@ class BrowseController < ApplicationController end filter_lines_by_date() - render :action => 'index' + render :action => 'index', :layout => !request.xhr? end @@ -191,7 +197,7 @@ class BrowseController < ApplicationController end end end - render :action => 'index' + render :action => 'index', :layout => !request.xhr? end @@ -200,7 +206,7 @@ class BrowseController < ApplicationController def render_source load_sources() filter_lines_by_date() - render :action => 'index' + render :action => 'index', :layout => !request.xhr? end @@ -265,10 +271,10 @@ class BrowseController < ApplicationController def render_extension() - render :action => 'extension' + render :action => 'extension', :layout => !request.xhr? end def render_nothing() - render :action => 'nothing' + render :action => 'nothing', :layout => !request.xhr? end end \ No newline at end of file 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 ad5aadeed0d..d519d2566b4 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 @@ -7,27 +7,35 @@ - + +
<%= image_tag 'priority/BLOCKER.png'-%><%= image_tag 'priority/BLOCKER.png' -%> Blocker: <%= format_measure('blocker_violations', :default => 0) -%>
+ - + +
<%= image_tag 'priority/CRITICAL.png'-%><%= image_tag 'priority/CRITICAL.png' -%> Critical: <%= format_measure('critical_violations', :default => 0) -%>
+ - + +
<%= image_tag 'priority/MAJOR.png'-%><%= image_tag 'priority/MAJOR.png' -%> Major: <%= format_measure('major_violations', :default => 0) -%>
+ - + +
<%= image_tag 'priority/MINOR.png'-%><%= image_tag 'priority/MINOR.png' -%> Minor: <%= format_measure('minor_violations', :default => 0) -%>
+ - + 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 ea36a4da8d1..5caa1f63b3b 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 @@ -18,7 +18,7 @@ rule_options<<["#{h rule.name} (#{rule_counts[rule.id]})", rule.key] end %> - <% if blocker_violations && blocker_violations.value>0 %> 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 bfa00de46dd..7eb35e6517b 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 @@ -162,7 +162,15 @@ span.rulename a:hover { 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 f45db54fb12..9310d500de3 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 @@ -1,15 +1,18 @@ <%= render :partial => 'tabs' -%> <% if @extension.isGwt() %> - <%= render :partial => 'gwt/base', :locals => {:resource => @resource, :popup => false, :metric => nil} -%> -
+ <% if request.xhr? %> +
+ - - - - - + <% else %> + <%= render :partial => 'gwt/base', :locals => {:resource => @resource, :popup => false, :metric => nil} -%> +
+ + + + <% end %> <% else # ruby on rails page %> <%= render :inline => @page.getTemplate() %> 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 d4b5f7db905..b005c15c064 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 @@ -14,15 +14,29 @@ <% end %>
-
+ + + <% if @scm_available %> - onclick="submit()"/> + onclick="applyOptions()"/> <% end %> <% if @snapshot.project_snapshot.periods? %> - <%= period_select_options(@snapshot, 1) -%> <%= period_select_options(@snapshot, 2) -%> @@ -33,7 +47,7 @@ <% end %> <% if @expandable %> - onclick="submit()"/> + onclick="applyOptions()"/> <% end %> 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 6698666f014..12fa8ac1ec2 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,6 +1,25 @@ <%= render :partial => 'gwt/base', :locals => {:resource => @highlighted_resource, :popup => false, :metric => @metric.key} %> <%= render :partial => 'gwt/resource_viewers', :locals => {:resource => @drilldown.highlighted_resource || @project} %> +
<% if @characteristic %>

<%= @highlighted_metric.short_name -%> / <%= h(@characteristic.name(true)) -%>

@@ -42,7 +61,7 @@ <%= link_to(resource.name, {:only_path => true, :overwrite_params => {:rids => nil, :id => resource.copy_resource_id}}) -%> <% else %> <%= qualifier_icon(resource) %> - <%= resource.name(false) -%> + <%= resource.name(false) -%> <% end else %> <%= link_to(image_tag('zoom.png'), {:id => resource.id, :metric => @metric.id}, {:class => 'nolink'}) %> @@ -70,4 +89,5 @@ $$('#col_<%= column.scope -%> tr.selected').each(function(item) {item.scrollIntoView(true);}); <% end %> -
\ No newline at end of file + +
-- 2.39.5
<%= image_tag 'priority/INFO.png'-%><%= image_tag 'priority/INFO.png' -%> Info: <%= format_measure('info_violations', :default => 0) -%>