feat(network): add advanced settings in network creation (subnet/gateway)
parent
d253c0d494
commit
cab34e4069
|
@ -23,6 +23,29 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- !name-input -->
|
<!-- !name-input -->
|
||||||
|
<!-- advanced-settings-input -->
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" ng-model="state.advancedSettings"> Show advanced settings
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- !advanced-settings-input -->
|
||||||
|
<!-- subnet-gateway-inputs -->
|
||||||
|
<div class="form-group" ng-if="state.advancedSettings">
|
||||||
|
<label for="network_subnet" class="col-sm-1 control-label text-left">Subnet</label>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<input type="text" class="form-control" ng-model="formValues.Subnet" id="network_subnet" placeholder="e.g. 172.20.0.0/16">
|
||||||
|
</div>
|
||||||
|
<label for="network_gateway" class="col-sm-1 control-label text-left">Gateway</label>
|
||||||
|
<div class="col-sm-5">
|
||||||
|
<input type="text" class="form-control" ng-model="formValues.Gateway" id="network_gateway" placeholder="e.g. 172.20.10.11">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- !subnet-gateway-inputs -->
|
||||||
<!-- tag-note -->
|
<!-- tag-note -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
|
|
|
@ -4,11 +4,20 @@ function ($scope, $state, Network, Messages, errorMsgFilter) {
|
||||||
$scope.state = {};
|
$scope.state = {};
|
||||||
$scope.state.toggle = false;
|
$scope.state.toggle = false;
|
||||||
$scope.state.selectedItemCount = 0;
|
$scope.state.selectedItemCount = 0;
|
||||||
|
$scope.state.advancedSettings = false;
|
||||||
$scope.sortType = 'Scope';
|
$scope.sortType = 'Scope';
|
||||||
$scope.sortReverse = false;
|
$scope.sortReverse = false;
|
||||||
|
|
||||||
|
$scope.formValues = {
|
||||||
|
Subnet: '',
|
||||||
|
Gateway: ''
|
||||||
|
};
|
||||||
|
|
||||||
$scope.config = {
|
$scope.config = {
|
||||||
Name: ''
|
Name: '',
|
||||||
|
IPAM: {
|
||||||
|
Config: []
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.order = function(sortType) {
|
$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() {
|
function prepareNetworkConfiguration() {
|
||||||
var config = angular.copy($scope.config);
|
var config = angular.copy($scope.config);
|
||||||
|
prepareIPAMConfiguration(config);
|
||||||
config.Driver = 'overlay';
|
config.Driver = 'overlay';
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue