Merge "Fix Launch Instance without Cinder"

changes/01/375301/3
Jenkins 6 years ago committed by Gerrit Code Review
commit 57140ceb6f
  1. 2
      openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.js
  2. 2
      openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/launch-instance-model.service.spec.js
  3. 6
      openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.js
  4. 14
      openstack_dashboard/dashboards/project/static/dashboard/project/workflow/launch-instance/source/source.controller.spec.js

@ -182,7 +182,7 @@
source_type: null,
source: [],
// REQUIRED for JS logic
vol_create: true,
vol_create: false,
// May be null
vol_device_name: 'vda',
vol_delete_on_instance_delete: false,

@ -814,7 +814,7 @@
});
it('sets volume options appropriately', function() {
expect(model.newInstanceSpec.vol_create).toBe(true);
expect(model.newInstanceSpec.vol_create).toBe(false);
expect(model.newInstanceSpec.vol_device_name).toBe('vda');
expect(model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
expect(model.newInstanceSpec.vol_size).toBe(1);

@ -401,7 +401,11 @@
function updateBootSourceSelection(selectedSource) {
ctrl.currentBootSource = selectedSource;
$scope.model.newInstanceSpec.vol_create = true;
if ((selectedSource === bootSourceTypes.IMAGE) && $scope.model.volumeBootable) {
$scope.model.newInstanceSpec.vol_create = true;
} else {
$scope.model.newInstanceSpec.vol_create = false;
}
$scope.model.newInstanceSpec.vol_delete_on_instance_delete = false;
changeBootSource(selectedSource);
validateBootSourceType();

@ -229,12 +229,12 @@
var tableKeys = ['available', 'allocated',
'displayedAvailable', 'displayedAllocated'];
it('updates the scope appropriately', function() {
it('updates the scope appropriately, without Cinder available', function() {
var selSource = 'image';
ctrl.updateBootSourceSelection(selSource);
expect(ctrl.currentBootSource).toEqual('image');
expect(scope.model.newInstanceSpec.vol_create).toBe(true);
expect(scope.model.newInstanceSpec.vol_create).toBe(false);
expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
// check table data
@ -244,6 +244,16 @@
expect(ctrl.tableBodyCells.length).toBeGreaterThan(0);
});
it('updates the scope appropriately, with Cinder available', function() {
scope.model.volumeBootable = true;
var selSource = 'image';
ctrl.updateBootSourceSelection(selSource);
expect(ctrl.currentBootSource).toEqual('image');
expect(scope.model.newInstanceSpec.vol_create).toBe(true);
expect(scope.model.newInstanceSpec.vol_delete_on_instance_delete).toBe(false);
});
it('should broadcast event when boot source changes', function() {
spyOn(scope, '$broadcast');
scope.$apply();

Loading…
Cancel
Save