diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-10-02 10:18:07 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-10-02 10:18:07 +0200 |
commit | 64cc6661ccc94f2db15d598e313d0d0b4b9ddba9 (patch) | |
tree | 5c33dc174a0d6258640b1af937775cca18e3f3ea /server/sonar-web/src/main/webapp | |
parent | 3aa4e0789f603f3c579a5f0184fa024afd3792fa (diff) | |
download | sonarqube-64cc6661ccc94f2db15d598e313d0d0b4b9ddba9.tar.gz sonarqube-64cc6661ccc94f2db15d598e313d0d0b4b9ddba9.zip |
SONAR-6556 clean up bulk deletion and provisioning stuff
Diffstat (limited to 'server/sonar-web/src/main/webapp')
7 files changed, 0 insertions, 404 deletions
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb deleted file mode 100644 index 5eb44dd88e2..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb +++ /dev/null @@ -1,124 +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 BulkDeletionController < ApplicationController - - SECTION=Navigation::SECTION_CONFIGURATION - - before_filter :admin_required - - def index - if pending_mass_deletion? - render :template => 'bulk_deletion/pending_deletions' - return - end - - init_tab - params['pageSize'] = 20 - params['qualifiers'] = @selected_tab - @query_result = Internal.component_api.find(params) - end - - def ghosts - if pending_mass_deletion? - render :template => 'bulk_deletion/pending_deletions' - return - end - - @tabs = deletable_qualifiers - - params['pageSize'] = -1 - params['qualifiers'] = @tabs - @query_result = Internal.component_api.findGhostsProjects(params) - - @ghosts = @query_result.components - - @ghosts_by_qualifier = {} - @ghosts.each do |p| - qualifier = p.qualifier - if @ghosts_by_qualifier[qualifier] - @ghosts_by_qualifier[qualifier] << p - else - @ghosts_by_qualifier[qualifier] = [p] - end - end - end - - def delete_resources - verify_post_request - - if params[:select_all] && params[:select_all] == 'true' - init_tab - # Load all matching components to delete when select_all params is present - params['pageSize'] = -1 - params['qualifiers'] = @selected_tab - query_result = Internal.component_api.find(params) - resource_to_delete = query_result.components.map {|component| component.id} - else - resource_to_delete = params[:resources] || [] - # Used by the ghost deletion - resource_to_delete = params[:all_resources].split(',') if params[:all_resources] && !params[:all_resources].blank? - end - - # Ask the resource deletion manager to start the migration - # => this is an asynchronous AJAX call - ResourceDeletionManager.instance.delete_resources(resource_to_delete) - - redirect_to :action => :pending_deletions - end - - def pending_deletions - deletion_manager = ResourceDeletionManager.instance - - if deletion_manager.currently_deleting_resources? || - (!deletion_manager.currently_deleting_resources? && deletion_manager.deletion_failures_occured?) - # display the same page again and again - # => implicit render "pending_deletions.html.erb" - else - redirect_to :action => 'index', :qualifiers => params[:qualifiers] - end - end - - def dismiss_message - # It is important to reinit the ResourceDeletionManager so that the deletion screens can be available again - ResourceDeletionManager.instance.reinit - - redirect_to :action => 'index', :qualifiers => params[:qualifiers] - end - - - private - - def init_tab - @tabs = deletable_qualifiers - @selected_tab = params[:qualifiers] - @selected_tab = 'TRK' unless @tabs.include?(@selected_tab) - end - - # Tells if a mass deletion is happening or if it has finished with errors - def pending_mass_deletion? - deletion_manager = ResourceDeletionManager.instance - deletion_manager.currently_deleting_resources? || (!deletion_manager.currently_deleting_resources? && deletion_manager.deletion_failures_occured?) - end - - def deletable_qualifiers - Java::OrgSonarServerUi::JRubyFacade.getInstance().getQualifiersWithProperty('deletable') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/provisioning_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/provisioning_controller.rb deleted file mode 100644 index e0ea0fdaa1d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/provisioning_controller.rb +++ /dev/null @@ -1,30 +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 ProvisioningController < ApplicationController - - before_filter :admin_required - - SECTION=Navigation::SECTION_CONFIGURATION - - def index - access_denied unless has_role?("provisioning") - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/_pending_deletions_screen.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/_pending_deletions_screen.html.erb deleted file mode 100644 index ab311285ab1..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/_pending_deletions_screen.html.erb +++ /dev/null @@ -1,39 +0,0 @@ -<% - deletion_manager = ResourceDeletionManager.instance - pending_deletions = deletion_manager.currently_deleting_resources? - failed_deletions = deletion_manager.failed_deletions - start_time = deletion_manager.deletion_start_time -%> - -<% if pending_deletions %> - <meta http-equiv='refresh' content='5;'> -<% end %> - -<h1 class="marginbottom10"><%= message('bulk_deletion.page') -%></h1> - -<div class="<%= pending_deletions ? 'admin' : 'error' -%>" style="padding:10px"> - <% if pending_deletions %> - <%= image_tag 'loading.gif' -%> - <% end %> - - <b><%= deletion_manager.message -%></b> - <br/> - <br/> - <%= message('bulk_deletion.started_since_x', :params => distance_of_time_in_words(start_time, Time.now) ) -%> (<%= l start_time -%>) - <br/> - <br/> - - <% if !pending_deletions && !failed_deletions.empty? %> - <p> - <%= message('bulk_deletion.following_deletions_failed') -%> - <ul style="list-style: none outside; padding-left: 30px;"> - <% failed_deletions.each do |name| %> - <li style="list-style: disc outside; padding: 2px;"><%= name -%></li> - <% end %> - </ul> - </p> - <p> - <a href="<%= url_after_dismiss -%>"><%= message('bulk_deletion.hide_message') -%></a> - </p> - <% end %> -</div>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/ghosts.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/ghosts.html.erb deleted file mode 100644 index 095f736e675..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/ghosts.html.erb +++ /dev/null @@ -1,70 +0,0 @@ -<div class="page"> - <header class="page-header"> - <h1 class="page-title"><%= message('bulk_deletion.page') -%></h1> - <p class="page-description"><%= message('bulk_deletion.page.description') -%></p> - </header> - - <ul class="tabs"> - <% @tabs.each do |tab| %> - <li> - <a href="<%= url_for :action => 'index', :qualifiers => tab %>" id="tab-<%= u tab -%>"><%= message('qualifiers.' + tab) -%></a> - </li> - <% end %> - <li> - <a href="<%= url_for :action => 'ghosts' %>" id="tab-ghosts" class="selected"><%= message('bulk_deletion.ghosts') -%></a> - </li> - </ul> - - <div class="tabs-panel marginbottom10"> - - <p style="margin: 0 0 15px 0"> - <%= message('bulk_deletion.ghosts.description') -%> - </p> - - <% unless @ghosts.size > 0 %> - - <b><%= message('bulk_deletion.no_ghosts') -%></b> - - <% else %> - - <p style="margin: 0 0 10px 0"> - <%= message('bulk_deletion.following_ghosts_can_be_deleted') -%> - </p> - - <table> - <% - @tabs.each do |qualifier| - ghosts = @ghosts_by_qualifier[qualifier] - if ghosts - %> - <tr> - <td class="thin nowrap text-top" style="padding-right: 20px"> - <b><%= message('qualifiers.' + qualifier) -%> :</b> - </td> - <td> - <ul> - <% - ghosts.sort { |x, y| x.name <=> y.name }.each do |resource| - %> - <li><%= h resource.name -%> <span class="small gray">( <%= h resource.key -%> )</span></li> - <% - end - %> - </ul> - <% - end - end - %> - </table> - - <p style="margin: 15px 0"> - <form action="<%= ApplicationController.root_context -%>/bulk_deletion/delete_resources" method="POST"> - <input type="hidden" id="all_resources" name="all_resources" value="<%= @ghosts.map { |r| r.id.to_s }.join(',') -%>"/> - <input id="delete_resources" class="action red-button" type="submit" value="<%= message('bulk_deletion.delete_all_ghosts') -%>" name="commit"> - </form> - </p> - - <% end %> - - </div> -</div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb deleted file mode 100644 index a105ab7609d..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/index.html.erb +++ /dev/null @@ -1,132 +0,0 @@ -<div class="page"> - <header class="page-header"> - <h1 class="page-title"><%= message('bulk_deletion.page') -%></h1> - <p class="page-description"><%= message('bulk_deletion.page.description') -%></p> - </header> - - <ul class="tabs"> - <% @tabs.each do |tab| %> - <li> - <a href="<%= url_for :action => 'index', :qualifiers => tab %>" <%= "class='selected'" if @selected_tab==tab -%> id="tab-<%= u tab -%>"><%= message('qualifiers.' + tab) -%></a> - </li> - <% end %> - <li> - <a href="<%= url_for :action => 'ghosts' %>" id="tab-ghosts"><%= message('bulk_deletion.ghosts') -%></a> - </li> - </ul> - - <div class="tabs-panel marginbottom10"> - - <% - found_resources_count = @query_result.paging.total - found_resources_ids = @query_result.components.map {|r| r.id.to_s}.join(',') - %> - - <% form_tag( {:action => 'index'}, :method => :get ) do %> - <%= message('bulk_deletion.resource_name_filter_by_name') -%> <input type="text" id="resource_filter" name="names" size="40px" value="<%= h params[:names] -%>"/> - <input type="hidden" name="qualifiers" value="<%= @selected_tab -%>"/> - <%= submit_tag message('bulk_deletion.filter'), :id => 'filter_resources' %> - <% end %> - - <% if @query_result.components.empty? %> - <br/> - <%= message('no_results') -%> - <% else %> - - <form action="<%= ApplicationController.root_context -%>/bulk_deletion/delete_resources" method="POST"> - <input type="hidden" name="qualifiers" value="<%= @selected_tab -%>"/> - <input type="hidden" name="names" value="<%= params[:names] -%>"/> - <input type="hidden" name="select_all" value="false" id="select_all"/> - <table class="data" id="resources-to-delete"> - <thead> - <tr> - <th><input id="r-all" type="checkbox" onclick="selectOrDeselect()"></th> - <th> - <span>« <%= message('bulk_deletion.select_all') -%></span> - <% if found_resources_count - @query_result.components.size > 0 %> - <a id="select_all_action" style="padding-left: 10px; font-weight: normal; display: none" - href="#" onclick="handleSelectAllAction(); return false;"><%= message('bulk_deletion.select_all_x_resources', :params => found_resources_count) -%></a> - <% end %> - </th> - <th></th> - </tr> - </thead> - <tbody> - <% @query_result.components.each_with_index do |resource, index| %> - <tr class="<%= cycle 'even', 'odd' -%>"> - <td class="thin"> - <input id="r-<%= index -%>" type="checkbox" value="<%= resource.id -%>" name="resources[]"> - </td> - <td> - <%= h resource.name -%> - </td> - <td> - <span class="small gray"><%= h resource.key -%></span></td> - </td> - </tr> - <% end %> - <tr> - <td colspan="3"> - <input id="delete_resources" class="action red-button" type="submit" value="<%= message('delete') -%>" onclick="return checkBeforeDeleting();" name="commit"> - </td> - </tr> - </tbody> - <%= paginate_java(@query_result.paging, :colspan => 3, :id => 'projects-bulk-deletion-foot', :include_loading_icon => true) { |label, page_id| - link_to(label, params.merge({:pageIndex => page_id})) - } - %> - </table> - </form> - - <script> - function checkBeforeDeleting() { - var resource_selected = false; - $j("#resources-to-delete input[type='checkbox']").each(function(index,input) { - if (input.checked) resource_selected = true; - }); - if (!resource_selected) { - alert("<%= message('bulk_deletion.please_select_at_least_one_resource') -%>"); - return false; - } - return confirm("<%= message('bulk_deletion.sure_to_delete_the_resources') -%>"); - } - - function selectOrDeselect() { - var status = $j('#r-all').prop('checked'); - $j('tbody input').each(function(index,input) { - input.checked = status; - }); - <% if found_resources_count - @query_result.components.size > 0 %> - selectNotAllResources(); - if (status) { - $j('#select_all_action').show(); - } else { - $j('#select_all_action').hide(); - } - <% end %> - } - - function handleSelectAllAction() { - if ($j('#select_all').val()=='false') { - selectAllResources(); - } else { - $j('#r-all').checked = false; - selectOrDeselect(); - } - } - - function selectAllResources() { - $j('#select_all').val('true'); - $j('#select_all_action').html('<%= message('bulk_deletion.clear_selection', :params => found_resources_count) -%>'); - } - - function selectNotAllResources() { - $j('#select_all').val('false'); - $j('#select_all_action').html('<%= message('bulk_deletion.select_all_x_resources', :params => found_resources_count) -%>'); - } - </script> - - <% end %> - - </div> -</div> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/pending_deletions.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/pending_deletions.html.erb deleted file mode 100644 index 505c243e48a..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/bulk_deletion/pending_deletions.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<%= render :partial => 'pending_deletions_screen', - :locals => {:url_after_dismiss => url_for(:action => 'dismiss_message')} -%>
\ No newline at end of file diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb deleted file mode 100644 index 1dba1c73ebe..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/provisioning/index.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% content_for :extra_script do %> - <script> - require(['apps/provisioning/app'], function (App) { - App.start({ el: '#content' }); - }); - </script> -<% end %> |