From c23644d8c6f3e93f1ef6cda4ec973e2e9ded72c2 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 30 May 2017 11:40:01 +0200 Subject: SONAR-9305 Remove action to restore built-in profiles in web app --- .../sonar-web/src/main/js/api/quality-profiles.js | 5 -- .../js/apps/quality-profiles/home/PageHeader.js | 20 ------ ...-profiles-restore-built-in-profiles-success.hbs | 13 ---- .../quality-profiles-restore-built-in-profiles.hbs | 21 ------- .../views/RestoreBuiltInProfilesView.js | 72 ---------------------- 5 files changed, 131 deletions(-) delete mode 100644 server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles-success.hbs delete mode 100644 server/sonar-web/src/main/js/apps/quality-profiles/templates/quality-profiles-restore-built-in-profiles.hbs delete mode 100644 server/sonar-web/src/main/js/apps/quality-profiles/views/RestoreBuiltInProfilesView.js (limited to 'server') 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 (
@@ -109,15 +98,6 @@ export default class PageHeader extends React.PureComponent { {translate('quality_profiles.restore_profile')} - -
  • - - {translate('quality_profiles.restore_built_in_profiles')} - -
  • } 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 @@ -
    - - - -
    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 @@ -
    - - - -
    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 - }; - } -}); -- cgit v1.2.3