From d80c68d79ba651ecc62eebf8f024b481f8f22eae Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 5 Dec 2012 15:18:38 +0100 Subject: [PATCH] SONAR-3989 Remove the treemap of the Components page --- .../app/controllers/components_controller.rb | 35 ------------------- .../models/sonar/components_configuration.rb | 10 ------ .../components/_list_edit_mode_controls.rhtml | 9 ----- .../components/_treemap_set_default.html.erb | 13 ------- .../components/_treemap_settings.html.erb | 32 ----------------- .../app/views/components/index.html.erb | 14 -------- 6 files changed, 113 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_set_default.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_settings.html.erb diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb index 8c412ab8db4..847ac655b5f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb @@ -21,16 +21,7 @@ class ComponentsController < ApplicationController helper :metrics, :components - verify :method => :post, :only => :update_default_treemap_metrics - - before_filter :admin_required, :only => :update_default_treemap_metrics - - TREEMAP_SIZE = 280 SECTION = Navigation::SECTION_RESOURCE - TREEMAP_DEFAULT_SIZE_METRIC = 'ncloc' - TREEMAP_SIZE_METRIC_PROPERTY = 'sonar.core.treemap.sizemetric' - TREEMAP_DEFAULT_COLOR_METRIC = 'violations_density' - TREEMAP_COLOR_METRIC_PROPERTY = 'sonar.core.treemap.colormetric' def index init_resource_for_user_role @@ -43,18 +34,6 @@ class ComponentsController < ApplicationController measures = component_measures(@snapshots, metrics) @measures_by_snapshot = measures_by_snapshot(@snapshots, measures) - if @components_configuration.treemap_enabled? && @snapshots.size>1 - @treemap = Sonar::Treemap.new(1, default_treemap_size_metric, TREEMAP_SIZE, { - :color_metric => default_treemap_color_metric, - :root_snapshot => @snapshot - }) - end - end - - def update_default_treemap_metrics - Property.set(TREEMAP_SIZE_METRIC_PROPERTY, params[:size_metric]) - Property.set(TREEMAP_COLOR_METRIC_PROPERTY, params[:color_metric]) - redirect_to :action => 'index', :id => params[:rid], :configuring => true end protected @@ -104,20 +83,6 @@ class ComponentsController < ApplicationController end end - def default_treemap_color_metric - metric=Metric.by_key(Property.value(TREEMAP_COLOR_METRIC_PROPERTY)) - if metric.nil? - metric = Metric.by_key(TREEMAP_DEFAULT_COLOR_METRIC) - end - metric - end - def default_treemap_size_metric - metric=Metric.by_key(Property.value(TREEMAP_SIZE_METRIC_PROPERTY)) - if metric.nil? - metric = Metric.by_key(TREEMAP_DEFAULT_SIZE_METRIC) - end - metric - end end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb index 180f6688b37..1e478dd1c37 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb @@ -24,11 +24,9 @@ class Sonar::ComponentsConfiguration COLUMNS_SELECTED_KEY = 'sonar.core.projectsdashboard.columns' COLUMNS_DEFAULT_SORT_KEY = 'sonar.core.projectsdashboard.defaultSortedColumn' - TREEMAP_ENABLED_KEY = 'sonar.core.projectsdashboard.showTreemap' def initialize @sorted_column_id=Property.value(COLUMNS_DEFAULT_SORT_KEY) || Sonar::ColumnsView::TYPE_PROJECT - @enabled_treemap=(Property.value(TREEMAP_ENABLED_KEY) || 'true')=='true' @text_columns=Property.value(COLUMNS_SELECTED_KEY) || default_text_columns end @@ -102,14 +100,6 @@ class Sonar::ComponentsConfiguration Property.set(COLUMNS_DEFAULT_SORT_KEY, column_id) end - def treemap_enabled? - @enabled_treemap - end - - def toggle_treemap_enabled - Property.set(TREEMAP_ENABLED_KEY, !treemap_enabled?) - end - @@available_columns = nil diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml b/sonar-server/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml index 5416e7d7f92..ec6947bd3bf 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml @@ -43,15 +43,6 @@ - - - <%= link_to( message('enable_treemap'), - {:controller => "columns", :action => "toggle_treemap", :rid => @resource.id}, {:class => 'action'} ) if (!components_configuration.treemap_enabled?) %> - <%= link_to( message('disable_treemap'), - {:controller => "columns", :action => "toggle_treemap", :rid => @resource.id}, {:class => 'action'} ) if components_configuration.treemap_enabled? %> -   <%= image_tag("treemap_icon.png") %> - - <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_set_default.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_set_default.html.erb deleted file mode 100644 index fd8e959e3cf..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_set_default.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -
- - - -
- \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_settings.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_settings.html.erb deleted file mode 100644 index 54846aa3560..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_settings.html.erb +++ /dev/null @@ -1,32 +0,0 @@ -
- <%= render :partial => 'components/treemap_set_default', - :locals => {:controller => 'components', :size_metric => @treemap.size_metric.key, :color_metric => @treemap.color_metric.key, :rid => @resource.id } %> -
- - - - - - - - - <% if configuring? && has_role?(:admin) %> - - - - <% end %> -
- <%= message('size') -%> -
- <%= select_tag 'size_metric', options_grouped_by_domain(Sonar::Treemap.size_metrics, @treemap.size_metric.key), - :id => 'select_size_metric', :class => 'small',:onchange => "return treemapById(1).changeSizeMetric(this.value);" %> -
- <%= message('color') -%>   - - <%= render :partial => 'treemap/gradient', :locals => {:metric => @treemap.color_metric} %> - - <%= image_tag('loading.gif', {:id => "tm-loading-1", :style => 'display: none;'}) %> -
- <%= select_tag 'color_metric', options_grouped_by_domain(Sonar::Treemap.color_metrics, @treemap.color_metric.key), - :id => 'select_color_metric', :class => 'small', :onchange => "return treemapById(1).changeColorMetric(this.value);" %> -
<%= button_to message('set_as_default'), "#", :id => 'set_default_treemap', :onclick => "submitDefaultForm();return false;" %>
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 447b3c3d9d1..be8ab060245 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 @@ -69,20 +69,6 @@

 

- <% if @treemap %> -   - - - -
- <%= @treemap.generate_html() %> -
- <%= render :partial => 'components/treemap_settings', :locals => {:action => 'treemap'} %> - - <% end %> <% end %> -- 2.39.5