Merge "Add hide_create_volume to LAUNCH_INSTANCE_DEFAULTS"

This commit is contained in:
Zuul 2018-10-02 14:11:49 +00:00 committed by Gerrit Code Review
commit 741624d3f1
5 changed files with 46 additions and 2 deletions

View File

@ -1965,6 +1965,10 @@ LAUNCH_INSTANCE_DEFAULTS
Added the ``create_volume`` option.
.. versionchanged:: 15.0.0(Stein)
Added the ``hide_create_volume`` option.
Default:
.. code-block:: python
@ -1972,6 +1976,7 @@ Default:
{
"config_drive": False,
"create_volume": True,
"hide_create_volume": False,
"disable_image": False,
"disable_instance_snapshot": False,
"disable_volume": False,
@ -2002,6 +2007,17 @@ Default: ``True``
This setting allows you to specify the default value for the option of creating
a new volume in the workflow for image and instance snapshot sources.
hide_create_volume
##################
.. versionadded:: 15.0.0(Stein)
Default: ``False``
This setting allow your to hide the "Create New Volume" option and rely on the
default value you select with ``create_volume`` to be the most suitable for your
users.
disable_image
#############

View File

@ -203,6 +203,7 @@
source: [],
create_volume_default: true,
// REQUIRED for JS logic
hide_create_volume: false,
vol_create: false,
// May be null
vol_device_name: 'vda',
@ -297,6 +298,9 @@
// Append "_default" to distinguish from the 'vol_create' item
model.newInstanceSpec.create_volume_default = defaults.create_volume;
}
if ('hide_create_volume' in defaults) {
model.newInstanceSpec.hide_create_volume = defaults.hide_create_volume;
}
}
/**

View File

@ -160,6 +160,7 @@
settings = {
LAUNCH_INSTANCE_DEFAULTS: {
create_volume: true,
hide_create_volume: false,
config_drive: false,
disable_image: false,
disable_instance_snapshot: false,
@ -512,6 +513,22 @@
expect(model.newInstanceSpec.create_volume_default).toBe(false);
});
it('should default hide_create_volume to false if setting not provided', function() {
delete settings.LAUNCH_INSTANCE_DEFAULTS.hide_create_volume;
model.initialize(true);
scope.$apply();
expect(model.newInstanceSpec.hide_create_volume).toBe(false);
});
it('should default hide_create_volume to true based on setting', function() {
settings.LAUNCH_INSTANCE_DEFAULTS.hide_create_volume = true;
model.initialize(true);
scope.$apply();
expect(model.newInstanceSpec.hide_create_volume).toBe(true);
});
it('should not set availability zone if the zone list is empty', function () {
spyOn(novaApi, 'getAvailabilityZones').and.callFake(function () {
var deferred = $q.defer();
@ -825,7 +842,7 @@
// This is here to ensure that as people add/change items, they
// don't forget to implement tests for them.
it('has the right number of properties', function() {
expect(Object.keys(model.newInstanceSpec).length).toBe(22);
expect(Object.keys(model.newInstanceSpec).length).toBe(23);
});
it('sets availability zone to null', function() {

View File

@ -24,7 +24,7 @@
<div ng-if="(model.newInstanceSpec.source_type.type === 'image' ||
model.newInstanceSpec.source_type.type === 'snapshot') &&
model.allowCreateVolumeFromImage">
model.allowCreateVolumeFromImage && !model.newInstanceSpec.hide_create_volume">
<div class="col-xs-6">
<div class="form-group">
<label for="vol-create" translate>Create New Volume</label><br/>

View File

@ -0,0 +1,7 @@
---
features:
- Added a new ``hide_create_volume`` setting under the
``LAUNCH_INSTANCE_DEFAULTS`` dict. This allows you to hide the
"Create New Volume" option in the "Launch Instance" form and instead rely
on the default value you select with ``create_volume`` is the best suitable
option for your users.