Fix nova server networks config options

Enhance the user input modal of nova server networks tab.
1. Update property value options when change property type.
2. Delete error disabling when one config element is deleted.
3. Fix typo.

Change-Id: I69f641a1ded29372b330439ca1f2354509b70e6b
This commit is contained in:
Xinni Ge 2017-12-05 10:16:05 +09:00
parent 634ee20304
commit de02f3b331
3 changed files with 9 additions and 5 deletions

View File

@ -228,7 +228,7 @@
</md-input-container>
<md-input-container class="md-block" flex-gt-xs="45" ng-disabled="record.allocate_network.length > 0 ">
<label>Specify Property</label>
<md-select ng-model="how2config_networks[$index]" ng-disabled="$ctrl.disable.networks[$index]">
<md-select ng-model="how2config_networks[$index]" ng-change="update_nwconfig($index)" ng-disabled="$ctrl.disable.networks[$index]">
<md-option value="network">network</md-option>
<md-option value="subnet">subnet</md-option>
<md-option value="port">port</md-option>

View File

@ -119,7 +119,7 @@
this.instance.block_device_mapping_v2 = [];
}
if (typeof this.instance.networks === 'undefined'){
this.instance.networks = [{}];
this.instance.networks = [];
}
this.disable = {
@ -427,7 +427,7 @@
}
return $scope.options.subnets.concat(resource_subnet);
}
return $scope.options.networks;
return $scope.options.subnets;
}
$scope.get_floatingips_options = function(){
if ('networks.floating_ip' in $scope.connected_options){
@ -561,8 +561,12 @@
for (var i = index; i < this.instance.networks.length; i=i+1){
$scope.how2config_networks[i] = $scope.how2config_networks[i+1];
}
delete $scope.how2config_networks[this.instance.networks.length];
this.instance.networks.splice(index, 1);
for (var i = index; i < this.instance.networks.length; i=i+1){
this.disable.networks[i] = this.disable.networks[i+1];
}
delete this.disable.networks[this.instance.networks.length];
}
this.add_networks = function(){
this.instance.networks.push({})

View File

@ -272,7 +272,7 @@
var $ctrl = $isolateScope.$ctrl;
$ctrl.add_networks();
expect($scope.resource.networks.length).toEqual(2);
expect($scope.resource.networks.length).toEqual(1);
});
it('networks should be successfully deleted', function() {