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,
|
2023-03-09 22:00:28 +01:00
|
|
|
removeNetworkConfiguration: PropTypes.func.isRequired,
|
2019-07-02 14:13:02 +02:00
|
|
|
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 = () => {
|
2023-03-09 22:00:28 +01:00
|
|
|
this.props.removeNetworkConfiguration(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
|
|
|
}
|
|
|
|
}
|