2021-02-04 19:15:23 +01:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Modal, { ModalContent } from '../../modal';
|
2019-07-02 14:13:02 +02:00
|
|
|
|
|
|
|
export default class ConfirmDeleteNetwork extends PureComponent {
|
|
|
|
static propTypes = {
|
|
|
|
hideModal: PropTypes.func.isRequired,
|
|
|
|
delRpcTarget: PropTypes.func.isRequired,
|
|
|
|
onConfirm: PropTypes.func.isRequired,
|
|
|
|
target: PropTypes.string.isRequired,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-07-02 14:13:02 +02:00
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-07-02 14:13:02 +02:00
|
|
|
|
|
|
|
handleDelete = () => {
|
2020-11-03 00:41:28 +01:00
|
|
|
this.props.delRpcTarget(this.props.target).then(() => {
|
2021-02-04 19:15:23 +01:00
|
|
|
this.props.onConfirm();
|
|
|
|
this.props.hideModal();
|
|
|
|
});
|
|
|
|
};
|
2019-07-02 14:13:02 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2021-02-04 19:15:23 +01:00
|
|
|
const { t } = this.context;
|
2019-07-02 14:13:02 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Modal
|
|
|
|
onSubmit={this.handleDelete}
|
|
|
|
onCancel={() => this.props.hideModal()}
|
|
|
|
submitText={t('delete')}
|
|
|
|
cancelText={t('cancel')}
|
2021-10-05 21:20:42 +02:00
|
|
|
submitType="danger-primary"
|
2019-07-02 14:13:02 +02:00
|
|
|
>
|
|
|
|
<ModalContent
|
|
|
|
title={t('deleteNetwork')}
|
|
|
|
description={t('deleteNetworkDescription')}
|
|
|
|
/>
|
|
|
|
</Modal>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-07-02 14:13:02 +02:00
|
|
|
}
|
|
|
|
}
|