This guide explains how to work with Avro UI forms. Avro UI forms are GUI components in the Admin UI that allow you to create Kaa schemas and enter corresponding data records without using the Avro/JSON syntax.
This guide also explains how to use Avro UI forms GWT Sandbox, which is a testing environment for Avro UI forms.
Avro UI form types
There are two Avro UI form types: a schema form and a record form.
A schema form allows the user (tenant developer) to create Kaa schemas (profile, configuration, notification, and log schemas) for applications in Admin UI.
It consists of a header with the general schema info, such as the name, namespace, and display name, and the Fields section where you can add fields to your schema.
You can also upload a schema from a file using the Upload from file option. In this case, the schema must be provided in the JSON format.
A record form allows the user (tenant developer) to enter data records according to corresponding Kaa schemas (configuration and notification schemas) for applications in Admin UI.
A record form contains the fields according to the corresponding schema.
You can also upload data from a file using the Upload from file option. In this case, the data must be provided in the JSON format.
Working with schema form
An example of a schema form usage is creating a new configuration schema.
- Open the Configuration schemas window for some application in Admin UI and then click Add schema.
- In the Configuration schema schema form, specify the name, namespace, and display name of the record.
- To add a new field, click Add in the Fields section in the form.
- On the Add new Field page of the form, specify the field parameters as required and select the field type.
- Depending on the selected field type, specify additional parameters for the field.
- Click Add to finish adding the field.
- In a similar way, add as many fields as necessary and then save the schema (see Administration UI guide for details).
Working with record form
An example of a record form usage is adding new configuration data to an endpoint group.
- Open the Endpoint groups window for some application in Admin UI and click on some endpoint group.
- Scroll down to the Configurations form and then click Add configuration.
- Specify the field values in the Configuration body record form and then click Save to save the configuration.
- To apply the new configuration, click Activate.
Avro UI forms GWT Sandbox
Avro UI forms GWT Sandbox is a tool for testing Avro UI forms. It allows you to create an Avro schema using the schema form (or adding a schema in the Avro format) and see what the corresponding record form will look like.
To start using this tool, install and run Kaa Sandbox at first and then go to the following URL (by default): http://127.0.0.1:8080/avroUiSandbox/.
To generate an Avro UI record form, proceed as follows:
- Create an Avro schema in the schema form or, alternatively, click Upload from JSON and paste your schema into the text field.
- Click Generate form.
(Optional) To view the generated schema in the JSON format, click Show JSON under the schema form.
To view the JSON record for the data from the record form, enter some data into the field(s) and click Show JSON.
To upload data from the JSON record into the record form, click Upload from JSON, then enter the data into the text field in the JSON format and click Upload.
Avro schema parameters
If the Avro schema is added in the JSON format rather than via GUI, the following parameters of the schema determine the layout and values displayed on the Avro UI record form.
- displayName - displays the name of the field on UI
- displayNames - displays the name of each enumeration symbol on UI (only for enumeration fields in the schema)
- displayPrompt - displays the text prompt for the field on UI
- by_default - displays the default value of the field on UI
- minRowCount - defines a minimum number of rows in a UI table (only for arrays in the schema)
- optional - defines whether the field on UI is optional or mandatory
- weight - defines a relative width of the corresponding column on UI (only for arrays in the schema)
- keyIndex - defines the order in which the fields of a record are displayed in a row (only for arrays of records in the schema; integer; if this parameter is defined selectively for specific fields of the record, the other fields of the record will not be displayed)
- overrideStrategy - defines how to merge arrays in the configuration across the endpoint groups (only for arrays in the schema; accepted values are "replace" and "append"; "replace" by default)
- fieldAccess - defines the viewing and editing restrictions for the field (accepted values are "read_only", "editable" and "hidden"; "editable" by default)
- inputType - defines whether the characters will be masked or not when the user enters the field value (accepted values are "password" and "plain"; "plain" by default)
Use the following guides and references to make the most of Kaa.