angular.module('network', [])
.controller('NetworkController', ['$scope', 'Network', 'ViewSpinner', 'Messages', '$state', '$stateParams', 'errorMsgFilter',
function ($scope, Network, ViewSpinner, Messages, $state, $stateParams, errorMsgFilter) {
$scope.disconnect = function disconnect(networkId, containerId) {
ViewSpinner.spin();
Network.disconnect({id: $stateParams.id}, {Container: containerId}, function (d) {
ViewSpinner.stop();
Messages.send("Container disconnected", containerId);
$state.go('network', {id: $stateParams.id}, {reload: true});
}, function (e) {
Messages.error("Failure", e.data);
});
};
$scope.remove = function remove(networkId) {
Network.remove({id: $stateParams.id}, function (d) {
Messages.send("Network removed", "");
$state.go('networks', {});
Network.get({id: $stateParams.id}, function (d) {
$scope.network = d;
}]);