From 715638e3680da275e445b8f825acb580f42557fb Mon Sep 17 00:00:00 2001 From: Glowbal Date: Mon, 7 Nov 2016 05:36:00 +0100 Subject: [PATCH] feat(container-details): show list of joined networks (#303) - Add overview of joined networks in container view - Add option ot leave a joined network --- app/components/container/container.html | 31 +++++++++++++++++++ .../container/containerController.js | 21 +++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/app/components/container/container.html b/app/components/container/container.html index e26bfa7f0..801898ff2 100644 --- a/app/components/container/container.html +++ b/app/components/container/container.html @@ -202,3 +202,34 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + +
Network NameIP AddressGatewayMacAddressActions
{{ key }}{{ value.IPAddress || '-' }}{{ value.Gateway || '-' }}{{ value.MacAddress || '-' }} + +
+
+
+
+
diff --git a/app/components/container/containerController.js b/app/components/container/containerController.js index 94a23a05d..1c4f78cb9 100644 --- a/app/components/container/containerController.js +++ b/app/components/container/containerController.js @@ -1,6 +1,6 @@ angular.module('container', []) -.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Messages', -function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Messages) { +.controller('ContainerController', ['$scope', '$state','$stateParams', '$filter', 'Container', 'ContainerCommit', 'ImageHelper', 'Network', 'Messages', +function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, ImageHelper, Network, Messages) { $scope.activityTime = 0; $scope.portBindings = []; $scope.config = { @@ -153,5 +153,22 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Ima $scope.container.edit = false; }; + $scope.containerLeaveNetwork = function containerLeaveNetwork(container, networkId) { + $('#loadingViewSpinner').show(); + Network.disconnect({id: networkId}, { Container: $stateParams.id, Force: false }, function (d) { + if (d.message) { + $('#loadingViewSpinner').hide(); + Messages.send("Error", {}, d.message); + } else { + $('#loadingViewSpinner').hide(); + Messages.send("Container left network", $stateParams.id); + $state.go('network', {id: network.Id}, {reload: true}); + } + }, function (e) { + $('#loadingViewSpinner').hide(); + Messages.error("Failure", e, "Unable to disconnect container from network"); + }); + }; + update(); }]);