Merge "Make default visibility option on create image modal configurable"

This commit is contained in:
Jenkins 2017-08-09 16:40:05 +00:00 committed by Gerrit Code Review
commit 9603ee9f24
4 changed files with 39 additions and 1 deletions

View File

@ -917,6 +917,26 @@ by cinder. Currently only the backup service is available.
Glance
------
CREATE_IMAGE_DEFAULTS
~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 12.0.0(Pike)
Default:
.. code-block:: python
{
'image_visibility': "public",
}
A dictionary of default settings for create image modal.
The ``image_visibility`` setting specifies the default visibility option.
Valid values are ``"public"`` and ``"private"``. By default, the visibility
option is public on create image modal. If it's set to ``"private"``, the
default visibility option is private.
HORIZON_IMAGES_ALLOW_UPLOAD
~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -417,6 +417,11 @@ IMAGE_RESERVED_CUSTOM_PROPERTIES = []
# configuration and policies allow setting locations.
#IMAGES_ALLOW_LOCATION = False
# A dictionary of default settings for create image modal.
#CREATE_IMAGE_DEFAULTS = {
# 'image_visibility': "public",
#}
# OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints
# in the Keystone service catalog. Use this setting when Horizon is running
# external to the OpenStack environment. The default is 'publicURL'.
@ -820,7 +825,8 @@ SECURITY_GROUP_RULES = {
REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES',
'LAUNCH_INSTANCE_DEFAULTS',
'OPENSTACK_IMAGE_FORMATS',
'OPENSTACK_KEYSTONE_DEFAULT_DOMAIN']
'OPENSTACK_KEYSTONE_DEFAULT_DOMAIN',
'CREATE_IMAGE_DEFAULTS']
# Additional settings can be made available to the client side for
# extensibility by specifying them in REST_API_ADDITIONAL_SETTINGS

View File

@ -119,6 +119,8 @@
var settingsFormats = response.OPENSTACK_IMAGE_FORMATS;
var uploadMode = response.HORIZON_IMAGES_UPLOAD_MODE;
var dupe = angular.copy(imageFormats);
var imageDefaults = response.CREATE_IMAGE_DEFAULTS;
angular.forEach(dupe, function stripUnknown(name, key) {
if (settingsFormats.indexOf(key) === -1) {
delete dupe[key];
@ -136,6 +138,9 @@
ctrl.image.source_type = 'url';
}
ctrl.imageFormats = dupe;
if (imageDefaults && imageDefaults.image_visibility === "private") {
ctrl.image.visibility = "private";
}
}
function isLocalFileUpload() {

View File

@ -0,0 +1,7 @@
---
features:
- |
Added a new setting CREATE_IMAGE_DEFAULTS(dictionary) to configure the
default options shown on create image modal. By default, the visibility
option is public on create image modal. If ``image_visibility`` in this
setting is set to ``"private"``, the default visibility option is private.