diff --git a/app/components/createNetwork/createNetworkController.js b/app/components/createNetwork/createNetworkController.js index f24622f07..56ffb79f6 100644 --- a/app/components/createNetwork/createNetworkController.js +++ b/app/components/createNetwork/createNetworkController.js @@ -2,13 +2,18 @@ angular.module('createNetwork', []) .controller('CreateNetworkController', ['$scope', '$state', 'Messages', 'Network', 'errorMsgFilter', function ($scope, $state, Messages, Network, errorMsgFilter) { $scope.formValues = { - DriverOptions: [] + DriverOptions: [], + Subnet: '', + Gateway: '' }; $scope.config = { Driver: 'bridge', CheckDuplicate: true, - Internal: false + Internal: false, + IPAM: { + Config: [] + } }; $scope.addDriverOption = function() { @@ -36,6 +41,17 @@ function ($scope, $state, Messages, Network, errorMsgFilter) { }); } + function prepareIPAMConfiguration(config) { + if ($scope.formValues.Subnet) { + var ipamConfig = {}; + ipamConfig.Subnet = $scope.formValues.Subnet; + if ($scope.formValues.Gateway) { + ipamConfig.Gateway = $scope.formValues.Gateway ; + } + config.IPAM.Config.push(ipamConfig); + } + } + function prepareDriverOptions(config) { var options = {}; $scope.formValues.DriverOptions.forEach(function (option) { @@ -46,6 +62,7 @@ function ($scope, $state, Messages, Network, errorMsgFilter) { function prepareConfiguration() { var config = angular.copy($scope.config); + prepareIPAMConfiguration(config); prepareDriverOptions(config); return config; } diff --git a/app/components/createNetwork/createnetwork.html b/app/components/createNetwork/createnetwork.html index f6f332270..31ed20d37 100644 --- a/app/components/createNetwork/createnetwork.html +++ b/app/components/createNetwork/createnetwork.html @@ -18,6 +18,18 @@ + +
+ +
+ +
+ +
+ +
+
+