diff --git a/app/components/networks/networks.html b/app/components/networks/networks.html index ea15fee48..d0b5c9fb0 100644 --- a/app/components/networks/networks.html +++ b/app/components/networks/networks.html @@ -7,93 +7,134 @@ Networks -
- - -
- -
-
- -
- - Add network -
-
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - -
- - Name - - - - - - Id - - - - - - Scope - - - - - - Driver - - - - - - IPAM Driver - - - - - - IPAM Subnet - - - - - - IPAM Gateway - - - -
{{ network.Name|truncate:40}}{{ network.Id }}{{ network.Scope }}{{ network.Driver }}{{ network.IPAM.Driver }}{{ network.IPAM.Config[0].Subnet ? network.IPAM.Config[0].Subnet : '-' }}{{ network.IPAM.Config[0].Gateway ? network.IPAM.Config[0].Gateway : '-' }}
-
-
- +
+
+ + + + +
+ +
+ +
+ +
+
+ + +
+
+ Note: The network will be created using the overlay driver and will allow containers to communicate across the hosts of your cluster. +
+
+
+
+ Note: The network will be created using the bridge driver. +
+
+ +
+
+ + + +
+
+
+
+
+
+
+ +
+
+ + +
+ +
+
+ +
+ +
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Name + + + + + + Id + + + + + + Scope + + + + + + Driver + + + + + + IPAM Driver + + + + + + IPAM Subnet + + + + + + IPAM Gateway + + + +
{{ network.Name|truncate:40}}{{ network.Id }}{{ network.Scope }}{{ network.Driver }}{{ network.IPAM.Driver }}{{ network.IPAM.Config[0].Subnet ? network.IPAM.Config[0].Subnet : '-' }}{{ network.IPAM.Config[0].Gateway ? network.IPAM.Config[0].Gateway : '-' }}
+
+
+ +
diff --git a/app/components/networks/networksController.js b/app/components/networks/networksController.js index 8a5287286..74db23033 100644 --- a/app/components/networks/networksController.js +++ b/app/components/networks/networksController.js @@ -7,16 +7,34 @@ function ($scope, $state, Network, Config, Messages) { $scope.sortType = 'Name'; $scope.sortReverse = false; - $scope.formValues = { - Subnet: '', - Gateway: '' - }; - $scope.config = { Name: '', - IPAM: { - Config: [] + }; + + function prepareNetworkConfiguration() { + var config = angular.copy($scope.config); + if ($scope.swarm) { + config.Driver = 'overlay'; } + return config; + } + + $scope.createNetwork = function() { + $('#createNetworkSpinner').show(); + var config = prepareNetworkConfiguration(); + Network.create(config, function (d) { + if (d.message) { + $('#createNetworkSpinner').hide(); + Messages.error('Unable to create network', {}, d.message); + } else { + Messages.send("Network created", d.Id); + $('#createNetworkSpinner').hide(); + $state.go('networks', {}, {reload: true}); + } + }, function (e) { + $('#createNetworkSpinner').hide(); + Messages.error("Failure", e, 'Unable to create network'); + }); }; $scope.order = function(sortType) { @@ -72,5 +90,8 @@ function ($scope, $state, Network, Config, Messages) { }); } - fetchNetworks(); + Config.$promise.then(function (c) { + $scope.swarm = c.swarm; + fetchNetworks(); + }); }]);