Small changes in the Model dialog logic to make it more React-like.

This commit is contained in:
Tomas Bures 2017-06-09 09:07:23 +02:00
parent 8e54879539
commit ed5b81b6e6
2 changed files with 46 additions and 30 deletions

View file

@ -163,10 +163,10 @@ export default class CUD extends Component {
}
async performDelete() {
await this.hideDeleteModal();
const t = this.props.t;
await this.hideDeleteModal();
try {
this.disableForm();
this.setFormStatusMessage('info', t('Deleting namespace...'));
@ -198,8 +198,8 @@ export default class CUD extends Component {
return (
<div>
{!this.isEditGlobal() && deleteConfirmationShown &&
<ModalDialog title={t('Confirm deletion')} onCloseAsync={::this.hideDeleteModal} buttons={[
{!this.isEditGlobal() && !this.hasChildren && edit &&
<ModalDialog hidden={!deleteConfirmationShown} title={t('Confirm deletion')} onCloseAsync={::this.hideDeleteModal} buttons={[
{ label: t('No'), className: 'btn-primary', onClickAsync: ::this.hideDeleteModal },
{ label: t('Yes'), className: 'btn-danger', onClickAsync: ::this.performDelete }
]}>