aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-09 14:25:16 +0100
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-11-24 17:22:33 +0100
commitafff558a2cac07019ff5886ccdada9eb25aa1b0c (patch)
tree1d8fe9182888137dcc42ef873cd3aa47d4f253c3 /server/sonar-web/src/main
parent1fccf4779bbf4d1c125fd65ed3972b57b3c1be6e (diff)
downloadsonarqube-afff558a2cac07019ff5886ccdada9eb25aa1b0c.tar.gz
sonarqube-afff558a2cac07019ff5886ccdada9eb25aa1b0c.zip
Remove old users page
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/users/change-password-view.js62
-rw-r--r--server/sonar-web/src/main/js/apps/users/components/UsersAppContainerOld.js54
-rw-r--r--server/sonar-web/src/main/js/apps/users/create-view.js51
-rw-r--r--server/sonar-web/src/main/js/apps/users/deactivate-view.js50
-rw-r--r--server/sonar-web/src/main/js/apps/users/form-view.js84
-rw-r--r--server/sonar-web/src/main/js/apps/users/groups-view.js61
-rw-r--r--server/sonar-web/src/main/js/apps/users/header-view.js54
-rw-r--r--server/sonar-web/src/main/js/apps/users/init.js65
-rw-r--r--server/sonar-web/src/main/js/apps/users/layout.js32
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-footer-view.js51
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-item-view.js151
-rw-r--r--server/sonar-web/src/main/js/apps/users/list-view.js56
-rw-r--r--server/sonar-web/src/main/js/apps/users/routes.ts8
-rw-r--r--server/sonar-web/src/main/js/apps/users/search-view.js92
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-change-password.hbs32
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-deactivate.hbs13
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-form.hbs73
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-groups.hbs10
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-header.hbs8
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-layout.hbs6
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-list-footer.hbs6
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs85
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-list.hbs15
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-search.hbs18
-rw-r--r--server/sonar-web/src/main/js/apps/users/templates/users-tokens.hbs87
-rw-r--r--server/sonar-web/src/main/js/apps/users/tokens-view.js116
-rw-r--r--server/sonar-web/src/main/js/apps/users/update-view.js47
-rw-r--r--server/sonar-web/src/main/js/apps/users/user.js91
-rw-r--r--server/sonar-web/src/main/js/apps/users/users.js55
29 files changed, 1 insertions, 1532 deletions
diff --git a/server/sonar-web/src/main/js/apps/users/change-password-view.js b/server/sonar-web/src/main/js/apps/users/change-password-view.js
deleted file mode 100644
index 56fb22cc77e..00000000000
--- a/server/sonar-web/src/main/js/apps/users/change-password-view.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import ModalForm from '../../components/common/modal-form';
-import Template from './templates/users-change-password.hbs';
-
-export default ModalForm.extend({
- template: Template,
-
- onFormSubmit() {
- ModalForm.prototype.onFormSubmit.apply(this, arguments);
- this.sendRequest();
- },
-
- sendRequest() {
- const that = this;
- const oldPassword = this.$('#change-user-password-old-password').val();
- const password = this.$('#change-user-password-password').val();
- const confirmation = this.$('#change-user-password-password-confirmation').val();
- if (password !== confirmation) {
- that.showErrors([{ msg: 'New password and its confirmation do not match' }]);
- return;
- }
- this.disableForm();
- this.model
- .changePassword(oldPassword, password, {
- statusCode: {
- // do not show global error
- 400: null
- }
- })
- .done(() => {
- that.destroy();
- })
- .fail(jqXHR => {
- that.enableForm();
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- });
- },
-
- serializeData() {
- return Object.assign({}, ModalForm.prototype.serializeData.apply(this, arguments), {
- isOwnPassword: this.options.currentUser.login === this.model.id
- });
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/components/UsersAppContainerOld.js b/server/sonar-web/src/main/js/apps/users/components/UsersAppContainerOld.js
deleted file mode 100644
index 3e6bbd28b32..00000000000
--- a/server/sonar-web/src/main/js/apps/users/components/UsersAppContainerOld.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import React from 'react';
-import PropTypes from 'prop-types';
-import Helmet from 'react-helmet';
-import { connect } from 'react-redux';
-import init from '../init';
-import { getCurrentUser } from '../../../store/rootReducer';
-import { translate } from '../../../helpers/l10n';
-// import styles to have the `.button-icon` styles
-import '../../../components/ui/buttons.css';
-import '../../../components/controls/SearchBox.css';
-
-class UsersAppContainer extends React.PureComponent {
- static propTypes = {
- currentUser: PropTypes.object.isRequired
- };
-
- componentDidMount() {
- init(this.refs.container, this.props.currentUser);
- }
-
- render() {
- return (
- <div>
- <Helmet title={translate('users.page')} />
- <div ref="container" />
- </div>
- );
- }
-}
-
-const mapStateToProps = state => ({
- currentUser: getCurrentUser(state)
-});
-
-export default connect(mapStateToProps)(UsersAppContainer);
diff --git a/server/sonar-web/src/main/js/apps/users/create-view.js b/server/sonar-web/src/main/js/apps/users/create-view.js
deleted file mode 100644
index a55b63d3280..00000000000
--- a/server/sonar-web/src/main/js/apps/users/create-view.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import User from './user';
-import FormView from './form-view';
-
-export default FormView.extend({
- sendRequest() {
- const that = this;
- const user = new User({
- login: this.$('#create-user-login').val(),
- name: this.$('#create-user-name').val(),
- email: this.$('#create-user-email').val(),
- password: this.$('#create-user-password').val(),
- scmAccounts: this.getScmAccounts()
- });
- this.disableForm();
- return user
- .save(null, {
- statusCode: {
- // do not show global error
- 400: null,
- 500: null
- }
- })
- .done(() => {
- that.collection.refresh();
- that.destroy();
- })
- .fail(jqXHR => {
- that.enableForm();
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- });
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/deactivate-view.js b/server/sonar-web/src/main/js/apps/users/deactivate-view.js
deleted file mode 100644
index d0d5938d1d4..00000000000
--- a/server/sonar-web/src/main/js/apps/users/deactivate-view.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import ModalForm from '../../components/common/modal-form';
-import Template from './templates/users-deactivate.hbs';
-
-export default ModalForm.extend({
- template: Template,
-
- onFormSubmit() {
- ModalForm.prototype.onFormSubmit.apply(this, arguments);
- this.sendRequest();
- },
-
- sendRequest() {
- const that = this;
- const collection = this.model.collection;
- return this.model
- .destroy({
- wait: true,
- statusCode: {
- // do not show global error
- 400: null
- }
- })
- .done(() => {
- collection.total--;
- that.destroy();
- })
- .fail(jqXHR => {
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- });
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/form-view.js b/server/sonar-web/src/main/js/apps/users/form-view.js
deleted file mode 100644
index ddde043085b..00000000000
--- a/server/sonar-web/src/main/js/apps/users/form-view.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import $ from 'jquery';
-import ModalForm from '../../components/common/modal-form';
-import Template from './templates/users-form.hbs';
-
-export default ModalForm.extend({
- template: Template,
-
- events() {
- return {
- ...ModalForm.prototype.events.apply(this, arguments),
- 'click #create-user-add-scm-account': 'onAddScmAccountClick',
- 'click .js-remove-scm': 'onRemoveScmAccountClick'
- };
- },
-
- onRender() {
- ModalForm.prototype.onRender.apply(this, arguments);
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
- },
-
- onDestroy() {
- ModalForm.prototype.onDestroy.apply(this, arguments);
- this.$('[data-toggle="tooltip"]').tooltip('destroy');
- },
-
- onFormSubmit() {
- ModalForm.prototype.onFormSubmit.apply(this, arguments);
- this.sendRequest();
- },
-
- onAddScmAccountClick(e) {
- e.preventDefault();
- this.addScmAccount();
- },
-
- getScmAccounts() {
- const scmAccounts = this.$('[name="scmAccounts"]')
- .map(function() {
- return $(this).val();
- })
- .toArray()
- .filter(value => !!value);
- // return empty string to reset the field when updating
- return scmAccounts.length ? scmAccounts : '';
- },
-
- addScmAccount() {
- const fields = this.$('.js-scm-input');
- const newField = fields
- .first()
- .clone()
- .removeClass('hidden');
- newField.insertAfter(fields.last());
- newField
- .find('input')
- .val('')
- .focus();
- },
-
- onRemoveScmAccountClick(e) {
- $(e.currentTarget)
- .parent()
- .remove();
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/groups-view.js b/server/sonar-web/src/main/js/apps/users/groups-view.js
deleted file mode 100644
index be257dd3863..00000000000
--- a/server/sonar-web/src/main/js/apps/users/groups-view.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import escapeHtml from 'escape-html';
-import Modal from '../../components/common/modals';
-import SelectList from '../../components/SelectList';
-import Template from './templates/users-groups.hbs';
-
-export default Modal.extend({
- template: Template,
-
- onRender() {
- Modal.prototype.onRender.apply(this, arguments);
- new SelectList({
- el: this.$('#users-groups'),
- width: '100%',
- readOnly: false,
- focusSearch: false,
- dangerouslyUnescapedHtmlFormat(item) {
- return (
- `${escapeHtml(item.name)}<br>` +
- `<span class="note">${escapeHtml(item.description)}</span>`
- );
- },
- queryParam: 'q',
- searchUrl: window.baseUrl + '/api/users/groups?ps=100&login=' + this.model.id,
- selectUrl: window.baseUrl + '/api/user_groups/add_user',
- deselectUrl: window.baseUrl + '/api/user_groups/remove_user',
- extra: {
- login: this.model.id
- },
- selectParameter: 'id',
- selectParameterValue: 'id',
- parse(r) {
- this.more = false;
- return r.groups;
- }
- });
- },
-
- onDestroy() {
- this.model.collection.refresh();
- Modal.prototype.onDestroy.apply(this, arguments);
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/header-view.js b/server/sonar-web/src/main/js/apps/users/header-view.js
deleted file mode 100644
index ae8c6bba45b..00000000000
--- a/server/sonar-web/src/main/js/apps/users/header-view.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Marionette from 'backbone.marionette';
-import CreateView from './create-view';
-import Template from './templates/users-header.hbs';
-
-export default Marionette.ItemView.extend({
- template: Template,
-
- collectionEvents: {
- request: 'showSpinner',
- sync: 'hideSpinner'
- },
-
- events: {
- 'click #users-create': 'onCreateClick'
- },
-
- showSpinner() {
- this.$('.spinner').removeClass('hidden');
- },
-
- hideSpinner() {
- this.$('.spinner').addClass('hidden');
- },
-
- onCreateClick(e) {
- e.preventDefault();
- this.createUser();
- },
-
- createUser() {
- new CreateView({
- collection: this.collection
- }).render();
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/init.js b/server/sonar-web/src/main/js/apps/users/init.js
deleted file mode 100644
index b1c038b9386..00000000000
--- a/server/sonar-web/src/main/js/apps/users/init.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Marionette from 'backbone.marionette';
-import Layout from './layout';
-import Users from './users';
-import HeaderView from './header-view';
-import SearchView from './search-view';
-import ListView from './list-view';
-import ListFooterView from './list-footer-view';
-import { getIdentityProviders } from '../../api/users';
-
-const App = new Marionette.Application();
-
-const init = function({ el, currentUser }, providers) {
- // Layout
- this.layout = new Layout({ el });
- this.layout.render();
-
- // Collection
- this.users = new Users();
-
- // Header View
- this.headerView = new HeaderView({ collection: this.users });
- this.layout.headerRegion.show(this.headerView);
-
- // Search View
- this.searchView = new SearchView({ collection: this.users });
- this.layout.searchRegion.show(this.searchView);
-
- // List View
- this.listView = new ListView({ collection: this.users, currentUser, providers });
- this.layout.listRegion.show(this.listView);
-
- // List Footer View
- this.listFooterView = new ListFooterView({ collection: this.users });
- this.layout.listFooterRegion.show(this.listFooterView);
-
- // Go!
- this.users.fetch();
-};
-
-App.on('start', options => {
- getIdentityProviders().then(r => init.call(App, options, r.identityProviders));
-});
-
-export default function(el, currentUser) {
- App.start({ el, currentUser });
-}
diff --git a/server/sonar-web/src/main/js/apps/users/layout.js b/server/sonar-web/src/main/js/apps/users/layout.js
deleted file mode 100644
index 1a94dc8ebd1..00000000000
--- a/server/sonar-web/src/main/js/apps/users/layout.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Marionette from 'backbone.marionette';
-import Template from './templates/users-layout.hbs';
-
-export default Marionette.LayoutView.extend({
- template: Template,
-
- regions: {
- headerRegion: '#users-header',
- searchRegion: '#users-search',
- listRegion: '#users-list',
- listFooterRegion: '#users-list-footer'
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/list-footer-view.js b/server/sonar-web/src/main/js/apps/users/list-footer-view.js
deleted file mode 100644
index 84e1e311c4e..00000000000
--- a/server/sonar-web/src/main/js/apps/users/list-footer-view.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Marionette from 'backbone.marionette';
-import Template from './templates/users-list-footer.hbs';
-
-export default Marionette.ItemView.extend({
- template: Template,
-
- collectionEvents: {
- all: 'render'
- },
-
- events: {
- 'click #users-fetch-more': 'onMoreClick'
- },
-
- onMoreClick(e) {
- e.preventDefault();
- this.fetchMore();
- },
-
- fetchMore() {
- this.collection.fetchMore();
- },
-
- serializeData() {
- return {
- ...Marionette.ItemView.prototype.serializeData.apply(this, arguments),
- total: this.collection.total,
- count: this.collection.length,
- more: this.collection.hasMore()
- };
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/list-item-view.js b/server/sonar-web/src/main/js/apps/users/list-item-view.js
deleted file mode 100644
index ba24798e79e..00000000000
--- a/server/sonar-web/src/main/js/apps/users/list-item-view.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Marionette from 'backbone.marionette';
-import UpdateView from './update-view';
-import ChangePasswordView from './change-password-view';
-import DeactivateView from './deactivate-view';
-import GroupsView from './groups-view';
-import TokensView from './tokens-view';
-import Template from './templates/users-list-item.hbs';
-import { areThereCustomOrganizations } from '../../store/organizations/utils';
-
-export default Marionette.ItemView.extend({
- tagName: 'tr',
- template: Template,
-
- events: {
- 'click .js-user-more-scm': 'onMoreScmClick',
- 'click .js-user-more-groups': 'onMoreGroupsClick',
- 'click .js-user-update': 'onUpdateClick',
- 'click .js-user-change-password': 'onChangePasswordClick',
- 'click .js-user-deactivate': 'onDeactivateClick',
- 'click .js-user-groups': 'onGroupsClick',
- 'click .js-user-tokens': 'onTokensClick'
- },
-
- initialize() {
- this.scmLimit = 3;
- this.groupsLimit = 3;
- },
-
- onRender() {
- this.$el.attr('data-login', this.model.id);
- this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
- },
-
- onDestroy() {
- this.$('[data-toggle="tooltip"]').tooltip('destroy');
- },
-
- onMoreScmClick(e) {
- e.preventDefault();
- this.showMoreScm();
- },
-
- onMoreGroupsClick(e) {
- e.preventDefault();
- this.showMoreGroups();
- },
-
- onUpdateClick(e) {
- e.preventDefault();
- this.updateUser();
- },
-
- onChangePasswordClick(e) {
- e.preventDefault();
- this.changePassword();
- },
-
- onDeactivateClick(e) {
- e.preventDefault();
- this.deactivateUser();
- },
-
- onGroupsClick(e) {
- e.preventDefault();
- this.showGroups();
- },
-
- onTokensClick(e) {
- e.preventDefault();
- this.showTokens();
- },
-
- showMoreScm() {
- this.scmLimit = 10000;
- this.render();
- },
-
- showMoreGroups() {
- this.groupsLimit = 10000;
- this.render();
- },
-
- updateUser() {
- new UpdateView({
- model: this.model,
- collection: this.model.collection
- }).render();
- },
-
- changePassword() {
- new ChangePasswordView({
- model: this.model,
- collection: this.model.collection,
- currentUser: this.options.currentUser
- }).render();
- },
-
- deactivateUser() {
- new DeactivateView({ model: this.model }).render();
- },
-
- showGroups() {
- new GroupsView({ model: this.model }).render();
- },
-
- showTokens() {
- new TokensView({ model: this.model }).render();
- },
-
- serializeData() {
- const scmAccounts = this.model.get('scmAccounts');
- const scmAccountsLimit = scmAccounts.length > this.scmLimit ? this.scmLimit - 1 : this.scmLimit;
-
- const groups = this.model.get('groups');
- const groupsLimit = groups.length > this.groupsLimit ? this.groupsLimit - 1 : this.groupsLimit;
-
- const externalProvider = this.model.get('externalProvider');
- const identityProvider = this.model.get('local')
- ? null
- : this.options.providers.find(provider => externalProvider === provider.key);
-
- return {
- ...Marionette.ItemView.prototype.serializeData.apply(this, arguments),
- identityProvider,
- firstScmAccounts: scmAccounts.slice(0, scmAccountsLimit),
- moreScmAccountsCount: scmAccounts.length - scmAccountsLimit,
- firstGroups: groups.slice(0, groupsLimit),
- moreGroupsCount: groups.length - groupsLimit,
- customOrganizations: areThereCustomOrganizations()
- };
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/list-view.js b/server/sonar-web/src/main/js/apps/users/list-view.js
deleted file mode 100644
index 19a4c043ee6..00000000000
--- a/server/sonar-web/src/main/js/apps/users/list-view.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Marionette from 'backbone.marionette';
-import ListItemView from './list-item-view';
-import Template from './templates/users-list.hbs';
-import { areThereCustomOrganizations } from '../../store/organizations/utils';
-
-export default Marionette.CompositeView.extend({
- template: Template,
- childView: ListItemView,
- childViewContainer: 'tbody',
-
- collectionEvents: {
- request: 'showLoading',
- sync: 'hideLoading'
- },
-
- childViewOptions() {
- return {
- providers: this.options.providers,
- currentUser: this.options.currentUser
- };
- },
-
- showLoading() {
- this.$el.addClass('new-loading');
- },
-
- hideLoading() {
- this.$el.removeClass('new-loading');
- },
-
- serializeData() {
- return {
- ...Marionette.CompositeView.prototype.serializeData.apply(this, arguments),
- customOrganizations: areThereCustomOrganizations()
- };
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/routes.ts b/server/sonar-web/src/main/js/apps/users/routes.ts
index a56f4adf1c1..7d6e28bb07d 100644
--- a/server/sonar-web/src/main/js/apps/users/routes.ts
+++ b/server/sonar-web/src/main/js/apps/users/routes.ts
@@ -17,19 +17,13 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { RouterState, IndexRouteProps, RouteComponent } from 'react-router';
+import { RouterState, IndexRouteProps } from 'react-router';
const routes = [
{
getIndexRoute(_: RouterState, callback: (err: any, route: IndexRouteProps) => any) {
import('./UsersAppContainer').then(i => callback(null, { component: i.default }));
}
- },
- {
- path: 'old',
- getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) {
- import('./components/UsersAppContainerOld').then(i => callback(null, i.default));
- }
}
];
diff --git a/server/sonar-web/src/main/js/apps/users/search-view.js b/server/sonar-web/src/main/js/apps/users/search-view.js
deleted file mode 100644
index f7afc9e81aa..00000000000
--- a/server/sonar-web/src/main/js/apps/users/search-view.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import { debounce } from 'lodash';
-import Marionette from 'backbone.marionette';
-import Template from './templates/users-search.hbs';
-
-export default Marionette.ItemView.extend({
- template: Template,
-
- ui: {
- hint: '.js-hint',
- reset: '.js-reset'
- },
-
- events: {
- 'submit #users-search-form': 'onFormSubmit',
- 'search #users-search-query': 'initialOnKeyUp',
- 'keyup #users-search-query': 'initialOnKeyUp',
- 'click .js-reset': 'onResetClick'
- },
-
- initialize() {
- this._bufferedValue = null;
- this.debouncedOnKeyUp = debounce(this.onKeyUp, 400);
- },
-
- onRender() {
- this.delegateEvents();
- },
-
- onFormSubmit(e) {
- e.preventDefault();
- this.debouncedOnKeyUp();
- },
-
- initialOnKeyUp() {
- const q = this.getQuery();
- this.ui.hint.toggleClass('hidden', q.length !== 1);
- this.ui.reset.toggleClass('hidden', q.length === 0);
- this.debouncedOnKeyUp();
- },
-
- onKeyUp() {
- const q = this.getQuery();
- if (q === this._bufferedValue) {
- return;
- }
- this._bufferedValue = this.getQuery();
- if (this.searchRequest != null) {
- this.searchRequest.abort();
- }
- this.ui.hint.toggleClass('hidden', q.length !== 1);
- this.ui.reset.toggleClass('hidden', q.length === 0);
- if (q.length !== 1) {
- this.searchRequest = this.search(q);
- }
- },
-
- getQuery() {
- return this.$('#users-search-query').val();
- },
-
- search(q) {
- return this.collection.fetch({ reset: true, data: { q } });
- },
-
- onResetClick(e) {
- e.preventDefault();
- e.currentTarget.blur();
- this.$('#users-search-query')
- .val('')
- .focus();
- this.onKeyUp();
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-change-password.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-change-password.hbs
deleted file mode 100644
index 020befdea88..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-change-password.hbs
+++ /dev/null
@@ -1,32 +0,0 @@
-<form id="change-user-password-form" autocomplete="off">
- <div class="modal-head">
- <h2>{{t 'my_profile.password.title'}}</h2>
- </div>
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- {{#if isOwnPassword}}
- <div class="modal-field">
- <label for="change-user-password-old-password">{{t 'my_profile.password.old'}}<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="change-user-password-old-password-fake" name="old-password-fake" type="password" class="hidden">
- <input id="change-user-password-old-password" name="old-password" type="password" size="50" maxlength="50" required>
- </div>
- {{/if}}
- <div class="modal-field">
- <label for="change-user-password-password">{{t 'my_profile.password.new'}}<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="change-user-password-password-fake" name="password-fake" type="password" class="hidden">
- <input id="change-user-password-password" name="password" type="password" size="50" maxlength="50" required>
- </div>
- <div class="modal-field">
- <label for="change-user-password-password-confirmation">{{t 'my_profile.password.confirm'}}<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="change-user-password-password-confirmation-fake" name="password-confirmation-fake" type="password" class="hidden">
- <input id="change-user-password-password-confirmation" name="password-confirmation" type="password" size="50" maxlength="50" required>
- </div>
- </div>
- <div class="modal-foot">
- <button id="change-user-password-submit">{{t 'change_verb'}}</button>
- <a href="#" class="js-modal-close" id="change-user-password-cancel">{{t 'cancel'}}</a>
- </div>
-</form>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-deactivate.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-deactivate.hbs
deleted file mode 100644
index 5ecce84bcdd..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-deactivate.hbs
+++ /dev/null
@@ -1,13 +0,0 @@
-<form id="deactivate-user-form" autocomplete="off">
- <div class="modal-head">
- <h2>{{t 'users.deactivate_user'}}</h2>
- </div>
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- {{tp 'users.deactivate_user.confirmation' name login}}
- </div>
- <div class="modal-foot">
- <button class="button-red" id="deactivate-user-submit">{{t 'users.deactivate'}}</button>
- <a href="#" class="js-modal-close" id="deactivate-user-cancel">{{t 'cancel'}}</a>
- </div>
-</form>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs
deleted file mode 100644
index 35a49fba342..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-form.hbs
+++ /dev/null
@@ -1,73 +0,0 @@
-<form id="create-user-form" autocomplete="off">
- <div class="modal-head">
- <h2>{{#if login}}{{t 'users.update_user'}}{{else}}{{t 'users.create_user'}}{{/if}}</h2>
- </div>
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- {{#unless login}}
- <div class="modal-field">
- <label for="create-user-login">{{t 'login'}}<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-user-login-fake" name="login-fake" type="text" class="hidden">
- <input id="create-user-login" name="login" type="text" size="50" minlength="3" maxlength="255" required
- value="{{login}}">
- <p class="note">{{tp 'users.minimum_x_characters' 3}}</p>
- </div>
- {{/unless}}
- <div class="modal-field">
- <label for="create-user-name">{{t 'name'}}<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-user-name-fake" name="name-fake" type="text" class="hidden">
- <input id="create-user-name" name="name" type="text" size="50" maxlength="200" required value="{{name}}">
- </div>
- <div class="modal-field">
- <label for="create-user-email">{{t 'users.email'}}</label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-user-email-fake" name="email-fake" type="email" class="hidden">
- <input id="create-user-email" name="email" type="email" size="50" maxlength="100" value="{{email}}">
- </div>
- {{#unless login}}
- <div class="modal-field">
- <label for="create-user-password">{{t 'password'}}<em class="mandatory">*</em></label>
- {{! keep this fake field to hack browser autofill }}
- <input id="create-user-password-fake" name="password-fake" type="password" class="hidden">
- <input id="create-user-password" name="password" type="password" size="50" maxlength="50" required>
- </div>
- {{/unless}}
- <div class="modal-field">
- <label>{{t 'my_profile.scm_accounts'}}</label>
- <span class="js-scm-input hidden">
- <input name="scmAccounts" type="text" size="50" maxlength="255">
- <button class="js-remove-scm button-icon text-top" href="#">
- <svg width="16" height="16" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
- <g transform="matrix(0.0392029,0,0,0.0392029,0.878798,-1.19111)">
- <path d="M334.7,138.6L277.5,81.4L181.6,177.3L85.8,81.4L28.6,138.6L124.4,234.4L28.6,330.3L85.8,387.5L181.6,291.6L277.5,387.5L334.7,330.3L238.8,234.4L334.7,138.6Z" style="fill: #d4333f"/>
- </g>
- </svg>
- </button>
- </span>
- {{#each scmAccounts}}
- <span class="js-scm-input">
- <input name="scmAccounts" type="text" size="50" maxlength="255" value="{{this}}">
- <button class="js-remove-scm button-icon text-top" href="#">
- <svg width="16" height="16" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
- <g transform="matrix(0.0392029,0,0,0.0392029,0.878798,-1.19111)">
- <path d="M334.7,138.6L277.5,81.4L181.6,177.3L85.8,81.4L28.6,138.6L124.4,234.4L28.6,330.3L85.8,387.5L181.6,291.6L277.5,387.5L334.7,330.3L238.8,234.4L334.7,138.6Z" style="fill: #d4333f"/>
- </g>
- </svg>
- </button>
- </span>
- {{/each}}
- <div class="spacer-bottom">
- <a id="create-user-add-scm-account" class="button" href="#">
- {{t 'add_verb'}}
- </a>
- </div>
- <p class="note">{{t 'user.login_or_email_used_as_scm_account'}}</p>
- </div>
- </div>
- <div class="modal-foot">
- <button id="create-user-submit">{{#if login}}{{t 'update_verb'}}{{else}}{{t 'create'}}{{/if}}</button>
- <a href="#" class="js-modal-close" id="create-user-cancel">{{t 'cancel'}}</a>
- </div>
-</form>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-groups.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-groups.hbs
deleted file mode 100644
index d98651e8c11..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-groups.hbs
+++ /dev/null
@@ -1,10 +0,0 @@
-<div class="modal-head">
- <h2>{{t 'users.update_groups'}}</h2>
-</div>
-<div class="modal-body">
- <div class="js-modal-messages"></div>
- <div id="users-groups"></div>
-</div>
-<div class="modal-foot">
- <a href="#" class="js-modal-close" id="users-groups-done">{{t 'Done'}}</a>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-header.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-header.hbs
deleted file mode 100644
index a979104cc68..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-header.hbs
+++ /dev/null
@@ -1,8 +0,0 @@
-<header class="page-header">
- <h1 class="page-title">{{t 'users.page'}}</h1>
- <i class="spinner hidden"></i>
- <div class="page-actions">
- <button id="users-create">{{t 'users.create_user'}}</button>
- </div>
- <p class="page-description">{{t 'users.page.description'}}</p>
-</header>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-layout.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-layout.hbs
deleted file mode 100644
index 27b81d17974..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-layout.hbs
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="page page-limited">
- <div id="users-header"></div>
- <div id="users-search"></div>
- <div id="users-list"></div>
- <div id="users-list-footer"></div>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-list-footer.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-list-footer.hbs
deleted file mode 100644
index 28115fb9c91..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-list-footer.hbs
+++ /dev/null
@@ -1,6 +0,0 @@
-<footer class="spacer-top note text-center">
- {{tp 'x_of_y_shown' count total}}
- {{#if more}}
- <a id="users-fetch-more" class="spacer-left" href="#">{{t 'show_more'}}</a>
- {{/if}}
-</footer>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs
deleted file mode 100644
index 5ac0db657c7..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-list-item.hbs
+++ /dev/null
@@ -1,85 +0,0 @@
-<td class="thin nowrap">
- <div>{{avatarHelper avatar name 36}}</div>
-</td>
-
-<td>
- <div>
- <strong class="js-user-name">{{name}}</strong>
- <span class="js-user-login note little-spacer-left">{{login}}</span>
- </div>
-
- {{#if email}}
- <div class="js-user-email little-spacer-top">{{email}}</div>
- {{/if}}
-
- {{#unless local}}
- {{#notEq externalProvider 'sonarqube'}}
- <div class="js-user-identity-provider little-spacer-top">
- {{#if identityProvider}}
- <div class="identity-provider" style="background-color: {{identityProvider.backgroundColor}}">
- <img src="{{link identityProvider.iconPath}}" width="14" height="14"/>
- {{externalIdentity}}
- </div>
- {{else}}
- {{externalProvider}}: {{externalIdentity}}
- {{/if}}
- </div>
- {{/notEq}}
- {{/unless}}
-</td>
-
-<td>
- <ul>
- {{#each firstScmAccounts}}
- <li class="little-spacer-bottom">{{this}}</li>
- {{/each}}
- {{#gt moreScmAccountsCount 0}}
- <li class="little-spacer-bottom">
- <a class="js-user-more-scm" href="#">{{moreScmAccountsCount}} {{t 'more'}}</a>
- </li>
- {{/gt}}
- </ul>
-</td>
-
-{{#unless customOrganizations}}
- <td>
- <ul>
- {{#each firstGroups}}
- <li class="little-spacer-bottom">{{this}}</li>
- {{/each}}
- <li class="little-spacer-bottom">
- {{#gt moreGroupsCount 0}}
- <a class="js-user-more-groups spacer-right" href="#">{{moreGroupsCount}} {{t 'more'}}</a>
- {{/gt}}
- <a class="js-user-groups icon-bullet-list" title="{{t 'users.update_groups'}}" data-toggle="tooltip" href="#"></a>
- </li>
- </ul>
- </td>
-{{/unless}}
-
-<td>
- {{tokensCount}}
- <a class="js-user-tokens spacer-left icon-bullet-list" title="{{t 'users.update_tokens'}}" data-toggle="tooltip" href="#"></a>
-</td>
-
-<td class="thin nowrap text-right">
- <div class="dropdown">
- <button class="dropdown-toggle" data-toggle="dropdown">
- {{settingsIcon}}<i class="icon-dropdown little-spacer-left" />
- </button>
- <ul class="dropdown-menu dropdown-menu-right">
- <li>
- <a class="js-user-update" href="#">{{t 'update_details'}}</a>
- </li>
- {{#if local}}
- <li>
- <a class="js-user-change-password" href="#">{{t 'my_profile.password.title'}}</a>
- </li>
- {{/if}}
- <li class="divider" />
- <li>
- <a class="js-user-deactivate text-danger" href="#">{{t 'users.deactivate'}}</a>
- </li>
- </ul>
- </div>
-</td>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-list.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-list.hbs
deleted file mode 100644
index e0c90491015..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-list.hbs
+++ /dev/null
@@ -1,15 +0,0 @@
-<table class="data zebra">
- <thead>
- <tr>
- <th>&nbsp;</th>
- <th class="nowrap">&nbsp;</th>
- <th class="nowrap">{{t 'my_profile.scm_accounts'}}</th>
- {{#unless customOrganizations}}
- <th class="nowrap">{{t 'my_profile.groups'}}</th>
- {{/unless}}
- <th class="nowrap">{{t 'users.tokens'}}</th>
- <th class="nowrap">&nbsp;</th>
- </tr>
- </thead>
- <tbody></tbody>
-</table>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-search.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-search.hbs
deleted file mode 100644
index a95ed5eb718..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-search.hbs
+++ /dev/null
@@ -1,18 +0,0 @@
-<div class="panel panel-vertical bordered-bottom spacer-bottom">
- <form id="users-search-form" class="search-box">
- <input id="users-search-query" class="search-box-input" type="text" name="q" placeholder="{{t 'search.search_by_login_or_name'}}" maxlength="100">
- <svg class="search-box-magnifier" width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;">
- <g transform="matrix(0.0288462,0,0,0.0288462,2,1.07692)">
- <path d="M288,208C288,177.167 277.042,150.792 255.125,128.875C233.208,106.958 206.833,96 176,96C145.167,96 118.792,106.958 96.875,128.875C74.958,150.792 64,177.167 64,208C64,238.833 74.958,265.208 96.875,287.125C118.792,309.042 145.167,320 176,320C206.833,320 233.208,309.042 255.125,287.125C277.042,265.208 288,238.833 288,208ZM416,416C416,424.667 412.833,432.167 406.5,438.5C400.167,444.833 392.667,448 384,448C375,448 367.5,444.833 361.5,438.5L275.75,353C245.917,373.667 212.667,384 176,384C152.167,384 129.375,379.375 107.625,370.125C85.875,360.875 67.125,348.375 51.375,332.625C35.625,316.875 23.125,298.125 13.875,276.375C4.625,254.625 0,231.833 0,208C0,184.167 4.625,161.375 13.875,139.625C23.125,117.875 35.625,99.125 51.375,83.375C67.125,67.625 85.875,55.125 107.625,45.875C129.375,36.625 152.167,32 176,32C199.833,32 222.625,36.625 244.375,45.875C266.125,55.125 284.875,67.625 300.625,83.375C316.375,99.125 328.875,117.875 338.125,139.625C347.375,161.375 352,184.167 352,208C352,244.667 341.667,277.917 321,307.75L406.75,393.5C412.917,399.667 416,407.167 416,416Z" style="fill:currentColor;fill-rule:nonzero;"/>
- </g>
- </svg>
- <button class="js-reset hidden button-tiny search-box-clear button-icon" style="color: rgb(153, 153, 153);" type="reset">
- <svg width="12" height="12" viewBox="0 0 16 16" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
- <path d="M14 4.242L11.758 2l-3.76 3.76L4.242 2 2 4.242l3.756 3.756L2 11.758 4.242 14l3.756-3.76 3.76 3.76L14 11.758l-3.76-3.76L14 4.242z" style="fill: currentcolor;"/>
- </svg>
- </button>
- <span class="js-hint search-box-note hidden" title="{{tp 'select2.tooShort' 2}}">
- {{tp 'select2.tooShort' 2}}
- </span>
- </form>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/users/templates/users-tokens.hbs b/server/sonar-web/src/main/js/apps/users/templates/users-tokens.hbs
deleted file mode 100644
index 1080f88a5bd..00000000000
--- a/server/sonar-web/src/main/js/apps/users/templates/users-tokens.hbs
+++ /dev/null
@@ -1,87 +0,0 @@
-<div class="modal-head">
- <h2>{{t 'users.tokens'}}</h2>
-</div>
-
-<div class="modal-body">
- <div class="js-modal-messages"></div>
-
- {{#notNull tokens}}
- <table class="data zebra">
- <thead>
- <tr>
- <th>{{t 'name'}}</th>
- <th class="text-right">{{t 'created'}}</th>
- <th>&nbsp;</th>
- </tr>
- </thead>
- <tbody>
- {{#each tokens}}
- <tr>
- <td>
- <div title="{{name}}">
- {{limitString name}}
- </div>
- </td>
- <td class="thin nowrap text-right">
- {{d createdAt}}
- </td>
- <td class="thin nowrap text-right">
- <div class="big-spacer-left">
- <form class="js-revoke-token-form" data-token="{{name}}">
- {{#if deleting}}
- <button class="button-red active input-small">{{t 'users.tokens.sure'}}</button>
- {{else}}
- <button class="button-red input-small">{{t 'users.tokens.revoke'}}</button>
- {{/if}}
- </form>
- </div>
- </td>
- </tr>
- {{else}}
- <tr>
- <td colspan="3">
- <span class="note">{{t 'users.no_tokens'}}</span>
- </td>
- </tr>
- {{/each}}
- </tbody>
- </table>
- {{/notNull}}
-
- <hr class="big-spacer-top big-spacer-bottom">
-
- <h3 class="spacer-bottom">{{t 'users.generate_tokens'}}</h3>
-
- {{#each errors}}
- <div class="alert alert-danger">{{msg}}</div>
- {{/each}}
-
- <form class="js-generate-token-form">
- <input type="text" required maxlength="100" placeholder="{{t 'users.enter_token_name'}}">
- <button>{{t 'users.generate'}}</button>
- </form>
-
- {{#if newToken}}
- <div class="panel panel-white big-spacer-top">
- <div class="alert alert-warning">
- {{tp 'users.tokens.new_token_created' newToken.name}}
- </div>
-
- <table class="data">
- <tr>
-
- <td class="thin">
- <button class="js-copy-to-clipboard" data-clipboard-text="{{newToken.token}}">{{t 'copy'}}</button>
- </td>
- <td class="nowrap">
- <code class="text-success">{{newToken.token}}</code>
- </td>
- </tr>
- </table>
- </div>
- {{/if}}
-</div>
-
-<div class="modal-foot">
- <a href="#" class="js-modal-close">{{t 'Done'}}</a>
-</div>
diff --git a/server/sonar-web/src/main/js/apps/users/tokens-view.js b/server/sonar-web/src/main/js/apps/users/tokens-view.js
deleted file mode 100644
index 9cd7a95b5a8..00000000000
--- a/server/sonar-web/src/main/js/apps/users/tokens-view.js
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import $ from 'jquery';
-import Clipboard from 'clipboard';
-import Modal from '../../components/common/modals';
-import Template from './templates/users-tokens.hbs';
-import { getTokens, generateToken, revokeToken } from '../../api/user-tokens';
-import { translate } from '../../helpers/l10n';
-
-export default Modal.extend({
- template: Template,
-
- events() {
- return {
- ...Modal.prototype.events.apply(this, arguments),
- 'submit .js-generate-token-form': 'onGenerateTokenFormSubmit',
- 'submit .js-revoke-token-form': 'onRevokeTokenFormSubmit'
- };
- },
-
- initialize() {
- Modal.prototype.initialize.apply(this, arguments);
- this.tokens = null;
- this.newToken = null;
- this.errors = [];
- this.requestTokens();
- },
-
- requestTokens() {
- return getTokens(this.model.id).then(tokens => {
- this.tokens = tokens;
- this.render();
- });
- },
-
- onGenerateTokenFormSubmit(e) {
- e.preventDefault();
- this.errors = [];
- this.newToken = null;
- const tokenName = this.$('.js-generate-token-form input').val();
- generateToken({ name: tokenName, login: this.model.id }).then(
- response => {
- this.newToken = response;
- this.requestTokens();
- },
- () => {}
- );
- },
-
- onRevokeTokenFormSubmit(e) {
- e.preventDefault();
- const tokenName = $(e.currentTarget).data('token');
- const token = this.tokens.find(t => t.name === `${tokenName}`);
- if (token) {
- if (token.deleting) {
- revokeToken({ name: tokenName, login: this.model.id }).then(
- this.requestTokens.bind(this),
- () => {}
- );
- } else {
- token.deleting = true;
- this.render();
- }
- }
- },
-
- onRender() {
- Modal.prototype.onRender.apply(this, arguments);
- const copyButton = this.$('.js-copy-to-clipboard');
- if (copyButton.length) {
- const clipboard = new Clipboard(copyButton.get(0));
- clipboard.on('success', () => {
- copyButton
- .tooltip({
- title: translate('users.tokens.copied'),
- placement: 'bottom',
- trigger: 'manual'
- })
- .tooltip('show');
- setTimeout(() => copyButton.tooltip('hide'), 1000);
- });
- }
- this.newToken = null;
- },
-
- onDestroy() {
- this.model.collection.refresh();
- Modal.prototype.onDestroy.apply(this, arguments);
- },
-
- serializeData() {
- return {
- ...Modal.prototype.serializeData.apply(this, arguments),
- tokens: this.tokens,
- newToken: this.newToken,
- errors: this.errors
- };
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/update-view.js b/server/sonar-web/src/main/js/apps/users/update-view.js
deleted file mode 100644
index f37075c2226..00000000000
--- a/server/sonar-web/src/main/js/apps/users/update-view.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import FormView from './form-view';
-
-export default FormView.extend({
- sendRequest() {
- const that = this;
- this.model.set({
- name: this.$('#create-user-name').val(),
- email: this.$('#create-user-email').val(),
- scmAccounts: this.getScmAccounts()
- });
- this.disableForm();
- return this.model
- .save(null, {
- statusCode: {
- // do not show global error
- 400: null
- }
- })
- .done(() => {
- that.collection.refresh();
- that.destroy();
- })
- .fail(jqXHR => {
- that.enableForm();
- that.showErrors(jqXHR.responseJSON.errors, jqXHR.responseJSON.warnings);
- });
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/user.js b/server/sonar-web/src/main/js/apps/users/user.js
deleted file mode 100644
index a819925daa8..00000000000
--- a/server/sonar-web/src/main/js/apps/users/user.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import { defaults, pick } from 'lodash';
-import Backbone from 'backbone';
-
-export default Backbone.Model.extend({
- idAttribute: 'login',
-
- urlRoot() {
- return window.baseUrl + '/api/users';
- },
-
- defaults() {
- return {
- groups: [],
- scmAccounts: []
- };
- },
-
- toQuery() {
- const data = { ...this.toJSON(), scmAccount: this.get('scmAccounts') };
- delete data.scmAccounts;
- return data;
- },
-
- isNew() {
- // server never sends a password
- return this.has('password');
- },
-
- sync(method, model, options) {
- const opts = options || {};
- if (method === 'create') {
- defaults(opts, {
- url: this.urlRoot() + '/create',
- type: 'POST',
- data: pick(model.toQuery(), 'login', 'name', 'email', 'password', 'scmAccount'),
- traditional: true
- });
- }
- if (method === 'update') {
- defaults(opts, {
- url: this.urlRoot() + '/update',
- type: 'POST',
- data: pick(model.toQuery(), 'login', 'name', 'email', 'scmAccount'),
- traditional: true
- });
- }
- if (method === 'delete') {
- defaults(opts, {
- url: this.urlRoot() + '/deactivate',
- type: 'POST',
- data: { login: this.id }
- });
- }
- return Backbone.ajax(opts);
- },
-
- changePassword(oldPassword, password, options) {
- const data = {
- login: this.id,
- password
- };
- if (oldPassword != null) {
- data.previousPassword = oldPassword;
- }
- const opts = defaults(options || {}, {
- url: this.urlRoot() + '/change_password',
- type: 'POST',
- data
- });
- return Backbone.ajax(opts);
- }
-});
diff --git a/server/sonar-web/src/main/js/apps/users/users.js b/server/sonar-web/src/main/js/apps/users/users.js
deleted file mode 100644
index 228d19d73c5..00000000000
--- a/server/sonar-web/src/main/js/apps/users/users.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info 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.
- */
-import Backbone from 'backbone';
-import User from './user';
-
-export default Backbone.Collection.extend({
- model: User,
-
- url() {
- return window.baseUrl + '/api/users/search';
- },
-
- parse(r) {
- this.total = +r.paging.total;
- this.p = +r.paging.pageIndex;
- this.ps = +r.paging.pageSize;
- return r.users;
- },
-
- fetch(options) {
- const d = (options && options.data) || {};
- this.q = d.q;
- return Backbone.Collection.prototype.fetch.call(this, options);
- },
-
- fetchMore() {
- const p = this.p + 1;
- return this.fetch({ add: true, remove: false, data: { p, ps: this.ps, q: this.q } });
- },
-
- refresh() {
- return this.fetch({ reset: true, data: { q: this.q } });
- },
-
- hasMore() {
- return this.total > this.p * this.ps;
- }
-});