1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(network): add advanced settings in network creation (subnet/gateway)

This commit is contained in:
Anthony Lapenna 2016-07-08 17:26:18 +12:00
parent d253c0d494
commit cab34e4069
2 changed files with 45 additions and 1 deletions

View file

@ -4,11 +4,20 @@ function ($scope, $state, Network, Messages, errorMsgFilter) {
$scope.state = {};
$scope.state.toggle = false;
$scope.state.selectedItemCount = 0;
$scope.state.advancedSettings = false;
$scope.sortType = 'Scope';
$scope.sortReverse = false;
$scope.formValues = {
Subnet: '',
Gateway: ''
};
$scope.config = {
Name: ''
Name: '',
IPAM: {
Config: []
}
};
$scope.order = function(sortType) {
@ -35,8 +44,20 @@ function ($scope, $state, Network, Messages, 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 prepareNetworkConfiguration() {
var config = angular.copy($scope.config);
prepareIPAMConfiguration(config);
config.Driver = 'overlay';
return config;
}