Document changes in Dynamic UI
Patch adds more information to the docs about changes in Dynamic UI versions 2.1-2.3 to highlight new opportunities and gives a couple of examples of their usage by app developer. More precisely, usage of custom password validators and new network field are explained. Change-Id: I6e48362918bf4e455a1c830ac7ed14a3ed7d7165
This commit is contained in:
parent
5b85c6e8da
commit
595798b12a
|
@ -78,7 +78,7 @@ Version history
|
||||||
| | *name* field from class properties. | |
|
| | *name* field from class properties. | |
|
||||||
+---------+-------------------------------------------------------------------+-------------------+
|
+---------+-------------------------------------------------------------------+-------------------+
|
||||||
| 2.3 | - Now *password* field supports ``confirmInput`` flag and | Mitaka |
|
| 2.3 | - Now *password* field supports ``confirmInput`` flag and | Mitaka |
|
||||||
| | validator overloading with single ``regexValidator`` or | |
|
| | validator overloading with single ``regexpValidator`` or | |
|
||||||
| | multiple *validators* attribute. | |
|
| | multiple *validators* attribute. | |
|
||||||
+---------+-------------------------------------------------------------------+-------------------+
|
+---------+-------------------------------------------------------------------+-------------------+
|
||||||
|
|
||||||
|
@ -214,15 +214,15 @@ field attributes. The most common attributes are the following:
|
||||||
* **minLength**, **maxLength** (for string fields) and **minValue**,
|
* **minLength**, **maxLength** (for string fields) and **minValue**,
|
||||||
**maxValue** (for integer fields) are transparently translated into django
|
**maxValue** (for integer fields) are transparently translated into django
|
||||||
validation properties.
|
validation properties.
|
||||||
* **regexValidator** - regular expression to validate user input. Used with
|
* **regexpValidator** - regular expression to validate user input. Used with
|
||||||
*string* field.
|
*string* or *password* field.
|
||||||
* **errorMessages** - dictionary with optional 'invalid' and 'required' keys
|
* **errorMessages** - dictionary with optional 'invalid' and 'required' keys
|
||||||
that set up what message to show to the user in case of errors.
|
that set up what message to show to the user in case of errors.
|
||||||
* **validators** is a list of dictionaries, each dictionary should at least
|
* **validators** is a list of dictionaries, each dictionary should at least
|
||||||
have *expr* key, under that key either some
|
have *expr* key, under that key either some
|
||||||
`YAQL <https://git.openstack.org/cgit/openstack/yaql/tree/README.rst>`_
|
`YAQL <https://git.openstack.org/cgit/openstack/yaql/tree/README.rst>`_
|
||||||
expression is stored, either one-element dictionary with *regexValidator* key
|
expression is stored, either one-element dictionary with *regexpValidator*
|
||||||
(and some regexp string as value).
|
key (and some regexp string as value).
|
||||||
Another possible key of a validator dictionary is *message*, and although
|
Another possible key of a validator dictionary is *message*, and although
|
||||||
it is not required, it is highly desirable to specify it - otherwise, when
|
it is not required, it is highly desirable to specify it - otherwise, when
|
||||||
validator fails (i.e. regexp doesn't match or YAQL expression evaluates to
|
validator fails (i.e. regexp doesn't match or YAQL expression evaluates to
|
||||||
|
@ -250,6 +250,33 @@ field attributes. The most common attributes are the following:
|
||||||
Just letters, numbers and dashes are allowed.
|
Just letters, numbers and dashes are allowed.
|
||||||
A dot can be used to create subdomains
|
A dot can be used to create subdomains
|
||||||
|
|
||||||
|
Using of *regexpValidator* and *validators* attributes with *password*
|
||||||
|
field was introduced in version 2.3. By default, password should have at
|
||||||
|
least 7 characters, 1 capital letter, 1 non-capital letter, 1 digit, and 1
|
||||||
|
special character. If you do not want password validation to be so strong,
|
||||||
|
you can override it by setting a custom validator or multiple validators for
|
||||||
|
password. For that add *regexpValidator* or *validators* to the *password*
|
||||||
|
field and specify custom regexp string as value, just like with any *string*
|
||||||
|
field.
|
||||||
|
|
||||||
|
*Example*
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
- name: password
|
||||||
|
type: password
|
||||||
|
label: Password
|
||||||
|
descriptionTitle: Password
|
||||||
|
description: >-
|
||||||
|
Please, provide password for the application. Password should be
|
||||||
|
5-50 characters long and consist of alphanumeric characters
|
||||||
|
regexpValidator: '^[a-zA-Z0-9]{5,50}?$'
|
||||||
|
|
||||||
|
* **confirmInput** is a flag used only with password field and defaults to
|
||||||
|
``true``. If you decided to turn off automatic password field cloning, you
|
||||||
|
should set it to ``false``. In this case password confirmation is not
|
||||||
|
required from a user.
|
||||||
|
|
||||||
* **widgetMedia** sets some custom *CSS* and *JavaScript* used for the field's
|
* **widgetMedia** sets some custom *CSS* and *JavaScript* used for the field's
|
||||||
widget rendering. Note, that files should be placed to Django static folder
|
widget rendering. Note, that files should be placed to Django static folder
|
||||||
in advance. Mostly they are used to do some client-side field
|
in advance. Mostly they are used to do some client-side field
|
||||||
|
@ -306,6 +333,27 @@ field attributes. The most common attributes are the following:
|
||||||
network. For use-cases where such behavior is not desired, this parameter
|
network. For use-cases where such behavior is not desired, this parameter
|
||||||
should be set to ``False``.
|
should be set to ``False``.
|
||||||
|
|
||||||
|
*Network* field and its specific attributes (*include_subnets*, *filter*,
|
||||||
|
*murano_networks*, *allow_auto*) are available since version 2.1.
|
||||||
|
Before that, there was no way for the end user to select existing network in
|
||||||
|
the UI. The only way to change the default networking behavior was the usage
|
||||||
|
of networking.yaml file. It allows to override the networking setting at
|
||||||
|
the environment level, for all the murano environments of all the tenants.
|
||||||
|
Now you can simple add a *network* field to your form definition and provide
|
||||||
|
the ability to select the desired network for the specific application.
|
||||||
|
|
||||||
|
*Example*
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
|
||||||
|
- instanceConfiguration:
|
||||||
|
fields:
|
||||||
|
- name: network
|
||||||
|
type: network
|
||||||
|
label: Network
|
||||||
|
description: Select a network to join. 'Auto' corresponds to a default environment's network.
|
||||||
|
murano_networks: translate
|
||||||
|
|
||||||
Besides field-level validators, form-level validators also exist. They
|
Besides field-level validators, form-level validators also exist. They
|
||||||
use **standard context** for YAQL evaluation and are required when
|
use **standard context** for YAQL evaluation and are required when
|
||||||
there is a need to validate some form's constraint across several
|
there is a need to validate some form's constraint across several
|
||||||
|
|
Loading…
Reference in New Issue