From: Stas Vilchik Date: Thu, 7 Jan 2016 14:58:24 +0000 (+0100) Subject: SONAR-7179 drop the Components page X-Git-Tag: 5.4-M4~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=db61853e7dbad7ee08a34e740a7a2dd1d8da58e0;p=sonarqube.git SONAR-7179 drop the Components page --- diff --git a/server/sonar-web/src/main/js/libs/sonar.js b/server/sonar-web/src/main/js/libs/sonar.js index a245d4142d4..fd1591dc355 100644 --- a/server/sonar-web/src/main/js/libs/sonar.js +++ b/server/sonar-web/src/main/js/libs/sonar.js @@ -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 index 134254ac5dd..00000000000 --- a/server/sonar-web/src/main/js/libs/sortable.js +++ /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); diff --git a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js index 9647ee60cda..c2ce247069a 100644 --- a/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js +++ b/server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js @@ -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 index 093e1aad8ef..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/components_controller.rb +++ /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 index 32b9ab2a4ae..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_edit_mode_controls.rhtml +++ /dev/null @@ -1,61 +0,0 @@ -<% if has_role?(:admin) && configuring? %> -
- - <% addeable_columns = components_configuration.addeable_columns %> - <% if addeable_columns.size > 0 %> - - - - - - - - <% end %> - - - - -
<%= image_tag 'warning.png' %> <%= message('components.note_changes_impact_all_users') -%>
<%= message('add_a_column') -%> -
"add" -%>" > - - - <%= image_tag 'loading.gif', :style => 'display: none;', :id => 'add_column_loading' %> - -
-
<%= message('default_sort_on') -%> -
"default_sorting" -%>"> - - - <%= image_tag 'loading.gif', :style => 'display: none;', :id => 'sort_column_loading' %> - -
-
-
-<% 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 index 35af60e16ce..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header.rhtml +++ /dev/null @@ -1,35 +0,0 @@ - -<% if @snapshot %> - - - - <%= message('name') -%> - <% configured_columns.each do |column| %> - <%= column.name %> - <% end %> - - - <% alert_status_measure=@snapshot.measure(Metric::ALERT_STATUS) - alert_status_x=(alert_status_measure ? alert_status_measure.data : '') - %> - <%= format_measure(alert_status_measure) %> - <% if logged_in? %><%= link_to_favourite(@snapshot.project) -%><% end %> - - <%= qualifier_icon(@snapshot) -%> - "><%= h @snapshot.project.name -%> - - <% @columns.each do |column| %> - <%= get_header_content(column, @snapshot) -%> - <% end %> - -   -<% end %> - - - - <%= message('name') -%> - <% configured_columns.each do |column| %> - <%= column.name %> - <% end %> - - 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 index 3e14b68f858..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/_list_table_header_edit_mode.rhtml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - <%= message('name') -%> - <% configured_columns.each do |column| %> - - <%= column.name %> - - <% end %> - - - - - - <% configured_columns.each do |column| %> - - <%= 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 %> - - <% end %> - - 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 index 56b880e0fb2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/components/index.html.erb +++ /dev/null @@ -1,76 +0,0 @@ -
- - - <% 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? %> -

<%= message('components.no_projects_have_been_analysed') -%>No projects have been analysed.

- -

<%= message('components.explanation_launch_sonar_to_have_results') -%>

- <% else %> - - - - -
- - <%= 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? %> - - <% if @snapshots.empty? %> - - - - <% else - @snapshots.each do |snapshot| %> - <% project = snapshot.project %> - - <% alert_status_measure=search_measure(@measures_by_snapshot[snapshot], Metric::ALERT_STATUS) - alert_status_x=(alert_status_measure ? alert_status_measure.data : '') - %> - - - - <% @columns.each do |column| %> - <%= get_column_content(column, snapshot, @measures_by_snapshot) -%> - <% end %> - - <% end %> - <% end %> - -
No components
<%= format_measure(alert_status_measure) %> - <% 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, '') %> - <% end %> - - <%= qualifier_icon(snapshot) %> - <% if snapshot.display_dashboard? %> - <%= link_to_resource(project, h(snapshot.project.name)) %> - <% else %> - <%= h snapshot.project.name %> - <% end %> -
- -

 

-
- <% end %> -