diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-07-26 17:33:45 +0200 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-07-26 17:33:45 +0200 |
commit | 536ef50c354725e0f742026863162a0d90e9d2fd (patch) | |
tree | cfd04dc0f84d2e1e3fd80bc73073a50c636a10ef /server/sonar-web/src/main/js/apps/project-admin | |
parent | 940c3eb71b6c8fd6cb34c4ff93a1e661ec19a4c5 (diff) | |
download | sonarqube-536ef50c354725e0f742026863162a0d90e9d2fd.tar.gz sonarqube-536ef50c354725e0f742026863162a0d90e9d2fd.zip |
fix bad merge
Diffstat (limited to 'server/sonar-web/src/main/js/apps/project-admin')
-rw-r--r-- | server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js | 69 |
1 files changed, 8 insertions, 61 deletions
diff --git a/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js b/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js index 354935418fa..81d52fb3ba2 100644 --- a/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js +++ b/server/sonar-web/src/main/js/apps/project-admin/deletion/Form.js @@ -18,39 +18,24 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import React from 'react'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; -import { deleteProject } from '../../../api/components'; +import ConfirmationModal from './ConfirmationModal'; +import { translate } from '../../../helpers/l10n'; export default class Form extends React.Component { static propTypes = { component: React.PropTypes.object.isRequired }; - state = { - confirmation: false, - loading: false - }; - handleDelete (e) { e.preventDefault(); - this.setState({ confirmation: true }); - } - - confirmDeleteClick (e) { - e.preventDefault(); - this.setState({ loading: true }); - deleteProject(this.props.component.key).then(() => { - window.location = window.baseUrl + '/'; - }); + new ConfirmationModal({ project: this.props.component }) + .on('done', () => { + window.location = window.baseUrl + '/'; + }) + .render(); } - cancelDeleteClick (e) { - e.preventDefault(); - e.target.blur(); - this.setState({ confirmation: false }); - } - - renderInitial () { + render () { return ( <form onSubmit={this.handleDelete.bind(this)}> <button id="delete-project" className="button-red"> @@ -59,42 +44,4 @@ export default class Form extends React.Component { </form> ); } - - renderConfirmation () { - return ( - <form className="panel panel-warning" - onSubmit={this.confirmDeleteClick.bind(this)}> - <div className="big-spacer-bottom"> - {translateWithParameters( - 'project_deletion.delete_resource_confirmation', - this.props.component.name)} - </div> - - <div> - <button - id="confirm-project-deletion" - className="button-red" - disabled={this.state.loading}> - {translate('delete')} - </button> - - {this.state.loading ? ( - <i className="spinner big-spacer-left"/> - ) : ( - <a href="#" - className="big-spacer-left" - onClick={this.cancelDeleteClick.bind(this)}> - {translate('cancel')} - </a> - )} - </div> - </form> - ); - } - - render () { - return this.state.confirmation ? - this.renderConfirmation() : - this.renderInitial(); - } } |