feat(network): display the correct error message when a network deletion failure occurs

pull/178/head
Anthony Lapenna 8 years ago
parent 4edb4e014f
commit 6d6a7e6923

@ -17,9 +17,15 @@ function ($scope, Network, Messages, $state, $stateParams, errorMsgFilter) {
$scope.remove = function remove(networkId) {
$('#loadingViewSpinner').show();
Network.remove({id: $stateParams.id}, function (d) {
$('#loadingViewSpinner').hide();
Messages.send("Network removed", "");
$state.go('networks', {});
var error = errorMsgFilter(d);
if (error) {
$('#loadingViewSpinner').hide();
Messages.send("Error", error);
} else {
$('#loadingViewSpinner').hide();
Messages.send("Network deleted", $stateParams.id);
$state.go('networks', {});
}
}, function (e) {
$('#loadingViewSpinner').hide();
Messages.error("Failure", e.data);

@ -47,7 +47,7 @@ function ($scope, $state, Network, Config, Messages, errorMsgFilter) {
Network.remove({id: network.Id}, function (d) {
var error = errorMsgFilter(d);
if (error) {
Messages.send("Error", "Unable to remove network with active endpoints");
Messages.send("Error", error);
} else {
Messages.send("Network deleted", network.Id);
var index = $scope.networks.indexOf(network);

Loading…
Cancel
Save