]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7179 drop the Components page
authorStas Vilchik <vilchiks@gmail.com>
Thu, 7 Jan 2016 14:58:24 +0000 (15:58 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 7 Jan 2016 16:12:28 +0000 (17:12 +0100)
server/sonar-web/src/main/js/libs/sonar.js
server/sonar-web/src/main/js/libs/sortable.js [deleted file]
server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/components_controller.rb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header.rhtml [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header_edit_mode.rhtml [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/components/index.html.erb [deleted file]

index a245d4142d46420410495cda852d5e8866344126..fd1591dc355fef956f4996fbf0741cbd99d3906e 100644 (file)
@@ -23,7 +23,6 @@ require('script!./third-party/keymaster.js');
 require('script!./third-party/bootstrap/tooltip.js');
 require('script!./third-party/bootstrap/dropdown.js');
 require('script!./select2-jquery-ui-fix.js');
-require('script!./sortable.js');
 require('script!./inputs.js');
 require('script!./jquery-isolated-scroll.js');
 require('script!./application.js');
diff --git a/server/sonar-web/src/main/js/libs/sortable.js b/server/sonar-web/src/main/js/libs/sortable.js
deleted file mode 100644 (file)
index 134254a..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * SonarQube :: Web
- * Copyright (C) 2009-2016 SonarSource SA
- * mailto:contact AT sonarsource DOT com
- *
- * This program 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.
- *
- * This program 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.
- */
-
-/*
- * DEPRECATED
- *
- * Found only single usage on the Components page.
- */
-
-(function($) {
-
-  function stripe(rows) {
-    rows.each(function(index) {
-      $(this).toggleClass('rowodd', index % 2 === 0);
-      $(this).toggleClass('roweven', index % 2 !== 0);
-    });
-  }
-
-
-  function getValue(cell) {
-    return cell.attr('x') || $.trim(cell.text()) || '';
-  }
-
-
-  function sort(container, rows, cellIndex, order) {
-    var sortArray = rows.map(function(index) {
-      var cell = $(this).find('td').eq(cellIndex);
-      return { index: index, value: getValue(cell) };
-    }).get();
-
-    Array.prototype.sort.call(sortArray, function(a, b) {
-      if (isNaN(a.value) || isNaN(b.value)) {
-        return order * (a.value > b.value ? 1 : -1);
-      } else {
-        return order * (a.value - b.value);
-      }
-    });
-
-    rows.detach();
-    sortArray.forEach(function(a) {
-      var row = rows[a.index];
-      container.append(row);
-    });
-
-    stripe(container.find('tr'));
-  }
-
-
-  function markSorted(headCells, cell, asc) {
-    headCells.removeClass('sortasc sortdesc');
-    cell.toggleClass('sortasc', asc);
-    cell.toggleClass('sortdesc', !asc);
-  }
-
-
-  $.fn.sortable = function() {
-    return $(this).each(function() {
-      var thead = $(this).find('thead'),
-          tbody = $(this).find('tbody'),
-          headCells = thead.find('tr:last th'),
-          rows = tbody.find('tr');
-
-       headCells.filter(':not(.nosort)').addClass('sortcol');
-       headCells.filter(':not(.nosort)').on('click', function() {
-         var toAsc = !$(this).is('.sortasc');
-         markSorted(headCells, $(this), toAsc);
-         sort(tbody, rows, headCells.index($(this)), toAsc ? 1 : -1);
-       });
-
-      var sortFirst = headCells.filter('[class^=sortfirst],[class*=sortfirst]');
-      if (sortFirst.length > 0) {
-        var asc = sortFirst.is('.sortfirstasc');
-        markSorted(headCells, sortFirst, asc);
-        sort(tbody, rows, headCells.index(sortFirst), asc ? 1 : -1);
-      } else {
-        stripe(rows);
-      }
-    });
-  };
-
-})(jQuery);
index 9647ee60cda0bb35332b4086246659e671dd2c42..c2ce247069a4e4920445c6c71a175fbb89b18a57 100644 (file)
@@ -167,11 +167,6 @@ export default React.createClass({
     return this.renderLink(url, translate('code.page'), '/code');
   },
 
-  renderComponentsLink() {
-    const url = `/components/index?id=${encodeURIComponent(this.props.component.key)}`;
-    return this.renderLink(url, translate('components.page'), '/components');
-  },
-
   renderComponentIssuesLink() {
     const url = `/component_issues/index?id=${encodeURIComponent(this.props.component.key)}`;
     return this.renderLink(url, translate('issues.page'), '/component_issues');
@@ -334,7 +329,6 @@ export default React.createClass({
           {!this.isDeveloper() && this.renderFixedDashboards()}
           {this.renderCustomDashboards()}
           {this.renderCodeLink()}
-          {this.renderComponentsLink()}
           {this.renderComponentIssuesLink()}
           {this.renderTools()}
           {this.renderAdministration()}
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/components_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/components_controller.rb
deleted file mode 100644 (file)
index 093e1aa..0000000
+++ /dev/null
@@ -1,93 +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 ComponentsController < ApplicationController
-
-  before_filter :init_resource_for_user_role
-
-  helper :metrics, :components
-
-  SECTION = Navigation::SECTION_RESOURCE
-
-  def index
-    @components_configuration = Sonar::ComponentsConfiguration.new
-
-    unless @snapshot.nil?
-      @snapshots = Snapshot.all(:include => 'project', :conditions => ['snapshots.parent_snapshot_id=?', @snapshot.id])
-     else
-      @snapshots = []
-     end
-
-    @columns = @components_configuration.selected_columns
-    metrics = @components_configuration.homepage_metrics
-
-    measures = component_measures(@snapshots, metrics)
-    @measures_by_snapshot = measures_by_snapshot(@snapshots, measures)
-  end
-
-  protected
-
-  def refresh_configure
-    render :update do |page|
-      page.replace_html("rule_id_#{@rule.id}", :partial => 'rule', :locals => {:rule => @rule})
-    end
-  end
-
-  def measures_by_snapshot(snapshots, measures)
-    snapshot_by_id = {}
-    snapshots.each { |s| snapshot_by_id[s.id]=s }
-    hash={}
-    measures.each do |m|
-      if m && m.snapshot_id && snapshot_by_id[m.snapshot_id]
-        hash[snapshot_by_id[m.snapshot_id]] ||= []
-        hash[snapshot_by_id[m.snapshot_id]] << m
-      end
-    end
-    hash
-  end
-
-  def component_measures(snapshots, metrics)
-    sids = snapshots.collect { |s| s.id }
-    if sids && sids.size>0
-      mids = metrics.collect { |metric| metric.id }
-      measures=[]
-
-      page_size=950
-      page_count=(snapshots.size/page_size)
-      page_count+=1 if (snapshots.size % page_size)>0
-
-      page_count.times do |page_index|
-        page_sids=sids[page_index*page_size...(page_index+1)*page_size]
-        measures.concat(ProjectMeasure.find(:all, :conditions => {
-          'snapshot_id' => page_sids,
-          'metric_id' => mids,
-          'rule_id' => nil,
-          'rule_priority' => nil,
-          'characteristic_id' => nil,
-          'person_id' => nil}))
-      end
-      measures
-    else
-      []
-    end
-  end
-
-
-
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml b/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml
deleted file mode 100644 (file)
index 32b9ab2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<% if has_role?(:admin) && configuring? %>
-<div class="admin">
-  <table class="spaced">
-      <% addeable_columns = components_configuration.addeable_columns %>
-     <% if addeable_columns.size > 0 %>
-    <tr>
-       <td colspan="2"><%= image_tag 'warning.png' %> <%= message('components.note_changes_impact_all_users') -%></td>
-       </tr>
-    <tr>
-      <td width="1%" nowrap><%= message('add_a_column') -%></td>
-      <td>
-        <form action="<%= url_for :controller => "columns", :action => "add" -%>" >
-          <input type="hidden" name="rid" value="<%= @resource.id if @resource %>" />
-          <select name="id" onchange="$j('#add_column_loading').show();submit();" id="select_add_column">
-            <option value=""></option>
-            <% addeable_columns.keys.sort.each do |domain| %>
-              <optgroup label="<%= domain %>">
-                <% addeable_columns[domain].each do |column| %>
-                  <option value="<%= column.id -%>"><%= column.name %></option>
-                <% end %>
-              </optgroup>
-            <% end %>
-          </select>
-          <%= image_tag 'loading.gif', :style => 'display: none;', :id => 'add_column_loading' %>
-          <script>
-            $j(function() {
-              $j('#select_add_column').select2({
-                width: '300px',
-                placeholder: '<%= escape_javascript message('select_a_metric') -%>'
-              });
-            });
-          </script>
-        </form>
-      </td>
-    </tr>
-    <% end %>
-    <tr>
-      <td width="1%" nowrap><%= message('default_sort_on') -%> </td>
-      <td>
-        <form action="<%= url_for :controller => "columns", :action => "default_sorting" -%>">
-          <input type="hidden" name="rid" value="<%= @resource.id if @resource %>" />
-          <select name="id" onchange="$j('#sort_column_loading').show();submit();" id="select_default_sorting">
-               <option value="project" <%= 'selected' if components_configuration.sorted_by_project_name? -%>><%= message('project_name') -%></option>
-            <% configured_columns.sort_by{|col| col.name}.each do |column| 
-                if column.sortable? %>
-                <option value="<%= column.id -%>" <%= 'selected' if column.sort_default? -%>><%= column.name %></option>
-            <% end
-            end %>
-          </select>
-          <%= image_tag 'loading.gif', :style => 'display: none;', :id => 'sort_column_loading' %>
-          <script>
-            $j(function() {
-              $j('#select_default_sorting').select2({ width: '150px' });
-            });
-          </script>
-        </form>
-      </td>
-    </tr>
-  </table>
-</div>
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header.rhtml b/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header.rhtml
deleted file mode 100644 (file)
index 35af60e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<thead>
-<% if @snapshot %>
-  <tr >
-    <th></th>
-    <th class="nosort"></th>
-    <th class="text-left text <%= 'sortfirstasc' if @components_configuration.sorted_by_project_name? -%>" style="padding-left: 15px"><%= message('name') -%></th>
-    <% configured_columns.each do |column| %>
-       <th class="<%= column.get_table_header_css %>"  style="padding-right: 15px"><%= column.name %></th>
-    <% end %>
-  </tr>
-  <tr class="total" id="project_<%= @snapshot.project_id -%>">
-    <%  alert_status_measure=@snapshot.measure(Metric::ALERT_STATUS)
-        alert_status_x=(alert_status_measure ? alert_status_measure.data : '')
-     %>
-    <th x="<%= alert_status_x -%>"><%= format_measure(alert_status_measure) %></th>
-    <th><% if logged_in? %><%= link_to_favourite(@snapshot.project) -%><% end %></th>
-    <th class="text-left text <%= 'sortfirstasc' if @components_configuration.sorted_by_project_name? -%>">
-      <%= qualifier_icon(@snapshot) -%>
-      <a class="text-no-transform" x="<%= u(@snapshot.project.name) -%>" href="<%= ApplicationController.root_context + "/dashboard/index/#{@snapshot.project.id}" -%>"><%= h @snapshot.project.name -%></a>
-    </th>
-    <% @columns.each do |column| %>
-      <%= get_header_content(column, @snapshot) -%>
-    <% end %>
-  </tr>
-  <tr class="blank"><th colspan="<%= @columns.size + 2 -%>">&nbsp;</th></tr>
-<% end %>
-<tr>
-  <th></th>
-  <th class="nosort"></th>
-  <th class="text-left text <%= 'sortfirstasc' if @components_configuration.sorted_by_project_name? -%>"><%= message('name') -%></th>
-  <% configured_columns.each do |column| %>
-     <th class="<%= column.get_table_header_css %> righticon"><%= column.name %></th>
-  <% end %>
-</tr>
-</thead>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header_edit_mode.rhtml b/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header_edit_mode.rhtml
deleted file mode 100644 (file)
index 3e14b68..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<thead>
-<tr>
-    <th></th>
-    <th></th>
-    <th><%= message('name') -%></th>
-    <% configured_columns.each do |column| %>
-         <th class="<%= column.get_table_header_css_no_sort %>">
-        <span id="project_title_<%= column.id %>"><%= column.name %></span>
-      </th>
-    <% end %>
-</tr>
-<tr class="admin">
-    <td></td>
-    <td></td>
-    <th></td>
-    <% configured_columns.each do |column| %>
-         <th class="text-right nosort nowrap">
-        <%= link_to( image_tag("controls/resultset_previous.png", :alt => message('move_left'), :id => "move_left_" + column.id),
-                                              {:controller => "columns", :action => "left", :id => column.id, :rid => @resource.id}, :class => 'nolink') if column.position > 0 %>
-        <%= link_to( image_tag("bin_closed.png", :alt => message('remove_column'), :id => "remove_" + column.id),
-                                    {:controller => "columns", :action => "delete", :id => column.id, :rid => @resource.id}, :class => 'nolink') %>
-                   <%= link_to( image_tag("controls/resultset_next.png", :alt => message('move_right'), :id => "move_right_" + column.id),
-                                              {:controller => "columns", :action => "right", :id => column.id, :rid => @resource.id}, :class => 'nolink') if column.position != configured_columns.size - 1 %>
-      </th>
-    <% end %>
-</tr>
-</thead>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/index.html.erb
deleted file mode 100644 (file)
index 56b880e..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-<div class="page">
-  <header class="page-header">
-    <% if is_admin? %>
-      <div class="page-actions">
-        <%= message('customize') -%>
-        <% if configuring? %>
-          <span class="green"><b><%= message('on').upcase -%></b></span> |
-          <a class="action" href="<%= url_for :overwrite_params => {:configuring => nil} -%>" id="configure-off"><%= message('off').upcase -%></a>
-        <% else %>
-          <a class="action" href="<%= url_for :overwrite_params => {:configuring => 'true'} -%>" id="configure-on"><%= message('on').upcase -%></a>
-          | <span class="red"><b><%= message('off').upcase -%></b></span>
-        <% end %>
-      </div>
-    <% end %>
-  </header>
-
-  <% if has_role?(:admin) && configuring? %>
-    <%= render :partial => 'list_edit_mode_controls', :locals => {:configured_columns => @columns, :components_configuration => @components_configuration} %>
-  <% end %>
-  <% if @snapshots.empty? && @resource.nil? %>
-    <h3><%= message('components.no_projects_have_been_analysed') -%>No projects have been analysed.</h3>
-
-    <p><%= message('components.explanation_launch_sonar_to_have_results') -%></p>
-  <% else %>
-    <table width="100%">
-      <tr>
-        <td align="left" valign="top">
-          <table id="components" class="data sortable">
-            <%= render :partial => 'list_table_header', :locals => {:configured_columns => @columns} if !configuring? || (!is_admin? && configuring?) %>
-            <%= render :partial => 'list_table_header_edit_mode', :locals => {:configured_columns => @columns} if configuring? && is_admin? %>
-            <tbody>
-            <% if @snapshots.empty? %>
-              <tr>
-                <td colspan="<%= @columns.size + 3 -%>">No components</td>
-              </tr>
-            <% else
-                 @snapshots.each do |snapshot| %>
-                <% project = snapshot.project %>
-                <tr id="project_<%= project.id -%>">
-                  <% alert_status_measure=search_measure(@measures_by_snapshot[snapshot], Metric::ALERT_STATUS)
-                     alert_status_x=(alert_status_measure ? alert_status_measure.data : '')
-                  %>
-                  <td x="<%= alert_status_x -%>" width="1%" nowrap><%= format_measure(alert_status_measure) %></td>
-                  <td width="1%" nowrap>
-                    <% if logged_in? %>
-                      <%= link_to_favourite(project) -%>
-                    <% end %>
-                    <% if snapshot.display_dashboard? %>
-                      <%= link_to image_tag('zoom.png'), {:controller => 'dashboard', :id => snapshot.project.id}, :class => 'link-no-underline' %>
-                    <% else %>
-                      <%= link_to_resource(project, '<i class="icon-detach"></i>') %>
-                    <% end %>
-                  </td>
-                  <td class="text-left" x="<%= u(snapshot.project.name) -%>">
-                    <%= qualifier_icon(snapshot) %>
-                    <% if snapshot.display_dashboard? %>
-                      <%= link_to_resource(project, h(snapshot.project.name)) %>
-                    <% else %>
-                      <%= h snapshot.project.name %>
-                    <% end %>
-                  </td>
-                  <% @columns.each do |column| %>
-                    <%= get_column_content(column, snapshot, @measures_by_snapshot) -%>
-                  <% end %>
-                </tr>
-              <% end %>
-            <% end %>
-            </tbody>
-          </table>
-          <script>jQuery('#components').sortable();</script>
-          <p>&nbsp;</p>
-        </td>
-      </tr>
-    </table>
-  <% end %>
-</div>