summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Mooney <sean.k.mooney@intel.com>2016-05-25 21:18:47 +0100
committerRob Cresswell <robert.cresswell@outlook.com>2016-09-25 19:28:18 +0000
commit58698541faaaee23f333ef45939fe10fe5687501 (patch)
tree7545354b708712cdd23c7266f37adde4a4223187
parent74c9c152fe1fbb093c71f808ff898f576a5c71e9 (diff)
Fix Launch Instance without Cinder
A previous patch altered the defaults in the angular Launch Instance, but didn't account for those running without Cinder. This patch fixes those assumptions. Co-Authored-By: Rob Cresswell <robert.cresswell@outlook.com> Change-Id: I8dc54fa40fa7eb8ae95a13741405f2a80337b33d Closes-Bug: 1585761 (cherry picked from commit 723e547e848f580bf5f16899cd2bffa23c77c763)
Notes
Notes (review): Code-Review+2: David Lyle <dklyle0@gmail.com> Workflow+1: David Lyle <dklyle0@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 27 Sep 2016 19:48:40 +0000 Reviewed-on: https://review.openstack.org/376039 Project: openstack/horizon Branch: refs/heads/stable/newton
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js2
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js2
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js6
-rw-r--r--openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js14
4 files changed, 19 insertions, 5 deletions
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
index 50f81ac..0dc96d0 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
@@ -182,7 +182,7 @@
182 source_type: null, 182 source_type: null,
183 source: [], 183 source: [],
184 // REQUIRED for JS logic 184 // REQUIRED for JS logic
185 vol_create: true, 185 vol_create: false,
186 // May be null 186 // May be null
187 vol_device_name: 'vda', 187 vol_device_name: 'vda',
188 vol_delete_on_instance_delete: false, 188 vol_delete_on_instance_delete: false,
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
index 9e8f6c3..70d686d 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
@@ -814,7 +814,7 @@
814 }); 814 });
815 815
816 it('sets volume options appropriately', function() { 816 it('sets volume options appropriately', function() {
817 expect(model.newInstanceSpec.vol_create).toBe(true); 817 expect(model.newInstanceSpec.vol_create).toBe(false);
818 expect(model.newInstanceSpec.vol_device_name).toBe('vda'); 818 expect(model.newInstanceSpec.vol_device_name).toBe('vda');
819 expect(model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false); 819 expect(model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
820 expect(model.newInstanceSpec.vol_size).toBe(1); 820 expect(model.newInstanceSpec.vol_size).toBe(1);
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
index 6e28352..6a18e24 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
@@ -401,7 +401,11 @@
401 401
402 function updateBootSourceSelection(selectedSource) { 402 function updateBootSourceSelection(selectedSource) {
403 ctrl.currentBootSource = selectedSource; 403 ctrl.currentBootSource = selectedSource;
404 $scope.model.newInstanceSpec.vol_create = true; 404 if ((selectedSource === bootSourceTypes.IMAGE) && $scope.model.volumeBootable) {
405 $scope.model.newInstanceSpec.vol_create = true;
406 } else {
407 $scope.model.newInstanceSpec.vol_create = false;
408 }
405 $scope.model.newInstanceSpec.vol_delete_on_instance_delete = false; 409 $scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
406 changeBootSource(selectedSource); 410 changeBootSource(selectedSource);
407 validateBootSourceType(); 411 validateBootSourceType();
diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js
index cbef3b0..70f6b57 100644
--- a/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js
+++ b/openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js
@@ -229,12 +229,12 @@
229 var tableKeys = ['available', 'allocated', 229 var tableKeys = ['available', 'allocated',
230 'displayedAvailable', 'displayedAllocated']; 230 'displayedAvailable', 'displayedAllocated'];
231 231
232 it('updates the scope appropriately', function() { 232 it('updates the scope appropriately, without Cinder available', function() {
233 var selSource = 'image'; 233 var selSource = 'image';
234 ctrl.updateBootSourceSelection(selSource); 234 ctrl.updateBootSourceSelection(selSource);
235 235
236 expect(ctrl.currentBootSource).toEqual('image'); 236 expect(ctrl.currentBootSource).toEqual('image');
237 expect(scope.model.newInstanceSpec.vol_create).toBe(true); 237 expect(scope.model.newInstanceSpec.vol_create).toBe(false);
238 expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false); 238 expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
239 239
240 // check table data 240 // check table data
@@ -244,6 +244,16 @@
244 expect(ctrl.tableBodyCells.length).toBeGreaterThan(0); 244 expect(ctrl.tableBodyCells.length).toBeGreaterThan(0);
245 }); 245 });
246 246
247 it('updates the scope appropriately, with Cinder available', function() {
248 scope.model.volumeBootable = true;
249 var selSource = 'image';
250 ctrl.updateBootSourceSelection(selSource);
251
252 expect(ctrl.currentBootSource).toEqual('image');
253 expect(scope.model.newInstanceSpec.vol_create).toBe(true);
254 expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
255 });
256
247 it('should broadcast event when boot source changes', function() { 257 it('should broadcast event when boot source changes', function() {
248 spyOn(scope, '$broadcast'); 258 spyOn(scope, '$broadcast');
249 scope.$apply(); 259 scope.$apply();