Skip to content

Commit

Permalink
Add alert deletion confirmation dialog (#3902)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyoshidajp authored and ranbena committed Jun 15, 2019
1 parent 8e38dcd commit ac293c7
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions client/app/pages/alert/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { template as templateBuilder } from 'lodash';
import notification from '@/services/notification';
import Modal from 'antd/lib/modal';
import template from './alert.html';
import navigateTo from '@/services/navigateTo';

function AlertCtrl($scope, $routeParams, $location, $sce, currentUser, Query, Events, Alert) {
this.alertId = $routeParams.alertId;
Expand Down Expand Up @@ -74,15 +76,24 @@ function AlertCtrl($scope, $routeParams, $location, $sce, currentUser, Query, Ev
};

this.delete = () => {
this.alert.$delete(
() => {
$location.path('/alerts');
notification.success('Alert deleted.');
},
() => {
const doDelete = () => {
this.alert.$delete(() => {
notification.success('Alert destination deleted successfully.');
navigateTo('/alerts', true);
}, () => {
notification.error('Failed deleting alert.');
},
);
});
};

Modal.confirm({
title: 'Delete Alert',
content: 'Are you sure you want to delete this alert?',
okText: 'Delete',
okType: 'danger',
onOk: doDelete,
maskClosable: true,
autoFocusButton: null,
});
};
}

Expand Down

0 comments on commit ac293c7

Please sign in to comment.