diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2017-05-30 11:40:01 +0200 |
---|---|---|
committer | Eric Hartmann <hartmann.eric@gmail.com> | 2017-06-14 15:43:12 +0200 |
commit | c23644d8c6f3e93f1ef6cda4ec973e2e9ded72c2 (patch) | |
tree | bfca6e22fbcb0c814f4604a8234405db3b6d941b /server | |
parent | 14f35ba612ceca42d7ad6eb7092bfaf83dd7b9b3 (diff) | |
download | sonarqube-c23644d8c6f3e93f1ef6cda4ec973e2e9ded72c2.tar.gz sonarqube-c23644d8c6f3e93f1ef6cda4ec973e2e9ded72c2.zip |
SONAR-9305 Remove action to restore built-in profiles in web app
Diffstat (limited to 'server')
5 files changed, 0 insertions, 131 deletions
diff --git a/server/sonar-web/src/main/js/api/quality-profiles.js b/server/sonar-web/src/main/js/api/quality-profiles.js index 2f178014559..ec31557c1c5 100644 --- a/server/sonar-web/src/main/js/api/quality-profiles.js +++ b/server/sonar-web/src/main/js/api/quality-profiles.js @@ -94,11 +94,6 @@ export function getExporters() { return getJSON(url).then(r => r.exporters); } -export function restoreBuiltInProfiles(data: Object) { - const url = '/api/qualityprofiles/restore_built_in'; - return post(url, data); -} - export function getProfileChangelog(data: Object) { const url = '/api/qualityprofiles/changelog'; return getJSON(url, data); diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js index 6a276e243ee..44ce54b4555 100644 --- a/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js +++ b/server/sonar-web/src/main/js/apps/quality-profiles/home/PageHeader.js @@ -21,7 +21,6 @@ import React from 'react'; import CreateProfileForm from './CreateProfileForm'; import RestoreProfileForm from './RestoreProfileForm'; -import RestoreBuiltInProfilesView from '../views/RestoreBuiltInProfilesView'; import type { Profile } from '../propTypes'; import { getProfilePath } from '../utils'; import { translate } from '../../../helpers/l10n'; @@ -78,16 +77,6 @@ export default class PageHeader extends React.PureComponent { this.setState({ restoreFormOpen: false }); }; - handleRestoreBuiltIn = (e: SyntheticInputEvent) => { - e.preventDefault(); - new RestoreBuiltInProfilesView({ - languages: this.props.languages, - organization: this.props.organization - }) - .on('done', this.props.updateProfiles) - .render(); - }; - render() { return ( <header className="page-header"> @@ -109,15 +98,6 @@ export default class PageHeader extends React.PureComponent { {translate('quality_profiles.restore_profile')} </a> </li> - - <li> - <a - href="#" - id="quality-profiles-restore-built-in" - onClick={this.handleRestoreBuiltIn}> - {translate('quality_profiles.restore_built_in_profiles')} - </a> - </li> </ul> </div>} diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs deleted file mode 100644 index 41c449e88d4..00000000000 --- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs +++ /dev/null @@ -1,13 +0,0 @@ -<form id="restore-built-in-profiles-form"> - <div class="modal-head"> - <h2>{{t 'quality_profiles.restore_built_in_profiles'}}</h2> - </div> - <div class="modal-body"> - <div class="alert alert-success"> - {{tp 'quality_profiles.restore_built_in_profiles_success_message' selectedLanguage}} - </div> - </div> - <div class="modal-foot"> - <a href="#" class="js-modal-close">{{t 'close'}}</a> - </div> -</form> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs b/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs deleted file mode 100644 index a2cad2141df..00000000000 --- a/server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs +++ /dev/null @@ -1,21 +0,0 @@ -<form id="restore-built-in-profiles-form"> - <div class="modal-head"> - <h2>{{t 'quality_profiles.restore_built_in_profiles'}}</h2> - </div> - <div class="modal-body"> - <div class="js-modal-messages"></div> - <div id="restore-built-in-profiles-form-success" class="alert alert-success hidden"></div> - <div class="modal-field"> - <label for="restore-built-in-profiles-language">{{t 'language'}}<em class="mandatory">*</em></label> - <select id="restore-built-in-profiles-language" name="language"> - {{#each languages}} - <option value="{{key}}">{{name}}</option> - {{/each}} - </select> - </div> - </div> - <div class="modal-foot"> - <button id="restore-built-in-profiles-submit">{{t 'restore'}}</button> - <a href="#" class="js-modal-close">{{t 'close'}}</a> - </div> -</form> diff --git a/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js b/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js deleted file mode 100644 index 2edf05044b4..00000000000 --- a/server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js +++ /dev/null @@ -1,72 +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. - */ -// @flow -import ModalFormView from '../../../components/common/modal-form'; -import Template from '../templates/quality-profiles-restore-built-in-profiles.hbs'; -import TemplateSuccess from '../templates/quality-profiles-restore-built-in-profiles-success.hbs'; -import { restoreBuiltInProfiles } from '../../../api/quality-profiles'; - -export default ModalFormView.extend({ - template: Template, - successTemplate: TemplateSuccess, - - getTemplate() { - return this.selectedLanguage ? this.successTemplate : this.template; - }, - - onRender() { - ModalFormView.prototype.onRender.apply(this, arguments); - this.$('select').select2({ - width: '250px', - minimumResultsForSearch: 50 - }); - }, - - onFormSubmit() { - ModalFormView.prototype.onFormSubmit.apply(this, arguments); - this.disableForm(); - this.sendRequest(); - }, - - sendRequest() { - const language = this.$('#restore-built-in-profiles-language').val(); - this.selectedLanguage = this.options.languages.find(l => l.key === language).name; - const data = this.options.organization - ? { language, organization: this.options.organization } - : { language }; - restoreBuiltInProfiles(data) - .then(() => { - this.done = true; - this.render(); - this.trigger('done'); - }) - .catch(e => { - this.enableForm(); - e.response.json().then(r => this.showErrors(r.errors, r.warnings)); - }); - }, - - serializeData() { - return { - languages: this.options.languages, - selectedLanguage: this.selectedLanguage - }; - } -}); |