aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-09-08 13:58:18 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-09-08 16:09:43 +0200
commit0e16e7b3c59a1feb9068d648169d50f4b6a323fb (patch)
treeb96b44cb2cd50b581e5985153fe3f39f9ab5ab76
parent90b5e2cece88aa9549998f19af872d6e1ab29fd6 (diff)
downloadsonarqube-0e16e7b3c59a1feb9068d648169d50f4b6a323fb.tar.gz
sonarqube-0e16e7b3c59a1feb9068d648169d50f4b6a323fb.zip
SONAR-8070 Drop of "Comparison" feature
-rw-r--r--it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java9
-rw-r--r--it/it-tests/src/test/resources/measureHistory/HistoryUiTest/comparison/should-compare-project-versions.html34
-rw-r--r--server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js13
-rw-r--r--server/sonar-web/src/main/js/main/nav/global/search-view.js3
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/controllers/comparison_controller.rb104
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/_versions.html.erb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb252
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties2
8 files changed, 4 insertions, 421 deletions
diff --git a/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java b/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java
index 5c6b44c2f1c..5496efd6ac9 100644
--- a/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java
+++ b/it/it-tests/src/test/java/it/measureHistory/HistoryUiTest.java
@@ -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
index 5bad1f996c6..00000000000
--- a/it/it-tests/src/test/resources/measureHistory/HistoryUiTest/comparison/should-compare-project-versions.html
+++ /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>
diff --git a/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js b/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js
index cf945ffb4b8..05aadf80412 100644
--- a/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js
+++ b/server/sonar-web/src/main/js/main/nav/global/global-nav-menu.js
@@ -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>
diff --git a/server/sonar-web/src/main/js/main/nav/global/search-view.js b/server/sonar-web/src/main/js/main/nav/global/search-view.js
index e88f381201c..e061eb90a9a 100644
--- a/server/sonar-web/src/main/js/main/nav/global/search-view.js
+++ b/server/sonar-web/src/main/js/main/nav/global/search-view.js
@@ -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
index c63e11970c1..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/comparison_controller.rb
+++ /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
index 7a5d7c80be5..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/_versions.html.erb
+++ /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
index d2d8e286db1..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb
+++ /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>
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index cf79be08d30..d41ef6ed74f 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -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