From 95b16919a64a3a9133dd902703ed7a7571de0f2a Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Wed, 27 Jul 2016 17:37:35 +1200 Subject: [PATCH] feat(ui): display an error message when trying to remove a network with active endpoints (#90) --- app/components/networks/networksController.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/components/networks/networksController.js b/app/components/networks/networksController.js index 124b18129..3cde28bfa 100644 --- a/app/components/networks/networksController.js +++ b/app/components/networks/networksController.js @@ -45,9 +45,14 @@ function ($scope, Network, Messages, errorMsgFilter) { if (network.Checked) { counter = counter + 1; Network.remove({id: network.Id}, function (d) { - Messages.send("Network deleted", network.Id); - var index = $scope.networks.indexOf(network); - $scope.networks.splice(index, 1); + var error = errorMsgFilter(d); + if (error) { + Messages.send("Error", "Unable to remove network with active endpoints"); + } else { + Messages.send("Network deleted", network.Id); + var index = $scope.networks.indexOf(network); + $scope.networks.splice(index, 1); + } complete(); }, function (e) { Messages.error("Failure", e.data);