]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3989 Remove the treemap of the Components page
authorSimon Brandhof <simon.brandhof@gmail.com>
Wed, 5 Dec 2012 14:18:38 +0000 (15:18 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Wed, 5 Dec 2012 14:21:02 +0000 (15:21 +0100)
sonar-server/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/sonar/components_configuration.rb
sonar-server/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml
sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_set_default.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/components/_treemap_settings.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/components/index.html.erb

index 8c412ab8db471845d2cb778f8de4586b0b05d82b..847ac655b5f3f95c1753dc057ee32295bc9fdce2 100644 (file)
@@ -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
index 180f6688b37420dc7882fa92d43e63d5f5fbf868..1e478dd1c371d771f5300f98934d0dd0cd6ee6a7 100644 (file)
@@ -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
 
index 5416e7d7f9296cd266d8c0e62c47c2c1f59fb044..ec6947bd3bf69757a1d72c18661bae8637347ed6 100644 (file)
         </form>
       </td>
     </tr>
-    <tr>
-      <td colspan="2">
-       <%= 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? %>
-        &nbsp; <%= image_tag("treemap_icon.png") %>
-      </td>
-    </tr>
   </table>
 </div>
 <% 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 (file)
index fd8e959..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<form method="post" id="form_set_default" name="setDefaultForm" action="<%= ApplicationController.root_context -%>/components/update_default_treemap_metrics"
-      onsubmit="">
-  <input type="hidden" name="rid" value="<%= rid -%>"/>
-  <input type="hidden" name="size_metric" />
-  <input type="hidden" name="color_metric" />
-</form>
-<script>
-  function submitDefaultForm() {
-    document.setDefaultForm.size_metric.value=$F('select_size_metric');
-    document.setDefaultForm.color_metric.value=$F('select_color_metric');
-    document.setDefaultForm.submit();
-  }
-</script>
\ 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 (file)
index 54846aa..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<div id="treemap_set_default">
-  <%= render :partial => 'components/treemap_set_default',
-    :locals => {:controller => 'components', :size_metric => @treemap.size_metric.key, :color_metric => @treemap.color_metric.key, :rid => @resource.id } %>
-</div>
-<table class="spaced">
-<tr>
-    <td valign="bottom">
-      <span class="comments"><%= message('size') -%></span>
-      <br/>
-      <%= 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);" %>
-    </td>
-  </tr>
-  <tr>
-    <td>
-      <span class="comments"><%= message('color') -%></span>&nbsp;&nbsp;
-      <span id="tm-gradient-1" class="comments little">
-        <%= render :partial => 'treemap/gradient', :locals => {:metric => @treemap.color_metric} %>
-      </span>
-      <%= image_tag('loading.gif', {:id => "tm-loading-1", :style => 'display: none;'}) %>
-      <br/>
-      <%= 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);" %>
-    </td>
-  </tr>
-
-  <% if configuring? && has_role?(:admin) %>
-  <tr >
-    <td class="admin"><%= button_to message('set_as_default'), "#", :id => 'set_default_treemap', :onclick => "submitDefaultForm();return false;" %></td>
-  </tr>
-  <% end %>
-</table>
index 447b3c3d9d18ff76590953c591eac71962436d8a..be8ab060245d615382e8832777fc1f87de314987 100644 (file)
         <script>TableKit.Sortable.init('components');</script>
         <p>&nbsp;</p>
       </td>
-      <% if @treemap %>
-        <td width="10px">&nbsp;</td>
-        <td width="280px" valign="top">
-          <script>
-            new Treemap(1, '<%= @treemap.size_metric ? @treemap.size_metric.key : '' -%>', '<%= @treemap.color_metric ? @treemap.color_metric.key : '' -%>', 100.0).init('resource',
-              <%= @resource.id -%>);
-          </script>
-
-          <div id="tm-1" class="treemap" style="height:<%= @treemap.height %>px">
-            <%= @treemap.generate_html() %>
-          </div>
-          <%= render :partial => 'components/treemap_settings', :locals => {:action => 'treemap'} %>
-        </td>
-      <% end %>
     </tr>
   </table>
 <% end %>