]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8070 Drop of "Comparison" feature 1225/head
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 8 Sep 2016 11:58:18 +0000 (13:58 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Thu, 8 Sep 2016 14:09:43 +0000 (16:09 +0200)
it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java
it/it-tests/src/test/resources/measureHistory/HistoryUiTest/comparison/should-compare-project-versions.html [deleted file]
server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js
server/sonar-web/src/main/js/main/nav/global/search-view.js
server/sonar-web/src/main/webapp/WEB-INF/app/controllers/comparison_controller.rb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/_versions.html.erb [deleted file]
server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb [deleted file]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 5c6b44c2f1c50bc455d3dc78b3fbd7dfd7de1fb2..5496efd6ac99dc696fbd0b319d2cad4baa5ea3c1 100644 (file)
@@ -72,13 +72,4 @@ public class HistoryUiTest {
       ).build());
   }
 
-  /**
-   * SONAR-2911
-   */
-  @Test
-  public void test_comparison_page_between_project_versions() {
-    new SeleneseTest(Selenese.builder().setHtmlTestsInClasspath("comparison-page",
-      "/measureHistory/HistoryUiTest/comparison/should-compare-project-versions.html"
-      ).build()).runOn(orchestrator);
-  }
 }
diff --git a/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/comparison/should-compare-project-versions.html b/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/comparison/should-compare-project-versions.html
deleted file mode 100644 (file)
index 5bad1f9..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-    <title>should-compare-project-versions</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-    <tbody>
-    <tr>
-        <td>open</td>
-        <td>/comparison/index?resource=sample&amp;locale=en-gb</td>
-        <td></td>
-    </tr>
-    <tr>
-        <td>waitForText</td>
-        <td>comparison-page</td>
-        <td>*Sample*0.9-SNAPSHOT*19 Oct 2014*Sample*1.0-SNAPSHOT*13 Nov 2014*</td>
-    </tr>
-    <tr>
-        <td>waitForText</td>
-        <td>comparison-page</td>
-        <td>*Lines of Code*24*40*</td>
-    </tr>
-    <tr>
-        <td>waitForText</td>
-        <td>comparison-page</td>
-        <td>*Lines of Code*Complexity*Comments (%)*Duplicated Lines (%)*Issues*Coverage*</td>
-    </tr>
-    </tbody>
-</table>
-</body>
-</html>
index cf945ffb4b8b7a5535c4200567dc37ac6a3c944b..05aadf80412e82ed9f67649a72f25cde30f8a120 100644 (file)
@@ -123,15 +123,6 @@ export default React.createClass({
     );
   },
 
-  renderComparisonLink () {
-    const url = window.baseUrl + '/comparison';
-    return (
-        <li className={this.activeLink('/comparison')}>
-          <a href={url}>{translate('comparison_global.page')}</a>
-        </li>
-    );
-  },
-
   renderGlobalPageLink (globalPage, index) {
     const url = window.baseUrl + globalPage.url;
     return (
@@ -142,6 +133,9 @@ export default React.createClass({
   },
 
   renderMore () {
+    if (this.props.globalPages.length == 0) {
+      return null;
+    }
     const globalPages = this.props.globalPages.map(this.renderGlobalPageLink);
     return (
         <li className="dropdown">
@@ -150,7 +144,6 @@ export default React.createClass({
             <span className="icon-dropdown"/>
           </a>
           <ul className="dropdown-menu">
-            {this.renderComparisonLink()}
             {globalPages}
           </ul>
         </li>
index e88f381201cbb23709c7fb83fb6ebb08e5d790f9..e061eb90a9a33a303eee38185b9720004a833015 100644 (file)
@@ -230,8 +230,7 @@ export default Marionette.LayoutView.extend({
       { name: translate('layout.measures'), url: window.baseUrl + '/measures/search?qualifiers[]=TRK' },
       { name: translate('coding_rules.page'), url: window.baseUrl + '/coding_rules' },
       { name: translate('quality_profiles.page'), url: window.baseUrl + '/profiles' },
-      { name: translate('quality_gates.page'), url: window.baseUrl + '/quality_gates' },
-      { name: translate('comparison_global.page'), url: window.baseUrl + '/comparison' }
+      { name: translate('quality_gates.page'), url: window.baseUrl + '/quality_gates' }
     ];
     const customItems = [];
     if (window.SS.isUserAdmin) {
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/comparison_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/comparison_controller.rb
deleted file mode 100644 (file)
index c63e119..0000000
+++ /dev/null
@@ -1,104 +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 ComparisonController < ApplicationController
-
-  SECTION=Navigation::SECTION_HOME
-
-  def index
-    snapshots = []
-    resource_key = params[:resource]
-    if resource_key && !resource_key.blank?
-      # the request comes from a project: let's select its 5 latest versions
-      project = Project.by_key(resource_key)
-      return render_not_found('Project not found') unless project
-
-      snapshots = project.events.select { |event| event.snapshot && event.category==EventCategory::KEY_VERSION }[0..5].reverse.map {|e| e.snapshot}
-      # if last snapshot is not in the list, add it at the end (=> might be the case for views or developers which do not have events)
-      last_snapshot = project.last_analysis
-      unless snapshots.last == last_snapshot
-        snapshots.shift
-        snapshots.push(last_snapshot)
-      end
-    else
-      # the request comes from the comparison page: let's compare the given snapshots
-      suuids = get_params_as_array(:suuids)
-      unless suuids.empty?
-        selected_snapshots = Snapshot.all(:conditions => ['uuid in (?)', suuids])
-        # next loop is required to keep the order that was decided by the user and which comes from the "suuids" parameter
-        suuids.each do |uuid|
-          selected_snapshots.each do |s|
-            snapshots << s if uuid==s.uuid.to_s
-          end
-        end
-      end
-    end
-    @snapshots = select_authorized(:user, snapshots).map { |snapshot| ComponentSnapshot.new(snapshot, snapshot.resource) }
-
-    metrics = get_params_as_array(:metrics)
-    if metrics.empty?
-      metrics = [
-        'ncloc',
-        'complexity',
-        'comment_lines_density',
-        'duplicated_lines_density',
-        'violations',
-        'coverage'
-      ]
-    end
-    @metrics = Metric.by_keys(metrics)
-
-    @metric_to_choose = Metric.all.select {|m| m.display? && !m.on_new_code? && !@metrics.include?(m)}.sort_by(&:short_name)
-  end
-
-  def versions
-    id = params[:id]
-    suuids = get_params_as_array(:suuids)
-
-    unless id.blank?
-      project = Project.by_key(id)
-
-      # we look for the events that are versions and that are not linked to snapshots already displayed on the page
-      @versions = project.events.select { |event| event.category==EventCategory::KEY_VERSION && !suuids.include?(event.analysis_uuid.to_s) }
-
-      # check if the latest snapshot if suggested or not (and if not, suggest it as "LATEST" => this is used for views or developers which do not have events)
-      latest_snapshot_uuid = project.last_analysis.uuid
-      current_and_suggested_suuids = suuids + @versions.map {|e| e.analysis_uuid.to_s}
-      unless current_and_suggested_suuids.include?(latest_snapshot_uuid.to_s)
-        @versions.unshift Event.new(:name => Api::Utils.message('comparison.version.latest'), :analysis_uuid => latest_snapshot_uuid)
-      end
-    end
-
-    render :partial => 'versions'
-  end
-
-
-  private
-
-  def get_params_as_array(name)
-    list = params[name]
-    if list.blank?
-      []
-    else
-      list.split(',')
-    end
-  end
-
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/_versions.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/_versions.html.erb
deleted file mode 100644 (file)
index 7a5d7c8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<% if @versions %>
-
-  <option value=""></option>
-  <% @versions.each do |version| %>
-    <option value="<%= version.analysis_uuid -%>"><%= h version.name -%></option>
-  <% end %>
-  
-<% end %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb
deleted file mode 100644 (file)
index d2d8e28..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-<% content_for :style do %>
-  <style>
-    #comparison-page td {
-      vertical-align: middle;
-    }
-
-    #comparison-page .move-actions a {
-      visibility: hidden;
-    }
-
-    #comparison-page .move-actions:hover a {
-      visibility: visible;
-    }
-  </style>
-<% end %>
-<% content_for :script do %>
-  <script>
-    function submitForm() {
-      $j('#compare-form').submit();
-    }
-
-    function moveLeft(index) {
-      suuids = $j('#suuids').val().split(',');
-      idToLeft = suuids[index];
-      idToRight = suuids[index - 1];
-      suuids.splice(index - 1, 2, [idToLeft, idToRight]);
-      $j('#suuids').val(suuids.join(','));
-      submitForm();
-    }
-
-    function moveRight(index) {
-      suuids = $j('#suuids').val().split(',');
-      idToRight = suuids[index];
-      idToLeft = suuids[index + 1];
-      suuids.splice(index, 2, [idToLeft, idToRight]);
-      $j('#suuids').val(suuids.join(','));
-      submitForm();
-    }
-
-    function moveUp(index) {
-      metrics = $j('#metrics').val().split(',');
-      idToUp = metrics[index];
-      idToBottom = metrics[index - 1];
-      metrics.splice(index - 1, 2, [idToUp, idToBottom]);
-      $j('#metrics').val(metrics.join(','));
-      submitForm();
-    }
-
-    function moveDown(index) {
-      metrics = $j('#metrics').val().split(',');
-      idToBottom = metrics[index];
-      idToUp = metrics[index + 1];
-      metrics.splice(index, 2, [idToUp, idToBottom]);
-      $j('#metrics').val(metrics.join(','));
-      submitForm();
-    }
-
-    function removeFromList(index, inputField) {
-      value = inputField.val().split(',');
-      value.splice(index, 1);
-      inputField.val(value.join(','));
-      submitForm();
-    }
-  </script>
-<% end %>
-
-
-  <div id="comparison-page" class="page">
-    <header class="page-header">
-      <h1 class="page-title"><%= h message('comparison.page') -%></h1>
-    </header>
-    <form method="GET" id="compare-form" action="<%= ApplicationController.root_context -%>/comparison/index">
-      <input type="hidden" name="suuids" id="suuids" value="<%= @snapshots.map { |s| s.uuid.to_s }.join(',') -%>">
-      <input type="hidden" name="metrics" id="metrics" value="<%= @metrics.map { |m| m.key }.join(',') -%>">
-
-         <div style="margin-bottom: 4px">
-          <div id="metric_div" style="display: inline-block">
-            <%= metric_select_tag 'new_metric', @metric_to_choose, {
-              :allow_empty => true,
-              :select2_options => {'placeholder' => "'" + message('comparison.add_metric') + "'"}
-            } -%>
-            <script>
-              // we don't want this parameter to be submitted, so we set its name to ''
-              $j('#new_metric').attr('name', '');
-              $j('#new_metric').change(function (event) {
-                var metric = event.target.value;
-                if (metric != null) {
-                  var currentMetrics = $j('#metrics').val();
-                  if (currentMetrics.length > 0) {
-                    currentMetrics += ',';
-                  }
-                  currentMetrics += metric;
-                  $j('#metrics').val(currentMetrics);
-                  $j('#compare-form').submit();
-                }
-              });
-            </script>
-          </div>
-
-          <div id="resource_div" style="display: inline-block; margin-left: 30px">
-            <%= resource_select_tag 'new_resource', {
-              :resource_type_property => 'comparable',
-              :width => '250px',
-              :select2_options => {'placeholder' => "'" + message('comparison.add_project') + "'"}
-            } -%>
-            <script>
-              // we don't want this parameter to be submitted, so we set its name to ''
-              $j('#new_resource').attr('name', '');
-              $j('#new_resource').change(function (event) {
-                var id = event.target.value;
-                if (id != null) {
-                  $j('#version_loading').show();
-                  $j.ajax({
-                    type:'GET',
-                    url:'<%= ApplicationController.root_context -%>/comparison/versions?id='
-                      + id + '&suuids='
-                      + $j('#suuids').val(),
-                    success:function (data) {
-                      $j('#new_version').html(data);
-                      $j('#new_version').select2({
-                        width: '250px',
-                        placeholder:'<%= message('comparison.select_version') -%>'
-                      });
-                      $j('#version_loading').hide();
-                      $j('#version_div').show();
-                      $j('#version_div').css("display", "inline-block");
-                      $j('#new_version').select2("focus");
-                    }
-                  });
-                }
-              });
-              $j('#new_resource').select2("focus");
-            </script>
-          </div>
-
-          <span id="version_loading" class="loading" style="display: none"></span>
-
-          <div id="version_div" style="display: none">
-            <select id="new_version">
-            </select>
-            <script>
-              $j('#new_version').change(function (event) {
-                var uuid = event.target.value;
-                if (uuid != null) {
-                  var currentSnapshotUuids = $j('#suuids').val();
-                  if (currentSnapshotUuids.length > 0) {
-                    currentSnapshotUuids += ',';
-                  }
-                  currentSnapshotUuids += uuid;
-                  $j('#suuids').val(currentSnapshotUuids);
-                  $j('#compare-form').submit();
-                }
-              });
-            </script>
-          </div>
-
-         </div>
-
-      <table class="data">
-        <thead>
-
-          <tr id="edit-columns-header">
-            <th></th>
-            <%
-               last_index = @snapshots.size-1
-               @snapshots.each_with_index do |s, index|
-            %>
-            <th class="thin move-actions" style="padding: 5px !important;">
-              <table>
-                <tr>
-                  <td style="vertical-align: bottom;">
-                    <% if index > 0 %>
-                      <a class="icon-move-left" href="#" onclick="moveLeft(<%= index -%>)" id="left-<%= index -%>"></a>
-                    <% else %>
-                      <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/>
-                    <% end %>
-                  </td>
-                  <td style="text-align: center; min-width: 100px">
-                    <div style="width: 100%; text-align: center;">
-                      <a class="icon-delete" href="#" onclick="removeFromList(<%= index -%>, $j('#suuids'))" id="del-r-<%= index -%>" title="<%= message('comparison.suppress_column') -%>"></a>
-                    </div>
-                  </td>
-                  <td style="vertical-align: bottom;">
-                    <% if index < last_index %>
-                      <a class="icon-move-right" href="#" onclick="moveRight(<%= index -%>)" id="right-<%= index -%>"></a>
-                    <% else %>
-                      <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/>
-                    <% end %>
-                  </td>
-                </tr>
-              </table>
-            </th>
-            <% end %>
-            <th></th>
-          </tr>
-          <tr id="resource-info-header">
-            <th></th>
-            <%
-               last_index = @snapshots.size-1
-               @snapshots.each_with_index do |s, index|
-                 event = s.event(EventCategory::KEY_VERSION)
-            %>
-              <th style="text-align: center; vertical-align: top; line-height: 1.5;">
-                <span class="no-transform">
-                  <a href="<%= ApplicationController.root_context -%>/dashboard/index/<%= s.component.key -%>"><%= h s.component.name(true) -%></a>
-                  <br/>
-                  <span class="note"><b><%= event ? h(event.name) : message('comparison.version.latest') -%></b></span>
-                  <br/>
-                  <span class="note"><%= human_short_date s.created_at -%></span>
-                </span>
-              </th>
-            <% end %>
-            <th></th>
-          </tr>
-        </thead>
-
-        <tbody>
-        <%
-           last_index = @metrics.size-1
-           @metrics.each_with_index do |m, index|
-        %>
-          <tr class="<%= cycle 'even', 'odd' -%> move-actions">
-            <td class="thin">
-              <table>
-                <tr>
-                  <td class="nowrap" style="vertical-align: bottom; width: 100%;"><%= m.short_name -%></td>
-                  <td class="nowrap" style="padding-left: 10px">
-                    <% if index > 0 %>
-                      <a class="icon-move-up" href="#" onclick="moveUp(<%= index -%>)" id="up-<%= index -%>"></a>
-                    <% end %>
-                    <% if index < last_index %>
-                      <a class="icon-move-down" href="#" onclick="moveDown(<%= index -%>)" id="down-<%= index -%>"></a>
-                    <% end %>
-                    <a class="icon-delete" href="#" onclick="removeFromList(<%= index -%>, $j('#metrics'))" id="del-m-<%= index -%>" title="<%= message('comparison.suppress_line') -%>"></a>
-                  </td>
-                </tr>
-              </table>
-            </td>
-
-            <% @snapshots.each do |s| %>
-              <td style="text-align: center">
-                <%= format_measure s.measure(m) -%>
-              </td>
-            <% end %>
-
-            <td></td>
-          </tr>
-        <% end %>
-        </tbody>
-      </table>
-    </form>
-  </div>
index cf79be08d303287310160f8aaefc057deaf757f7..d41ef6ed74fa18becb3deda04ec598b7570e179e 100644 (file)
@@ -548,11 +548,9 @@ issues_drilldown.page=Issues Drilldown
 source.page=Source
 timemachine.page=Time Machine
 comparison.page=Compare
-comparison_global.page=Compare Projects
 view_projects.page=Projects
 
 
-
 #------------------------------------------------------------------------------
 #
 # ASYNC PROCESS