'build-app:permission-templates'
'build-app:projects'
'build-app:project-permissions'
- 'build-app:provisioning'
'build-app:quality-gates'
'build-app:quality-profiles'
'build-app:source-viewer'
'<%= BUILD_PATH %>/js/apps/groups/templates.js': [
'<%= SOURCE_PATH %>/js/apps/groups/templates/**/*.hbs'
]
- '<%= BUILD_PATH %>/js/apps/provisioning/templates.js': [
- '<%= SOURCE_PATH %>/js/apps/provisioning/templates/**/*.hbs'
- ]
'<%= BUILD_PATH %>/js/apps/computation/templates.js': [
'<%= SOURCE_PATH %>/js/apps/computation/templates/**/*.hbs'
]
{window.t('sidebar.projects')} <i className="icon-dropdown"></i>
</a>
<ul className="dropdown-menu">
- {this.renderNewLink('/projects', 'Management')}
- {this.renderNewLink('/background_tasks', 'Background Tasks')}
+ {this.renderLink('/projects', 'Management')}
+ {this.renderLink('/background_tasks', 'Background Tasks')}
<li className="divider"/>
- {this.state.showProvisioning ? this.renderLink('/provisioning', window.t('provisioning.page')) : null}
- {this.renderLink('/bulk_deletion', window.t('bulk_deletion.page'))}
{this.renderLink('/computation', window.t('analysis_reports.page'))}
-
</ul>
</li>
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import Layout from './layout';
-import Projects from './projects';
-import HeaderView from './header-view';
-import SearchView from './search-view';
-import ListView from './list-view';
-import ListFooterView from './list-footer-view';
-
-var App = new Marionette.Application(),
- init = function (options) {
- // Layout
- this.layout = new Layout({ el: options.el });
- this.layout.render();
-
- // Collection
- this.projects = new Projects();
-
- // Header View
- this.headerView = new HeaderView({ collection: this.projects });
- this.layout.headerRegion.show(this.headerView);
-
- // Search View
- this.searchView = new SearchView({ collection: this.projects });
- this.layout.searchRegion.show(this.searchView);
-
- // List View
- this.listView = new ListView({ collection: this.projects });
- this.layout.listRegion.show(this.listView);
-
- // List Footer View
- this.listFooterView = new ListFooterView({ collection: this.projects });
- this.layout.listFooterRegion.show(this.listFooterView);
-
- // Go!
- this.projects.fetch();
- };
-
-App.on('start', function (options) {
- window.requestMessages().done(function () {
- init.call(App, options);
- });
-});
-
-export default App;
-
-
+++ /dev/null
-import _ from 'underscore';
-import ModalForm from 'components/common/modal-form';
-import './templates';
-
-export default ModalForm.extend({
- template: Templates['provisioning-bulk-delete'],
-
- onFormSubmit: function (e) {
- this._super(e);
- this.sendRequest();
- },
-
- sendRequest: function () {
- var that = this,
- selected = _.pluck(this.collection.where({ selected: true }), 'id');
- return this.collection.bulkDelete(selected, {
- statusCode: {
- // do not show global error
- 400: null
- }
- }).done(function () {
- that.collection.refresh();
- that.destroy();
- }).fail(function (jqXHR) {
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- });
- }
-});
-
-
+++ /dev/null
-import Project from './project';
-import FormView from './form-view';
-
-export default FormView.extend({
-
- sendRequest: function () {
- var that = this,
- project = new Project({
- name: this.$('#create-project-name').val(),
- branch: this.$('#create-project-branch').val(),
- key: this.$('#create-project-key').val()
- });
- this.disableForm();
- return project.save(null, {
- statusCode: {
- // do not show global error
- 400: null
- }
- }).done(function () {
- that.collection.refresh();
- that.destroy();
- }).fail(function (jqXHR) {
- that.enableForm();
- that.showErrors([{ msg: jqXHR.responseJSON.err_msg }]);
- });
- }
-});
-
-
+++ /dev/null
-import ModalForm from 'components/common/modal-form';
-import './templates';
-
-export default ModalForm.extend({
- template: Templates['provisioning-delete'],
-
- onFormSubmit: function (e) {
- this._super(e);
- this.sendRequest();
- },
-
- sendRequest: function () {
- var that = this,
- collection = this.model.collection;
- return this.model.destroy({
- wait: true,
- statusCode: {
- // do not show global error
- 400: null
- }
- }).done(function () {
- collection.refresh();
- that.destroy();
- }).fail(function (jqXHR) {
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- });
- }
-});
-
-
+++ /dev/null
-import ModalForm from 'components/common/modal-form';
-import './templates';
-
-export default ModalForm.extend({
- template: Templates['provisioning-form'],
-
- onRender: function () {
- this._super();
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
- },
-
- onDestroy: function () {
- this._super();
- this.$('[data-toggle="tooltip"]').tooltip('destroy');
- },
-
- onFormSubmit: function (e) {
- this._super(e);
- this.sendRequest();
- }
-
-});
-
-
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import CreateView from './create-view';
-import BulkDeleteView from './bulk-delete-view';
-import './templates';
-
-export default Marionette.ItemView.extend({
- template: Templates['provisioning-header'],
-
- collectionEvents: {
- 'change:selected': 'toggleDeleteButton',
- 'reset': 'toggleDeleteButton'
- },
-
- events: {
- 'click #provisioning-create': 'onCreateClick',
- 'click #provisioning-bulk-delete': 'onBulkDeleteClick'
- },
-
- onCreateClick: function (e) {
- e.preventDefault();
- this.createProject();
- },
-
- onBulkDeleteClick: function (e) {
- e.preventDefault();
- this.bulkDelete();
- },
-
- createProject: function () {
- new CreateView({
- collection: this.collection
- }).render();
- },
-
- bulkDelete: function () {
- new BulkDeleteView({
- collection: this.collection
- }).render();
- },
-
- toggleDeleteButton: function () {
- var selectedCount = this.collection.where({ selected: true }).length,
- someSelected = selectedCount > 0;
- this.$('#provisioning-bulk-delete').prop('disabled', !someSelected);
- }
-});
-
-
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import './templates';
-
-export default Marionette.LayoutView.extend({
- template: Templates['provisioning-layout'],
-
- regions: {
- headerRegion: '#provisioning-header',
- searchRegion: '#provisioning-search',
- listRegion: '#provisioning-list',
- listFooterRegion: '#provisioning-list-footer'
- }
-});
-
-
+++ /dev/null
-import _ from 'underscore';
-import Marionette from 'backbone.marionette';
-import './templates';
-
-export default Marionette.ItemView.extend({
- template: Templates['provisioning-list-footer'],
-
- collectionEvents: {
- 'all': 'render'
- },
-
- events: {
- 'click #provisioning-fetch-more': 'onMoreClick'
- },
-
- onMoreClick: function (e) {
- e.preventDefault();
- this.fetchMore();
- },
-
- fetchMore: function () {
- this.collection.fetchMore();
- },
-
- serializeData: function () {
- return _.extend(this._super(), {
- total: this.collection.total,
- count: this.collection.length,
- more: this.collection.hasMore()
- });
- }
-});
-
-
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import DeleteView from './delete-view';
-import './templates';
-
-export default Marionette.ItemView.extend({
- tagName: 'li',
- className: 'panel panel-vertical',
- template: Templates['provisioning-list-item'],
-
- modelEvents: {
- 'change:selected': 'onSelectedChange'
- },
-
- events: {
- 'click .js-toggle': 'onToggleClick',
- 'click .js-project-delete': 'onDeleteClick'
- },
-
- onRender: function () {
- this.$el.attr('data-id', this.model.id);
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
- },
-
- onDestroy: function () {
- this.$('[data-toggle="tooltip"]').tooltip('destroy');
- },
-
- onToggleClick: function (e) {
- e.preventDefault();
- this.toggle();
- },
-
- onDeleteClick: function (e) {
- e.preventDefault();
- this.deleteProject();
- },
-
- onSelectedChange: function () {
- this.$('.js-toggle').toggleClass('icon-checkbox-checked', this.model.get('selected'));
- },
-
- toggle: function () {
- this.model.toggle();
- },
-
- deleteProject: function () {
- new DeleteView({ model: this.model }).render();
- }
-});
-
-
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import ListItemView from './list-item-view';
-import './templates';
-
-export default Marionette.CollectionView.extend({
- tagName: 'ul',
- childView: ListItemView
-});
-
-
+++ /dev/null
-import _ from 'underscore';
-import Backbone from 'backbone';
-
-export default Backbone.Model.extend({
- idAttribute: 'uuid',
-
- defaults: {
- selected: false
- },
-
- urlRoot: function () {
- return baseUrl + '/api/projects';
- },
-
- sync: function (method, model, options) {
- var opts = options || {};
- if (method === 'create') {
- _.defaults(opts, {
- url: this.urlRoot() + '/create',
- type: 'POST',
- data: _.pick(model.toJSON(), 'key', 'name', 'branch')
- });
- }
- if (method === 'delete') {
- _.defaults(opts, {
- url: this.urlRoot() + '/bulk_delete',
- type: 'POST',
- data: { ids: this.id }
- });
- }
- return Backbone.ajax(opts);
- },
-
- toggle: function () {
- this.set({ selected: !this.get('selected') });
- }
-});
-
-
+++ /dev/null
-import _ from 'underscore';
-import Backbone from 'backbone';
-import Project from './project';
-
-export default Backbone.Collection.extend({
- model: Project,
-
- url: function () {
- return baseUrl + '/api/projects/provisioned';
- },
-
- parse: function (r) {
- this.total = r.total;
- this.p = r.p;
- this.ps = r.ps;
- return r.projects;
- },
-
- fetch: function (options) {
- var d = (options && options.data) || {};
- this.q = d.q;
- return this._super(options);
- },
-
- fetchMore: function () {
- var p = this.p + 1;
- return this.fetch({ add: true, remove: false, data: { p: p, ps: this.ps, q: this.q } });
- },
-
- refresh: function () {
- return this.fetch({ reset: true, data: { q: this.q } });
- },
-
- hasMore: function () {
- return this.total > this.p * this.ps;
- },
-
- bulkDelete: function (ids, options) {
- var opts = _.extend({}, options, {
- type: 'POST',
- url: baseUrl + '/api/projects/bulk_delete',
- data: { ids: ids.join() }
- });
- return Backbone.ajax(opts);
- }
-
-});
-
-
+++ /dev/null
-import _ from 'underscore';
-import Marionette from 'backbone.marionette';
-import './templates';
-
-export default Marionette.ItemView.extend({
- template: Templates['provisioning-search'],
-
- collectionEvents: {
- 'change:selected': 'onSelectedChange',
- 'reset': 'onSelectedChange'
- },
-
- events: {
- 'click .js-toggle-selection': 'onToggleSelectionClick',
- 'submit #provisioning-search-form': 'onFormSubmit',
- 'search #provisioning-search-query': 'debouncedOnKeyUp',
- 'keyup #provisioning-search-query': 'debouncedOnKeyUp'
- },
-
- initialize: function () {
- this._bufferedValue = null;
- this.debouncedOnKeyUp = _.debounce(this.onKeyUp, 400);
- },
-
- onRender: function () {
- this.delegateEvents();
- },
-
- onFormSubmit: function (e) {
- e.preventDefault();
- this.debouncedOnKeyUp();
- },
-
- onKeyUp: function () {
- var q = this.getQuery();
- if (q === this._bufferedValue) {
- return;
- }
- this._bufferedValue = this.getQuery();
- if (this.searchRequest != null) {
- this.searchRequest.abort();
- }
- this.searchRequest = this.search(q);
- },
-
- onSelectedChange: function () {
- var projectsCount = this.collection.length,
- selectedCount = this.collection.where({ selected: true }).length,
- allSelected = projectsCount > 0 && projectsCount === selectedCount,
- someSelected = !allSelected && selectedCount > 0;
- this.$('.js-toggle-selection')
- .toggleClass('icon-checkbox-checked', allSelected || someSelected)
- .toggleClass('icon-checkbox-single', someSelected);
- },
-
- onToggleSelectionClick: function (e) {
- e.preventDefault();
- this.toggleSelection();
- },
-
- toggleSelection: function () {
- var selectedCount = this.collection.where({ selected: true }).length,
- someSelected = selectedCount > 0;
- return someSelected ? this.selectNone() : this.selectAll();
- },
-
- selectNone: function () {
- this.collection.where({ selected: true }).forEach(function (project) {
- project.set({ selected: false });
- });
- },
-
- selectAll: function () {
- this.collection.forEach(function (project) {
- project.set({ selected: true });
- });
- },
-
- getQuery: function () {
- return this.$('#provisioning-search-query').val();
- },
-
- search: function (q) {
- this.selectNone();
- return this.collection.fetch({ reset: true, data: { q: q } });
- },
-
- serializeData: function () {
- var projectsCount = this.collection.length,
- selectedCount = this.collection.where({ selected: true }).length,
- allSelected = projectsCount > 0 && projectsCount === selectedCount,
- someSelected = !allSelected && selectedCount > 0;
- return _.extend(this._super(), {
- selectedCount: selectedCount,
- allSelected: allSelected,
- someSelected: someSelected
- });
- }
-});
-
-
+++ /dev/null
-<form id="bulk-delete-projects-form">
- <div class="modal-head">
- <h2>Delete Projects</h2>
- </div>
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- Are you sure you want to delete selected projects?
- </div>
- <div class="modal-foot">
- <button id="bulk-delete-projects-submit" class="button-red">Delete</button>
- <a href="#" class="js-modal-close" id="bulk-delete-projects-cancel">Cancel</a>
- </div>
-</form>
+++ /dev/null
-<form id="delete-project-form">
- <div class="modal-head">
- <h2>Delete Project</h2>
- </div>
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- Are you sure you want to delete project "{{name}}"?
- </div>
- <div class="modal-foot">
- <button id="delete-project-submit" class="button-red">Delete</button>
- <a href="#" class="js-modal-close" id="delete-project-cancel">Cancel</a>
- </div>
-</form>
+++ /dev/null
-<form id="create-project-form" autocomplete="off">
- <div class="modal-head">
- <h2>Create Project</h2>
- </div>
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- <div class="modal-field">
- <label for="create-project-name">Name<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-project-name-fake" name="name-fake" type="text" class="hidden">
- <input id="create-project-name" name="name" type="text" size="50" maxlength="200" required>
- </div>
- <div class="modal-field">
- <label for="create-project-branch">Branch</label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-project-branch-fake" name="branch-fake" type="text" class="hidden">
- <input id="create-project-branch" name="branch" type="text" size="50" maxlength="200">
- </div>
- <div class="modal-field">
- <label for="create-project-key">Key<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-project-key-fake" name="key-fake" type="text" class="hidden">
- <input id="create-project-key" name="key" type="text" size="50" maxlength="50" required>
- </div>
- </div>
- <div class="modal-foot">
- <button id="create-project-submit">Create</button>
- <a href="#" class="js-modal-close" id="create-project-cancel">Cancel</a>
- </div>
-</form>
+++ /dev/null
-<header class="page-header">
- <h1 class="page-title">{{t 'provisioning.page'}}</h1>
- <div class="page-actions">
- <div class="button-group">
- <button id="provisioning-create">Create Project</button>
- <button class="button-red" id="provisioning-bulk-delete" disabled>Delete Projects</button>
- </div>
- </div>
- <p class="page-description">{{t 'provisioning.page.description'}}</p>
-</header>
+++ /dev/null
-<div class="page">
- <div id="provisioning-header"></div>
- <div id="provisioning-search"></div>
- <div id="provisioning-list"></div>
- <div id="provisioning-list-footer"></div>
-</div>
+++ /dev/null
-<footer class="spacer-top note text-center">
- {{count}}/{{total}} shown
- {{#if more}}
- <a id="provisioning-fetch-more" class="spacer-left" href="#">show more</a>
- {{/if}}
-</footer>
+++ /dev/null
-<div class="pull-right big-spacer-left nowrap">
- <a class="js-project-delete icon-delete" title="Delete" data-toggle="tooltip" href="#"></a>
-</div>
-
-<div class="pull-left big-spacer-right">
- <a class="js-toggle icon-checkbox {{#if selected}}icon-checkbox-checked{{/if}}" href="#"></a>
-</div>
-
-<div class="display-inline-block text-top width-30">
- <a class="js-project-name" href="{{dashboardUrl key}}">{{name}}</a>
- <span class="js-project-key note little-spacer-left">{{key}}</span>
-</div>
-
-<div class="display-inline-block text-top width-30">
- Created at {{dt creationDate}}
-</div>
+++ /dev/null
-<div class="panel panel-vertical bordered-bottom spacer-bottom">
- <span class="big-spacer-right text-middle">
- <a class="js-toggle-selection icon-checkbox {{#if allSelected}}icon-checkbox-checked{{/if}} {{#if someSelected}}icon-checkbox-checked icon-checkbox-single{{/if}}" href="#"></a>
- </span>
-
- <form id="provisioning-search-form" class="search-box display-inline-block text-middle">
- <button id="provisioning-search-submit" class="search-box-submit button-clean"><i class="icon-search"></i></button>
- <input id="provisioning-search-query" class="search-box-input" type="search" name="q" placeholder="Search" maxlength="100">
- </form>
-</div>
+++ /dev/null
-#
-# 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
+++ /dev/null
-#
-# 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
+++ /dev/null
-<%
- 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
+++ /dev/null
-<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>
+++ /dev/null
-<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>
+++ /dev/null
-<%= render :partial => 'pending_deletions_screen',
- :locals => {:url_after_dismiss => url_for(:action => 'dismiss_message')} -%>
\ No newline at end of file
+++ /dev/null
-<% content_for :extra_script do %>
- <script>
- require(['apps/provisioning/app'], function (App) {
- App.start({ el: '#content' });
- });
- </script>
-<% end %>