Fix up display of selected Availability zone in workflow.

Story: 2007882
Task: 40250

Change-Id: I196c6801f6dbd09913d2bf91e97bf390752f67c2
This commit is contained in:
Sam Morrison 2020-06-18 16:10:43 +10:00
parent 8bc9329b5f
commit d70f7b176a
4 changed files with 7 additions and 2 deletions

View File

@ -130,7 +130,7 @@
ctrl.setAvailabilityZone = function(option) {
if (option) {
$scope.model.spec.loadbalancer.availability_zone = option.name;
$scope.model.spec.loadbalancer.availability_zone = option;
} else {
$scope.model.spec.loadbalancer.availability_zone = null;
}

View File

@ -184,7 +184,7 @@
it('should set availability zone', function() {
ctrl.setAvailabilityZone(mockAvailabilityZones[0]);
expect(scope.model.spec.loadbalancer.availability_zone).toBe(mockAvailabilityZones[0].name);
expect(scope.model.spec.loadbalancer.availability_zone).toBe(mockAvailabilityZones[0]);
ctrl.setAvailabilityZone(null);
expect(scope.model.spec.loadbalancer.availability_zone).toBe(null);
});

View File

@ -481,6 +481,10 @@
finalSpec.loadbalancer.flavor_id = finalSpec.loadbalancer.flavor_id.id;
}
if (angular.isObject(finalSpec.loadbalancer.availability_zone)) {
finalSpec.loadbalancer.availability_zone = finalSpec.loadbalancer.availability_zone.name;
}
// Load balancer requires vip_subnet_id
if (!finalSpec.loadbalancer.vip_subnet_id) {
delete finalSpec.loadbalancer;

View File

@ -1600,6 +1600,7 @@
expect(finalSpec.loadbalancer.vip_address).toBe('1.2.3.4');
expect(finalSpec.loadbalancer.vip_subnet_id).toBe(model.subnets[0].id);
expect(finalSpec.loadbalancer.admin_state_up).toBe(true);
expect(finalSpec.loadbalancer.availability_zone).toBe('az_1');
expect(finalSpec.listener.name).toBeUndefined();
expect(finalSpec.listener.description).toBeUndefined();