aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-10-13 14:58:52 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-10-16 09:36:55 +0200
commit7a42a7c80528cf1f8867d8df3f7d8c12f36a1704 (patch)
treebc1f96aa72f887335ab7caba4a0970d75df5f68f /server
parent252fbe63ae0edb86307e54c5c5fbfe83e47b965e (diff)
downloadsonarqube-7a42a7c80528cf1f8867d8df3f7d8c12f36a1704.tar.gz
sonarqube-7a42a7c80528cf1f8867d8df3f7d8c12f36a1704.zip
SONAR-9863 Drop web app licenses and server id code
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/api/licenses.ts36
-rw-r--r--server/sonar-web/src/main/js/api/settings.ts8
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js10
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.js.snap16
-rw-r--r--server/sonar-web/src/main/js/app/utils/startReactApp.js2
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js109
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js65
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicenseRowContainer.js29
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicenseStatus.js43
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicensesApp.js34
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js33
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js59
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/LicensesListContainer.js29
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseChangeForm-test.js27
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseRow-test.js125
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseStatus-test.js50
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesApp-test.js30
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesAppHeader-test.js28
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js51
-rw-r--r--server/sonar-web/src/main/js/apps/settings/licenses/licenseUtils.js26
-rw-r--r--server/sonar-web/src/main/js/apps/settings/routes.ts12
-rw-r--r--server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js161
-rw-r--r--server/sonar-web/src/main/js/apps/settings/serverId/ServerIdAppContainer.js24
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/licenses/actions.js70
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js36
-rw-r--r--server/sonar-web/src/main/js/apps/settings/store/rootReducer.js9
-rw-r--r--server/sonar-web/src/main/js/store/rootReducer.js6
27 files changed, 0 insertions, 1128 deletions
diff --git a/server/sonar-web/src/main/js/api/licenses.ts b/server/sonar-web/src/main/js/api/licenses.ts
deleted file mode 100644
index 8df37f10ed1..00000000000
--- a/server/sonar-web/src/main/js/api/licenses.ts
+++ /dev/null
@@ -1,36 +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 { getJSON, post } from '../helpers/request';
-
-export function getLicenses(): Promise<any> {
- return getJSON('/api/licenses/list').then(r => r.licenses);
-}
-
-export function setLicense(key: string, value: string): Promise<void> {
- const url = '/api/settings/set';
- const data = { key, value };
- return post(url, data);
-}
-
-export function resetLicense(key: string): Promise<void> {
- const url = '/api/settings/reset';
- const data = { keys: key };
- return post(url, data);
-}
diff --git a/server/sonar-web/src/main/js/api/settings.ts b/server/sonar-web/src/main/js/api/settings.ts
index dd257cea597..c388e4eb32a 100644
--- a/server/sonar-web/src/main/js/api/settings.ts
+++ b/server/sonar-web/src/main/js/api/settings.ts
@@ -93,11 +93,3 @@ export function generateSecretKey(): Promise<any> {
export function encryptValue(value: string): Promise<any> {
return postJSON('/api/settings/encrypt', { value });
}
-
-export function getServerId(): Promise<any> {
- return getJSON('/api/server_id/show');
-}
-
-export function generateServerId(organization: string, ip: string): Promise<any> {
- return postJSON('/api/server_id/generate', { organization, ip });
-}
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js
index 36a74fdef7a..6f2c84d6e6e 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/SettingsNav.js
@@ -100,21 +100,11 @@ class SettingsNav extends React.PureComponent {
</IndexLink>
</li>
<li>
- <IndexLink to="/admin/settings/licenses" activeClassName="active">
- {translate('property.category.licenses')}
- </IndexLink>
- </li>
- <li>
<IndexLink to="/admin/settings/encryption" activeClassName="active">
{translate('property.category.security.encryption')}
</IndexLink>
</li>
<li>
- <IndexLink to="/admin/settings/server_id" activeClassName="active">
- {translate('property.category.server_id')}
- </IndexLink>
- </li>
- <li>
<IndexLink to="/admin/custom_metrics" activeClassName="active">
{translate('custom_metrics.page')}
</IndexLink>
diff --git a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.js.snap b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.js.snap
index ca0145b11c8..d70451a6f1d 100644
--- a/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.js.snap
+++ b/server/sonar-web/src/main/js/app/components/nav/settings/__tests__/__snapshots__/SettingsNav-test.js.snap
@@ -42,14 +42,6 @@ exports[`should work with extensions 1`] = `
<li>
<IndexLink
activeClassName="active"
- to="/admin/settings/licenses"
- >
- property.category.licenses
- </IndexLink>
- </li>
- <li>
- <IndexLink
- activeClassName="active"
to="/admin/settings/encryption"
>
property.category.security.encryption
@@ -58,14 +50,6 @@ exports[`should work with extensions 1`] = `
<li>
<IndexLink
activeClassName="active"
- to="/admin/settings/server_id"
- >
- property.category.server_id
- </IndexLink>
- </li>
- <li>
- <IndexLink
- activeClassName="active"
to="/admin/custom_metrics"
>
custom_metrics.page
diff --git a/server/sonar-web/src/main/js/app/utils/startReactApp.js b/server/sonar-web/src/main/js/app/utils/startReactApp.js
index b6577565efd..06dc6283e04 100644
--- a/server/sonar-web/src/main/js/app/utils/startReactApp.js
+++ b/server/sonar-web/src/main/js/app/utils/startReactApp.js
@@ -135,8 +135,6 @@ const startReactApp = () => {
<Redirect from="/settings" to="/admin/settings" />
<Redirect from="/settings/encryption" to="/admin/settings/encryption" />
<Redirect from="/settings/index" to="/admin/settings" />
- <Redirect from="/settings/licenses" to="/admin/settings/licenses" />
- <Redirect from="/settings/server_id" to="/admin/settings/server_id" />
<Redirect from="/sessions/login" to="/sessions/new" />
<Redirect from="/system" to="/admin/system" />
<Redirect from="/system/index" to="/admin/system" />
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js
deleted file mode 100644
index afea2682e97..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseChangeForm.js
+++ /dev/null
@@ -1,109 +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 Modal from 'react-modal';
-import { translate, translateWithParameters } from '../../../helpers/l10n';
-
-export default class LicenseChangeForm extends React.PureComponent {
- static propTypes = {
- license: PropTypes.object.isRequired,
- onChange: PropTypes.func.isRequired
- };
-
- state = {
- loading: false,
- modalOpen: false
- };
-
- onClick(e) {
- e.preventDefault();
- e.target.blur();
- this.setState({ modalOpen: true });
- }
-
- closeModal = () => this.setState({ modalOpen: false });
-
- handleSubmit = event => {
- event.preventDefault();
- if (this.textarea) {
- const { value } = this.textarea;
- this.setState({ loading: true });
- this.props
- .onChange(value)
- .then(
- () => this.setState({ loading: false, modalOpen: false }),
- () => this.setState({ loading: false })
- );
- }
- };
-
- handleCancelClick = event => {
- event.preventDefault();
- this.closeModal();
- };
-
- render() {
- const { license } = this.props;
- const productName = license.name || license.key;
-
- return (
- <button className="js-change" onClick={e => this.onClick(e)}>
- {translate('update_verb')}
-
- {this.state.modalOpen && (
- <Modal
- isOpen={true}
- contentLabel="license update"
- className="modal"
- overlayClassName="modal-overlay"
- onRequestClose={this.closeModal}>
- <form onSubmit={this.handleSubmit}>
- <div className="modal-head">
- <h2>{translateWithParameters('licenses.update_license_for_x', productName)}</h2>
- </div>
- <div className="modal-body">
- <label htmlFor="license-input">{translate('licenses.license_input_label')}</label>
- <textarea
- autoFocus={true}
- className="width-100 spacer-top"
- ref={node => (this.textarea = node)}
- rows="7"
- id="license-input"
- defaultValue={license.value}
- />
- <div className="spacer-top note">{translate('licenses.license_input_note')}</div>
- </div>
- <div className="modal-foot">
- {this.state.loading && <i className="js-modal-spinner spinner spacer-right" />}
- <button className="js-modal-submit" disabled={this.state.loading}>
- {translate('save')}
- </button>
- <a href="#" className="js-modal-close" onClick={this.handleCancelClick}>
- {translate('cancel')}
- </a>
- </div>
- </form>
- </Modal>
- )}
- </button>
- );
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.js
deleted file mode 100644
index 56529f76c33..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRow.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 React from 'react';
-import PropTypes from 'prop-types';
-import DateFormatter from '../../../components/intl/DateFormatter';
-import LicenseStatus from './LicenseStatus';
-import LicenseChangeForm from './LicenseChangeForm';
-
-export default class LicenseRow extends React.PureComponent {
- static propTypes = {
- license: PropTypes.object.isRequired,
- setLicense: PropTypes.func.isRequired
- };
-
- handleSet = value => this.props.setLicense(this.props.license.key, value);
-
- render() {
- const { license } = this.props;
-
- return (
- <tr className="js-license" data-license-key={license.key}>
- <td className="text-middle">
- <LicenseStatus license={license} />
- </td>
- <td className="js-product text-middle">
- <div className={license.invalidProduct ? 'text-danger' : null}>
- {license.name || license.key}
- </div>
- </td>
- <td className="js-organization text-middle">{license.organization}</td>
- <td className="js-expiration text-middle">
- {license.expiration != null && (
- <div className={license.invalidExpiration ? 'text-danger' : null}>
- <DateFormatter date={license.expiration} long={true} />
- </div>
- )}
- </td>
- <td className="js-type text-middle">{license.type}</td>
- <td className="js-server-id text-middle">
- <div className={license.invalidServerId ? 'text-danger' : null}>{license.serverId}</div>
- </td>
- <td className="text-right">
- <LicenseChangeForm license={license} onChange={this.handleSet} />
- </td>
- </tr>
- );
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRowContainer.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRowContainer.js
deleted file mode 100644
index 49cbe5ea807..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseRowContainer.js
+++ /dev/null
@@ -1,29 +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 { connect } from 'react-redux';
-import LicenseRow from './LicenseRow';
-import { setLicense } from '../store/licenses/actions';
-import { getSettingsAppLicenseByKey } from '../../../store/rootReducer';
-
-const mapStateToProps = (state, ownProps) => ({
- license: getSettingsAppLicenseByKey(state, ownProps.licenseKey)
-});
-
-export default connect(mapStateToProps, { setLicense })(LicenseRow);
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseStatus.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicenseStatus.js
deleted file mode 100644
index 5f77eeeb718..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicenseStatus.js
+++ /dev/null
@@ -1,43 +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 { isLicenseInvalid } from './licenseUtils';
-
-export default class LicenseStatus extends React.PureComponent {
- static propTypes = {
- license: PropTypes.object.isRequired
- };
-
- render() {
- const { license } = this.props;
-
- if (license.value == null) {
- return null;
- }
-
- const isInvalid = isLicenseInvalid(license);
- if (isInvalid) {
- return <i className="icon-alert-error" />;
- }
-
- return <i className="icon-check" />;
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesApp.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesApp.js
deleted file mode 100644
index 8958da9608a..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesApp.js
+++ /dev/null
@@ -1,34 +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 Helmet from 'react-helmet';
-import LicensesAppHeader from './LicensesAppHeader';
-import LicensesListContainer from './LicensesListContainer';
-import { translate } from '../../../helpers/l10n';
-
-export default function LicensesApp() {
- return (
- <div id="licenses-page" className="page page-limited">
- <Helmet title={translate('property.category.licenses')} />
- <LicensesAppHeader />
- <LicensesListContainer />
- </div>
- );
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js
deleted file mode 100644
index 153efb04fa5..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesAppHeader.js
+++ /dev/null
@@ -1,33 +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 { translate } from '../../../helpers/l10n';
-
-export default function LicensesAppHeader() {
- return (
- <header className="page-header">
- <h1 className="page-title">{translate('property.category.licenses')}</h1>
- <div
- className="page-description"
- dangerouslySetInnerHTML={{ __html: translate('property.category.licenses.description') }}
- />
- </header>
- );
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js
deleted file mode 100644
index da90958613b..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesList.js
+++ /dev/null
@@ -1,59 +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 LicenseRowContainer from './LicenseRowContainer';
-import { translate } from '../../../helpers/l10n';
-
-export default class LicensesList extends React.PureComponent {
- static propTypes = {
- licenses: PropTypes.array.isRequired,
- fetchLicenses: PropTypes.func.isRequired
- };
-
- componentDidMount() {
- this.props.fetchLicenses().catch(() => {
- /* do nothing */
- });
- }
-
- render() {
- return (
- <table className="data zebra zebra-hover" style={{ tableLayout: 'fixed' }}>
- <thead>
- <tr>
- <th width={40}>&nbsp;</th>
- <th>{translate('licenses.list.product')}</th>
- <th width={150}>{translate('licenses.list.organization')}</th>
- <th width={150}>{translate('licenses.list.expiration')}</th>
- <th width={150}>{translate('licenses.list.type')}</th>
- <th width={150}>{translate('licenses.list.server')}</th>
- <th width={80}>&nbsp;</th>
- </tr>
- </thead>
- <tbody>
- {this.props.licenses.map(licenseKey => (
- <LicenseRowContainer key={licenseKey} licenseKey={licenseKey} />
- ))}
- </tbody>
- </table>
- );
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesListContainer.js b/server/sonar-web/src/main/js/apps/settings/licenses/LicensesListContainer.js
deleted file mode 100644
index 664e3d73193..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/LicensesListContainer.js
+++ /dev/null
@@ -1,29 +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 { connect } from 'react-redux';
-import LicensesList from './LicensesList';
-import { fetchLicenses } from '../store/licenses/actions';
-import { getSettingsAppAllLicenseKeys } from '../../../store/rootReducer';
-
-const mapStateToProps = state => ({
- licenses: getSettingsAppAllLicenseKeys(state)
-});
-
-export default connect(mapStateToProps, { fetchLicenses })(LicensesList);
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseChangeForm-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseChangeForm-test.js
deleted file mode 100644
index 899a111d9df..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseChangeForm-test.js
+++ /dev/null
@@ -1,27 +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 { shallow } from 'enzyme';
-import LicenseChangeForm from '../LicenseChangeForm';
-
-it('should render button', () => {
- const form = shallow(<LicenseChangeForm license={{}} onChange={jest.fn()} />);
- expect(form.is('button')).toBe(true);
-});
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseRow-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseRow-test.js
deleted file mode 100644
index 94e3d55b633..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseRow-test.js
+++ /dev/null
@@ -1,125 +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 { shallow } from 'enzyme';
-import LicenseRow from '../LicenseRow';
-import LicenseStatus from '../LicenseStatus';
-import LicenseChangeForm from '../LicenseChangeForm';
-
-it('should render status', () => {
- const license = {};
- const licenseStatus = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- LicenseStatus
- );
- expect(licenseStatus.length).toBe(1);
- expect(licenseStatus.prop('license')).toBe(license);
-});
-
-it('should render product', () => {
- const license = { name: 'foo' };
- const licenseProduct = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-product'
- );
- expect(licenseProduct.length).toBe(1);
- expect(licenseProduct.text()).toContain('foo');
-});
-
-it('should render invalid product', () => {
- const license = { product: 'foo', invalidProduct: true };
- const licenseProduct = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-product'
- );
- expect(licenseProduct.find('.text-danger').length).toBe(1);
-});
-
-it('should render key when no name', () => {
- const license = { key: 'foo.secured' };
- const licenseProduct = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-product'
- );
- expect(licenseProduct.length).toBe(1);
- expect(licenseProduct.text()).toContain('foo.secured');
-});
-
-it('should render organization', () => {
- const license = { organization: 'org' };
- const licenseOrg = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-organization'
- );
- expect(licenseOrg.length).toBe(1);
- expect(licenseOrg.text()).toContain('org');
-});
-
-it('should render expiration', () => {
- const license = { expiration: '2015-01-01' };
- const licenseExpiration = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-expiration'
- );
- expect(licenseExpiration.length).toBe(1);
- expect(licenseExpiration.find('DateFormatter')).toHaveLength(1);
-});
-
-it('should render invalid expiration', () => {
- const license = { expiration: '2015-01-01', invalidExpiration: true };
- const licenseExpiration = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-expiration'
- );
- expect(licenseExpiration.find('.text-danger').length).toBe(1);
-});
-
-it('should render type', () => {
- const license = { type: 'PRODUCTION' };
- const licenseType = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-type'
- );
- expect(licenseType.length).toBe(1);
- expect(licenseType.text()).toContain('PRODUCTION');
-});
-
-it('should render server id', () => {
- const license = { serverId: 'bar' };
- const licenseServerId = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-server-id'
- );
- expect(licenseServerId.length).toBe(1);
- expect(licenseServerId.text()).toContain('bar');
-});
-
-it('should render invalid server id', () => {
- const license = { serverId: 'bar', invalidServerId: true };
- const licenseServerId = shallow(<LicenseRow license={license} setLicense={jest.fn()} />).find(
- '.js-server-id'
- );
- expect(licenseServerId.find('.text-danger').length).toBe(1);
-});
-
-it('should render change form', () => {
- const license = { key: 'foo' };
- const setLicense = jest.fn(() => Promise.resolve());
- const licenseChangeForm = shallow(<LicenseRow license={license} setLicense={setLicense} />).find(
- LicenseChangeForm
- );
- expect(licenseChangeForm.length).toBe(1);
- expect(licenseChangeForm.prop('license')).toBe(license);
- expect(typeof licenseChangeForm.prop('onChange')).toBe('function');
-
- licenseChangeForm.prop('onChange')('license-hash');
- expect(setLicense).toBeCalledWith('foo', 'license-hash');
-});
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseStatus-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseStatus-test.js
deleted file mode 100644
index b87f2cd2624..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicenseStatus-test.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 React from 'react';
-import { shallow } from 'enzyme';
-import LicenseStatus from '../LicenseStatus';
-
-it('should render nothing when no value', () => {
- const status = shallow(<LicenseStatus license={{}} />);
- expect(status.node).toBeNull();
-});
-
-it('should render ok', () => {
- const status = shallow(<LicenseStatus license={{ value: 'foo' }} />);
- expect(status.is('.icon-check')).toBe(true);
-});
-
-it('should render error when invalid product', () => {
- const status = shallow(<LicenseStatus license={{ value: 'foo', invalidProduct: true }} />);
- expect(status.is('.icon-check')).toBe(false);
- expect(status.is('.icon-alert-error')).toBe(true);
-});
-
-it('should render error when invalid expiration', () => {
- const status = shallow(<LicenseStatus license={{ value: 'foo', invalidExpiration: true }} />);
- expect(status.is('.icon-check')).toBe(false);
- expect(status.is('.icon-alert-error')).toBe(true);
-});
-
-it('should render error when invalid server id', () => {
- const status = shallow(<LicenseStatus license={{ value: 'foo', invalidServerId: true }} />);
- expect(status.is('.icon-check')).toBe(false);
- expect(status.is('.icon-alert-error')).toBe(true);
-});
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesApp-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesApp-test.js
deleted file mode 100644
index fe19ff981f8..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesApp-test.js
+++ /dev/null
@@ -1,30 +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 { shallow } from 'enzyme';
-import LicensesApp from '../LicensesApp';
-import LicensesAppHeader from '../LicensesAppHeader';
-import LicensesListContainer from '../LicensesListContainer';
-
-it('should render', () => {
- const app = shallow(<LicensesApp />);
- expect(app.find(LicensesAppHeader).length).toBe(1);
- expect(app.find(LicensesListContainer).length).toBe(1);
-});
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesAppHeader-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesAppHeader-test.js
deleted file mode 100644
index b5b3fa59a90..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesAppHeader-test.js
+++ /dev/null
@@ -1,28 +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 { shallow } from 'enzyme';
-import LicensesAppHeader from '../LicensesAppHeader';
-
-it('should render', () => {
- const header = shallow(<LicensesAppHeader />);
- expect(header.find('.page-title').length).toBe(1);
- expect(header.find('.page-description').length).toBe(1);
-});
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js b/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.js
deleted file mode 100644
index 220d0707360..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/__tests__/LicensesList-test.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 React from 'react';
-import { shallow, mount } from 'enzyme';
-import LicensesList from '../LicensesList';
-import LicenseRowContainer from '../LicenseRowContainer';
-
-it('should render', () => {
- const list = shallow(<LicensesList licenses={[]} fetchLicenses={jest.fn()} />);
- expect(list.is('table')).toBe(true);
-});
-
-it('should fetch licenses', () => {
- const fetchLicenses = jest.fn(() => Promise.resolve());
- mount(<LicensesList licenses={[]} fetchLicenses={fetchLicenses} />);
- expect(fetchLicenses).toBeCalled();
-});
-
-it('should render rows', () => {
- const list = shallow(<LicensesList licenses={['foo', 'bar']} fetchLicenses={jest.fn()} />);
- expect(list.find(LicenseRowContainer).length).toBe(2);
- expect(
- list
- .find(LicenseRowContainer)
- .at(0)
- .prop('licenseKey')
- ).toBe('foo');
- expect(
- list
- .find(LicenseRowContainer)
- .at(1)
- .prop('licenseKey')
- ).toBe('bar');
-});
diff --git a/server/sonar-web/src/main/js/apps/settings/licenses/licenseUtils.js b/server/sonar-web/src/main/js/apps/settings/licenses/licenseUtils.js
deleted file mode 100644
index 7be9c5090d4..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/licenses/licenseUtils.js
+++ /dev/null
@@ -1,26 +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.
- */
-export const isLicenseInvalid = license =>
- !!license.invalidProduct || !!license.invalidExpiration || !!license.invalidServerId;
-
-export const isLicenseFromListInvalid = (licenses, key) => {
- const license = licenses.find(license => license.key === key);
- return license ? isLicenseInvalid(license) : false;
-};
diff --git a/server/sonar-web/src/main/js/apps/settings/routes.ts b/server/sonar-web/src/main/js/apps/settings/routes.ts
index 54afd122a3d..ea302f86214 100644
--- a/server/sonar-web/src/main/js/apps/settings/routes.ts
+++ b/server/sonar-web/src/main/js/apps/settings/routes.ts
@@ -26,22 +26,10 @@ const routes = [
}
},
{
- path: 'licenses',
- getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) {
- import('./licenses/LicensesApp').then(i => callback(null, i.default));
- }
- },
- {
path: 'encryption',
getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) {
import('./encryption/EncryptionAppContainer').then(i => callback(null, i.default));
}
- },
- {
- path: 'server_id',
- getComponent(_: RouterState, callback: (err: any, component: RouteComponent) => any) {
- import('./serverId/ServerIdAppContainer').then(i => callback(null, i.default));
- }
}
];
diff --git a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js b/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js
deleted file mode 100644
index 98e9226835e..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdApp.js
+++ /dev/null
@@ -1,161 +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 { translate } from '../../../helpers/l10n';
-import { getServerId, generateServerId } from '../../../api/settings';
-import { parseError } from '../../code/utils';
-
-export default class ServerIdApp extends React.PureComponent {
- static propTypes = {
- addGlobalErrorMessage: PropTypes.func.isRequired,
- closeAllGlobalMessages: PropTypes.func.isRequired
- };
-
- state = {
- loading: true,
- organization: '',
- ip: '',
- validIpAddresses: []
- };
-
- componentDidMount() {
- this.mounted = true;
- this.fetchServerId();
- }
-
- componentWillUnmount() {
- this.mounted = false;
- }
-
- handleError(error) {
- this.setState({ loading: false });
- parseError(error).then(message => this.props.addGlobalErrorMessage(message));
- }
-
- fetchServerId() {
- this.setState({ loading: true });
- getServerId()
- .then(data => {
- if (this.mounted) {
- this.setState({ ...data, loading: false });
- }
- })
- .catch(error => this.handleError(error));
- }
-
- handleSubmit(e) {
- e.preventDefault();
- this.setState({ loading: true });
- this.props.closeAllGlobalMessages();
- generateServerId(this.state.organization, this.state.ip)
- .then(data => {
- if (this.mounted) {
- this.setState({ serverId: data.serverId, invalidServerId: false, loading: false });
- }
- })
- .catch(error => this.handleError(error));
- }
-
- render() {
- return (
- <div id="server-id-page" className="page page-limited">
- <Helmet title={translate('property.category.server_id')} />
- <header className="page-header">
- <h1 className="page-title">{translate('property.category.server_id')}</h1>
- {this.state.loading && <i className="spinner" />}
- <div className="page-description">{translate('server_id_configuration.information')}</div>
- </header>
-
- {this.state.serverId != null && (
- <div className={this.state.invalidServerId ? 'panel panel-danger' : 'panel'}>
- {translate('property.category.server_id')}:
- <input
- id="server-id-result"
- className="spacer-left input-large input-clear input-code"
- type="text"
- readOnly={true}
- value={this.state.serverId}
- />
- {!!this.state.invalidServerId && (
- <span className="spacer-left">{translate('server_id_configuration.bad_key')}</span>
- )}
- </div>
- )}
-
- <div className="panel">
- <form id="server-id-form" onSubmit={e => this.handleSubmit(e)}>
- <div className="modal-field">
- <label htmlFor="server-id-organization">
- {translate('server_id_configuration.organisation.title')}
- <em className="mandatory">*</em>
- </label>
- <input
- id="server-id-organization"
- type="text"
- required={true}
- value={this.state.organization}
- disabled={this.state.loading}
- onChange={e => this.setState({ organization: e.target.value })}
- />
- <div className="modal-field-description">
- {translate('server_id_configuration.organisation.desc')}
- {'. '}
- {translate('server_id_configuration.organisation.pattern')}
- </div>
- </div>
-
- <div className="modal-field">
- <label htmlFor="server-id-ip">
- {translate('server_id_configuration.ip.title')}
- <em className="mandatory">*</em>
- </label>
- <input
- id="server-id-ip"
- type="text"
- required={true}
- value={this.state.ip}
- disabled={this.state.loading}
- onChange={e => this.setState({ ip: e.target.value })}
- />
- <div className="modal-field-description">
- {translate('server_id_configuration.ip.desc')}
- <ul className="list-styled">
- {this.state.validIpAddresses.map(ip => (
- <li key={ip} className="little-spacer-top">
- {ip}
- </li>
- ))}
- </ul>
- </div>
- </div>
-
- <div className="modal-field">
- <button disabled={this.state.loading}>
- {translate('server_id_configuration.generate_button')}
- </button>
- </div>
- </form>
- </div>
- </div>
- );
- }
-}
diff --git a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdAppContainer.js b/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdAppContainer.js
deleted file mode 100644
index d6b0824735a..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/serverId/ServerIdAppContainer.js
+++ /dev/null
@@ -1,24 +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 { connect } from 'react-redux';
-import ServerIdApp from './ServerIdApp';
-import { addGlobalErrorMessage, closeAllGlobalMessages } from '../../../store/globalMessages/duck';
-
-export default connect(() => ({}), { addGlobalErrorMessage, closeAllGlobalMessages })(ServerIdApp);
diff --git a/server/sonar-web/src/main/js/apps/settings/store/licenses/actions.js b/server/sonar-web/src/main/js/apps/settings/store/licenses/actions.js
deleted file mode 100644
index 9ef043c73c7..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/store/licenses/actions.js
+++ /dev/null
@@ -1,70 +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 * as licenses from '../../../../api/licenses';
-import { parseError } from '../../../code/utils';
-import {
- addGlobalSuccessMessage,
- addGlobalErrorMessage
-} from '../../../../store/globalMessages/duck';
-import { translate } from '../../../../helpers/l10n';
-import { isLicenseFromListInvalid, isLicenseInvalid } from '../../licenses/licenseUtils';
-
-export const RECEIVE_LICENSES = 'RECEIVE_LICENSES';
-
-const receiveLicenses = licenses => ({
- type: RECEIVE_LICENSES,
- licenses
-});
-
-const handleError = dispatch => error => {
- parseError(error).then(message => dispatch(addGlobalErrorMessage(message)));
- return Promise.reject();
-};
-
-export const fetchLicenses = () => dispatch => {
- return licenses
- .getLicenses()
- .then(licenses => {
- dispatch(receiveLicenses(licenses));
- /* eslint import/namespace: 0 */
- const invalidLicenses = licenses.some(isLicenseInvalid);
- if (invalidLicenses) {
- dispatch(addGlobalErrorMessage(translate('licenses.there_are_invalid')));
- }
- })
- .catch(handleError(dispatch));
-};
-
-export const setLicense = (key, value) => dispatch => {
- const request = value ? licenses.setLicense(key, value) : licenses.resetLicense(key);
-
- return request
- .then(() =>
- licenses.getLicenses().then(licenses => {
- dispatch(receiveLicenses(licenses));
- if (isLicenseFromListInvalid(licenses, key)) {
- dispatch(addGlobalErrorMessage(translate('licenses.error_message')));
- } else {
- dispatch(addGlobalSuccessMessage(translate('licenses.success_message')));
- }
- })
- )
- .catch(handleError(dispatch));
-};
diff --git a/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js b/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js
deleted file mode 100644
index 35f68211c16..00000000000
--- a/server/sonar-web/src/main/js/apps/settings/store/licenses/reducer.js
+++ /dev/null
@@ -1,36 +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 { keyBy } from 'lodash';
-import { RECEIVE_LICENSES } from './actions';
-
-const reducer = (state = {}, action = {}) => {
- if (action.type === RECEIVE_LICENSES) {
- const licensesByKey = keyBy(action.licenses, 'key');
- return { ...state, ...licensesByKey };
- }
-
- return state;
-};
-
-export default reducer;
-
-export const getLicenseByKey = (state, key) => state[key];
-
-export const getAllLicenseKeys = state => Object.keys(state);
diff --git a/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js b/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js
index 0f22d81cf13..beaeb6b8be1 100644
--- a/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js
+++ b/server/sonar-web/src/main/js/apps/settings/store/rootReducer.js
@@ -22,7 +22,6 @@ import { combineReducers } from 'redux';
import definitions, * as fromDefinitions from './definitions/reducer';
import values, * as fromValues from './values/reducer';
import settingsPage, * as fromSettingsPage from './settingsPage/reducer';
-import licenses, * as fromLicenses from './licenses/reducer';
import globalMessages, * as fromGlobalMessages from '../../../store/globalMessages/duck';
import encryptionPage from './encryptionPage/reducer';
/*:: import type { State as GlobalMessagesState } from '../../../store/globalMessages/duck'; */
@@ -33,7 +32,6 @@ type State = {
definitions: {},
encryptionPage: {},
globalMessages: GlobalMessagesState,
- licenses: {},
settingsPage: {},
values: ValuesState
};
@@ -43,7 +41,6 @@ const rootReducer = combineReducers({
definitions,
values,
settingsPage,
- licenses,
encryptionPage,
globalMessages
});
@@ -78,12 +75,6 @@ export const getChangedValue = (state /*: State */, key /*: string */) =>
export const isLoading = (state /*: State */, key /*: string */) =>
fromSettingsPage.isLoading(state.settingsPage, key);
-export const getLicenseByKey = (state /*: State */, key /*: string */) =>
- fromLicenses.getLicenseByKey(state.licenses, key);
-
-export const getAllLicenseKeys = (state /*: State */) =>
- fromLicenses.getAllLicenseKeys(state.licenses);
-
export const getValidationMessage = (state /*: State */, key /*: string */) =>
fromSettingsPage.getValidationMessage(state.settingsPage, key);
diff --git a/server/sonar-web/src/main/js/store/rootReducer.js b/server/sonar-web/src/main/js/store/rootReducer.js
index 7ab8741e79f..9edca6126da 100644
--- a/server/sonar-web/src/main/js/store/rootReducer.js
+++ b/server/sonar-web/src/main/js/store/rootReducer.js
@@ -150,12 +150,6 @@ export const getSettingsAppChangedValue = (state, key) =>
export const isSettingsAppLoading = (state, key) =>
fromSettingsApp.isLoading(state.settingsApp, key);
-export const getSettingsAppLicenseByKey = (state, key) =>
- fromSettingsApp.getLicenseByKey(state.settingsApp, key);
-
-export const getSettingsAppAllLicenseKeys = state =>
- fromSettingsApp.getAllLicenseKeys(state.settingsApp);
-
export const getSettingsAppValidationMessage = (state, key) =>
fromSettingsApp.getValidationMessage(state.settingsApp, key);