diff --git a/doc/source/configuration/settings.rst b/doc/source/configuration/settings.rst index b7fb253588..6e5f541b7e 100644 --- a/doc/source/configuration/settings.rst +++ b/doc/source/configuration/settings.rst @@ -898,6 +898,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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index 41596f398e..23412795af 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -410,6 +410,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'. @@ -813,7 +818,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 diff --git a/openstack_dashboard/static/app/core/images/steps/create-image/create-image.controller.js b/openstack_dashboard/static/app/core/images/steps/create-image/create-image.controller.js index cb683ba7f5..ec58a60a65 100644 --- a/openstack_dashboard/static/app/core/images/steps/create-image/create-image.controller.js +++ b/openstack_dashboard/static/app/core/images/steps/create-image/create-image.controller.js @@ -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() { diff --git a/releasenotes/notes/bug-1699144-configurable-image-visibility-fda69cb25d960efb.yaml b/releasenotes/notes/bug-1699144-configurable-image-visibility-fda69cb25d960efb.yaml new file mode 100644 index 0000000000..8590e7b168 --- /dev/null +++ b/releasenotes/notes/bug-1699144-configurable-image-visibility-fda69cb25d960efb.yaml @@ -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.