2018-11-30 09:18:41 +00:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
|
2018-12-12 09:09:15 +00:00
|
|
|
import { gettext } from '../../utils/constants';
|
2018-11-30 09:18:41 +00:00
|
|
|
|
2018-12-12 09:09:15 +00:00
|
|
|
class DeleteRepoDialog extends Component {
|
2018-11-30 09:18:41 +00:00
|
|
|
|
2018-12-12 09:09:15 +00:00
|
|
|
toggle = () => {
|
2018-11-30 09:18:41 +00:00
|
|
|
this.props.toggle();
|
|
|
|
}
|
|
|
|
|
2018-12-12 09:09:15 +00:00
|
|
|
clickYes = () => {
|
2018-11-30 09:18:41 +00:00
|
|
|
this.toggle();
|
|
|
|
|
|
|
|
const data = this.props.data;
|
|
|
|
if (data) {
|
|
|
|
data.yesCallback.bind(data._this)();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
|
|
|
const data = this.props.data;
|
2018-12-12 09:09:15 +00:00
|
|
|
const repoName = data ? '<span class="sf-font">' + data.repoName + '</span>' : null;
|
2018-12-20 07:14:52 +00:00
|
|
|
let message = gettext("Are you sure you want to delete %s ?");
|
2018-12-12 09:09:15 +00:00
|
|
|
message = message.replace('%s', repoName);
|
2018-11-30 09:18:41 +00:00
|
|
|
const popup = (
|
2018-12-12 10:29:50 +00:00
|
|
|
<Modal isOpen={true} toggle={this.toggle}>
|
2018-11-30 09:18:41 +00:00
|
|
|
<ModalHeader toggle={this.toggle}>{gettext("Delete Library")}</ModalHeader>
|
|
|
|
<ModalBody>
|
2018-12-12 09:09:15 +00:00
|
|
|
<p dangerouslySetInnerHTML={{__html: message}}></p>
|
2018-11-30 09:18:41 +00:00
|
|
|
</ModalBody>
|
|
|
|
<ModalFooter>
|
2018-12-12 10:29:50 +00:00
|
|
|
<Button color="primary" onClick={this.clickYes}>{gettext("Delete")}</Button>
|
2018-12-12 09:09:15 +00:00
|
|
|
<Button color="secondary" onClick={this.toggle}>{gettext("Cancel")}</Button>
|
2018-11-30 09:18:41 +00:00
|
|
|
</ModalFooter>
|
|
|
|
</Modal>
|
|
|
|
);
|
|
|
|
|
|
|
|
return popup;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-12 09:09:15 +00:00
|
|
|
export default DeleteRepoDialog;
|