
This commit introduces ref(templateName [, parameterName] [, idOnly]) YAQL function was added to UI definition DSL. This function evaluates template templateName and fixes the result in parameters under parameterName key (or templateName if the second parameter was omitted). Then it generates object ID and places it into ?/id field. On the first use of parameterName or if idOnly is false the function will return the whole object structure. On subsequent calls or if idOnly is true it will return the ID that was generated upon the first call. Thus the function brings ability to reference single object several times. ID generation is done in a safe way with a special temporary type that wraps string ID and replaced with string representation upon serialization. This way it is still impossible for a developer to explicitly provide ID value in the template (it is still going to be overwritten because it is not of an ObjectID type and it is impossible to create instance of ObjectID from yaql expression) Change-Id: Idf114113a73d00ab2132bd085157ca01e94dae3e
46 lines
2.4 KiB
YAML
46 lines
2.4 KiB
YAML
---
|
|
features:
|
|
- >
|
|
New section ``Parameters`` was added to UI definition markup. Parameters
|
|
is a key-value storage, whose values are available as YAQL variables. Thus
|
|
if the section has a key ``var`` its value can be retrieved using ``$var``
|
|
syntax and used anywhere in the markup - both as a field attribute values
|
|
and in Application/Templates sections. Parameter values can be a YAQL
|
|
expressions. The difference between Templates and Parameters is that
|
|
Parameters are evaluated once before form render whereas Templates are
|
|
evaluated on each access.
|
|
|
|
- >
|
|
It is possible to specify static action (MuranoPL method) that is going to
|
|
be called before form is rendered. This allows MuranoPL class to provide
|
|
parameter values to the form. Because parameters can be used as initial
|
|
control values this also allows to have dynamic content in the form.
|
|
Parameters source method can be specified in ``ParametersSource`` attribute
|
|
of UI definition markup: ``ParametersSource: com.namespace.MyClass.myMethod``.
|
|
If class name is not specified dashboard will try to infer it from the
|
|
``Application`` section or the package FQN.
|
|
If specified, static action must be present in one of the classes in the
|
|
same package that was used to obtain UI definition file. The method
|
|
must return a dictionary which will be combined with Parameters that are
|
|
already present in the file.
|
|
|
|
- >
|
|
``ref(templateName [, parameterName] [, idOnly])`` YAQL function was added
|
|
to UI definition DSL. This function evaluates template ``templateName`` and
|
|
fixes the result in parameters under ``parameterName`` key (or
|
|
``templateName`` if the second parameter was omitted). Then it generates
|
|
object ID and places it into ``?/id`` field. On the first use of
|
|
``parameterName`` or if ``idOnly`` is ``false`` the function will return
|
|
the whole object structure. On subsequent calls or if ``idOnly`` is
|
|
``true`` it will return the ID that was generated upon the first call.
|
|
Thus the function brings ability to reference single object several times.
|
|
|
|
- >
|
|
``choice`` field type now can accept list of choices in a form of
|
|
dictionary. I.e. in addition to ``[[key1, value1], [key2, value2]]`` one
|
|
can provide ``{key1: value1, key2: value2}``
|
|
|
|
- >
|
|
UI definition version was bumped to ``2.4``. If application is going to
|
|
use Parameters it should indicate it by setting the version in UI file.
|