From d70f7b176af406aafbd6a5579eba4ee7b89bd22b Mon Sep 17 00:00:00 2001 From: Sam Morrison Date: Thu, 18 Jun 2020 16:10:43 +1000 Subject: [PATCH] Fix up display of selected Availability zone in workflow. Story: 2007882 Task: 40250 Change-Id: I196c6801f6dbd09913d2bf91e97bf390752f67c2 --- .../lbaasv2/workflow/loadbalancer/loadbalancer.controller.js | 2 +- .../workflow/loadbalancer/loadbalancer.controller.spec.js | 2 +- .../dashboard/project/lbaasv2/workflow/model.service.js | 4 ++++ .../dashboard/project/lbaasv2/workflow/model.service.spec.js | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.js index 40d67287..27e33107 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.js +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.js @@ -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; } diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.spec.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.spec.js index a3c3ad67..5bf6f8b4 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.spec.js +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/loadbalancer/loadbalancer.controller.spec.js @@ -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); }); diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js index 3c5a4eaa..d78188b1 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.js @@ -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; diff --git a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js index 59cba731..6070ff88 100644 --- a/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js +++ b/octavia_dashboard/static/dashboard/project/lbaasv2/workflow/model.service.spec.js @@ -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();