From 6403c46e979f627f0fd7fae00005bea5a02d9c38 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 25 May 2012 14:28:29 +0200 Subject: [PATCH] SONAR-3083 allow to display children of developers --- .../java/org/sonar/server/filters/Filter.java | 8 ----- .../sonar/server/filters/FilterExecutor.java | 2 +- .../app/controllers/filters_controller.rb | 30 ++++++++++--------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/sonar-server/src/main/java/org/sonar/server/filters/Filter.java b/sonar-server/src/main/java/org/sonar/server/filters/Filter.java index 46afb84f1a1..12ed8983d86 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/Filter.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/Filter.java @@ -91,14 +91,6 @@ public class Filter { return baseSnapshotPath; } - public boolean isViewContext() { - return isViewContext; - } - - public void setViewContext(boolean b) { - isViewContext = b; - } - public Set getScopes() { return scopes; } diff --git a/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java b/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java index 4fe443510e8..c3d0f26e2fb 100644 --- a/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java +++ b/sonar-server/src/main/java/org/sonar/server/filters/FilterExecutor.java @@ -207,7 +207,7 @@ public class FilterExecutor implements ServerComponent { if (StringUtils.isNotBlank(filter.getNameRegexp())) { sql.append(" AND UPPER(p.long_name) LIKE :name"); } - if (!filter.isViewContext()) { + if (!filter.hasBaseSnapshot()) { sql.append(" AND p.copy_resource_id IS NULL "); } sql.append(" GROUP BY s.id"); diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb index e011675d7c5..cfe629a88d8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb @@ -33,7 +33,7 @@ class FiltersController < ApplicationController else @filters = ::Filter.find(:all, :conditions => {:user_id => current_user.id}) end - @filters.sort! { |a,b| a.name.downcase <=> b.name.downcase } + @filters.sort! { |a, b| a.name.downcase <=> b.name.downcase } end def list @@ -112,7 +112,7 @@ class FiltersController < ApplicationController access_denied unless @filter.authorized_to_edit?(self) if @filter - if WidgetProperty.find(:first, :conditions => { :kee => 'filter', :text_value => @filter.kee}) + if WidgetProperty.find(:first, :conditions => {:kee => 'filter', :text_value => @filter.kee}) flash[:error]='The filter is used in at least one dashboard. It cannot be deleted' else @filter.destroy @@ -263,7 +263,7 @@ class FiltersController < ApplicationController else snapshots=Snapshot.find(:all, :include => [:project, {:root_snapshot => :project}, {:parent_snapshot => :project}], - :conditions => ['snapshots.status=? AND snapshots.islast=? AND snapshots.scope=? AND projects.person_id IS NULL AND projects.scope=? AND UPPER(projects.long_name) LIKE ?', 'P', true, 'PRJ', 'PRJ', "%#{params[:search].upcase}%"]) + :conditions => ['snapshots.status=? AND snapshots.islast=? AND snapshots.scope=? AND projects.person_id IS NULL AND projects.scope=? AND UPPER(projects.long_name) LIKE ?', 'P', true, 'PRJ', 'PRJ', "%#{params[:search].upcase}%"]) snapshots=select_authorized(:user, snapshots) @snapshots_by_qualifier = {} @@ -299,9 +299,9 @@ class FiltersController < ApplicationController @height=(params[:height]||'500').to_i @treemap = Sonar::Treemap.new(@filter.id, @size_metric, @width, @height, { - :color_metric => @color_metric, - :period_index => @filter_context.period_index, - :measures_by_snapshot => @filter_context.measures_by_snapshot + :color_metric => @color_metric, + :period_index => @filter_context.period_index, + :measures_by_snapshot => @filter_context.measures_by_snapshot }) render :action => "treemap", :layout => false @@ -330,14 +330,16 @@ class FiltersController < ApplicationController filter.criteria< 'language', :operator => '=', :text_value => params['languages'].join(',')) if params['languages'] filter.criteria< 'direct-children', :operator => '=', :text_value => 'true') if params['direct-children'].present? - if params[:criteria]['0']['metric_id'].present? - filter.criteria<