]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5207 remove unused ruby code
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 16 Jul 2014 11:03:14 +0000 (13:03 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 16 Jul 2014 11:03:37 +0000 (13:03 +0200)
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/columns_controller.rb
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/models/sonar/columns_view.rb
server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_treemap.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/index.html.erb [deleted file]

index c5468dd31b960625664e61d00d3d07c08bb0cf8d..2e3655b2c7c7decfc03017b3402a3878b07bb040 100644 (file)
@@ -37,11 +37,6 @@ class ColumnsController < ApplicationController
     redirect_to :controller => 'components', :action => 'index', :configuring => 'true', :id => params[:rid]
   end
 
-  def toggle_treemap
-    @components_configuration.toggle_treemap_enabled
-    redirect_to :controller => 'components', :action => 'index', :configuring => 'true', :id => params[:rid]
-  end
-  
   def left
     column = @components_configuration.find_selected_column(@column_id)
     @components_configuration.move_column(column, "left")
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/treemap_controller.rb
deleted file mode 100644 (file)
index 7cbc5ce..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-#
-class TreemapController < ApplicationController
-  helper :metrics
-
-  def index
-    verify_ajax_request
-    require_parameters :html_id, :resource
-
-    if params[:size_metric].present?
-      size_metric=Metric.by_key(params[:size_metric])
-      bad_request('Unknown metric: ' + params[:size_metric]) unless size_metric
-    end
-
-    if params[:color_metric].present?
-      color_metric=Metric.by_key(params[:color_metric])
-      bad_request('Unknown metric: ' + params[:color_metric]) unless color_metric
-    end
-
-    resource = Project.by_key(params[:resource])
-    bad_request('Unknown resource: ' + params[:resource]) unless resource
-    bad_request('Data not available') unless resource.last_snapshot
-    access_denied unless has_role?(:user, resource)
-    resource = resource.permanent_resource
-
-    filter = MeasureFilter.new
-    filter.set_criteria_value(:base, resource.key)
-    filter.set_criteria_value(:onBaseComponents, 'true')
-    filter.set_criteria_value(:display, 'treemap')
-    filter.set_criteria_value(:tmSize, size_metric.key) if size_metric
-    filter.set_criteria_value(:tmColor, color_metric.key) if color_metric
-    filter.execute(self, :user => current_user)
-
-    render :text => filter.display.html
-  end
-
-end
index e88c8e2b0c72fd86d65000944879242560727148..1aa3c6f5802090b6709daad2ffe3e346f42a0028 100644 (file)
@@ -23,7 +23,6 @@ class Sonar::ColumnsView
   TYPE_BUILD_TIME = 'BUILD_TIME'
   TYPE_LINKS = 'LINKS'
   TYPE_METRIC = 'METRIC'
-  TYPE_TREE_MAP = 'TREEMAP'
   TYPE_LANGUAGE = 'LANGUAGE'
   TYPE_VERSION = 'VERSION'
 
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/measures/_display_treemap.html.erb
deleted file mode 100644 (file)
index 6b3a6c9..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<script>
-  var filterCriteria<%= widget_id -%> = <%= json_escape(filter.criteria.to_json) -%>;
-</script>
-<%
-   treemap_id = widget_id.nil? ? 1 : widget_id
-   colspan = 1
-%>
-  <table class="spaced">
-    <tr>
-      <% if filter.display.size_metric %>
-        <td class="thin nowrap"><span class="note"><%= message('size') -%>: <b><%= filter.display.size_metric.short_name -%></b></span></td>
-      <%
-         colspan += 1
-         end %>
-      <% if filter.display.color_metric %>
-        <td class="thin nowrap">
-          <span class="note"><%= message('color') -%>: <b><%= filter.display.color_metric.short_name -%></b> <%= render :partial => 'treemap/gradient', :locals => {:metric => filter.display.color_metric} %></span>
-        </td>
-      <%
-         colspan += 1
-         end %>
-      <td>
-        <%= image_tag 'loading-small.gif', :id => "tm-loading-#{treemap_id}", :style => 'display:none' -%>
-      </td>
-    </tr>
-    <tr>
-      <td colspan="<%= colspan.to_s %>">
-        <span id="tm-bottom-level-reached-msg-<%= treemap_id %>" class="note" style="display:none;"><%= message('treemap.bootom_level_reached') -%></span>
-      </td>
-    </tr>
-  </table>
-
-<% unless defined? widget
-     content_for :script do %>
-    <script>
-      $j(document).ready(function () {
-        $j("#update-treemap").on("click", function (e) {
-          filterCriteria<%= widget_id -%>['tmSize']=$j('#select-tm-size').val();
-          var color = $j('#select-tm-color').val();
-          if (color != null && color != '') {
-            filterCriteria<%= widget_id -%>['tmColor']=color;
-          }
-          filterCriteria<%= widget_id -%>['edit']=true;
-          window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
-        });
-        $j("#exit-edit").on("click", function (e) {
-          delete filterCriteria<%= widget_id -%>['edit'];
-          window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
-        });
-      });
-    </script>
-  <% end
-     end %>
-
-<% if filter.rows.empty? %>
-  <p><%= message('no_data') -%></p>
-<% elsif filter.pagination.pages>1 %>
-  <p><%= message('measure_filter.error.TOO_MANY_RESULTS') -%></p>
-<% else %>
-  <div id="tm-<%= treemap_id -%>" class="treemap width100">
-    <%= filter.display.html -%>
-  </div>
-
-  <div style="margin: 5px 0 0 0" class="notes">
-    <div style="float: right;cursor: help"><i class="icon-help" title="<%= h(message('treemap.click_help')) -%>"></i></div>
-    <div id="tm-bc-<%= treemap_id -%>">/</div>
-  </div>
-
-  <script>
-    new Treemap(<%= treemap_id -%>, '<%= filter.display.size_metric.key  -%>', '<%= filter.display.color_metric ? filter.display.color_metric.key : '' -%>', <%= filter.display.height_percents -%>);
-  </script>
-
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_gradient.html.erb
deleted file mode 100644 (file)
index c42b6ac..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<%
-if metric && metric.worst_value && metric.best_value && (metric.val_type != Metric::VALUE_TYPE_RATING)
-  if metric.worst_value<metric.best_value
-    min=metric.worst_value
-    max=metric.best_value
-    image = 'treemap_gradient.png'
-    id = 'treemap_gradient_direction_positive'
-  else
-    min=metric.best_value
-    max=metric.worst_value
-    image = 'treemap_gradient_inverted.png'
-    id = 'treemap_gradient_direction_negative'
-  end
-%>
-  <%= min -%><%= metric.suffix -%> <img id="<%= id -%>" src="<%= image_path image -%>" style="border: 1px solid #000; vertical-align:middle"> <%= max
-  -%><%= metric.suffix -%>
-<%
-end
-%>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_treemap.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_treemap.html.erb
deleted file mode 100644 (file)
index 52ced24..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<div class="treemap" style="width: 100%; height:<%= treemap.height %>px;">
-  <%= treemap.generate_html() -%>
-</div>
\ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/_treemap_container.html.erb
deleted file mode 100644 (file)
index 575cdcb..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<div id="tm-container-<%= treemap_id -%>">
-  <table width="100%" class="spacer-bottom">
-    <tr>
-      <td valign="top" class="thin nowrap">
-        <span class="comments"><%= message('size') -%></span>
-        <br/>
-        <%= select_tag "size", options_grouped_by_domain(Sonar::Treemap.size_metrics, (size_metric && size_metric.key), :include_empty => true),
-                       :id => "tm-size-#{treemap_id}", :class => 'small medium-width spacer-right', :onchange => "return treemapById(#{treemap_id}).changeSizeMetric(this.value)"
-        %>
-      </td>
-      <td valign="top" class="thin nowrap">
-        <span class="comments"><%= message('color') -%></span>
-        <span id="tm-gradient-<%= treemap_id -%>" class="note"></span>
-        <br/>
-        <%= select_tag 'color', options_grouped_by_domain(Sonar::Treemap.color_metrics, (color_metric && color_metric.key), :include_empty => true),
-                         :id => "tm-color-#{treemap_id}", :class => 'small medium-width', :onchange => "return treemapById(#{treemap_id}).changeColorMetric(this.value)" %>
-        <%= image_tag 'loading.gif', :id => "tm-loading-#{treemap_id}", :style => 'vertical-align: top;display: none' -%>
-      </td>
-      <td></td>
-    </tr>
-  </table>
-  <input type="hidden" id="tm-h-<%= treemap_id -%>" value="<%= height_in_percents -%>"/>
-</div>
-<div id="tm-<%= treemap_id -%>" class="spacer-bottom"></div>
-
-<div style="margin: 5px 0 0 0" class="notes">
-  <div style="float: right;cursor: help"><%= image_tag 'help.png', :title => h(message('treemap.click_help')) -%></div>
-  <div id="tm-bc-<%= treemap_id -%>">/</div>
-</div>
-
-<script>
-  var treemap = new Treemap(<%= treemap_id -%>, '<%= size_metric ? size_metric.key : '' -%>', '<%= color_metric ? color_metric.key : '' -%>',
-      <%= height_in_percents -%>);
-  treemap.init('<%= context_type -%>', <%= context_id -%>).load();
-
-</script>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/treemap/index.html.erb
deleted file mode 100644 (file)
index c901b2e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<% if @treemap && @treemap.enough_data? %>
-<div id="treemap" class="treemap" style="width: <%= @treemap.width -%>px; height:<%= @treemap.height %>px;">
-<%= @treemap.generate_html() %>
-</div>
-<% end %>
\ No newline at end of file