Components are re-usable so you can have many instances of the same component with different settings for the custom fields each one hassettings. You can add/, remove and change custom fields for each component:.
Custom fields are defined in the config.json
file within each component Translator. Once created, these fields can be managed directly from the component card, allowing users to configure runtime values for the component.
Expand |
---|
title | Step1 - STEP 1: In the translator click on config.json to open create and edit the custom fields |
---|
|
Image AddedUse the config. | Image Removedjson file in the Translator to create custom fields and assign default values. Click on config.json in the project tree. Click EDIT to edit the fields and optionally include default values.
|
Expand |
---|
title | Step STEP 2 - : Add a test field and save. |
---|
|
Image Removed |
Image Added
Create your custom field: Field Name: TestField is the name of the configuration or custom field. Field Type: Choose a value type. This can be: String: One or more characters of text. Bool: True or False dropdown value. File: Browse to a local file stored on disk. Folder: Browse to a local directory path. List: A dropdown list for choosing from predefined options (comma delimited list). Number: Integers or decimals. Password: A secure field for entering and masking sensitive text like passwords or tokens. Port: A network port number.
Default Value: Optionally add a default value. This will appear on the component card where you can edit the custom field values used when the script runs.
Image Added |
Expand |
---|
title | Step STEP 3 - : Commit these changes by pressing the commit button. |
---|
|
Image RemovedNOTE: |
Image Added Panel |
---|
panelIconId | atlassian-warning |
---|
panelIcon | :warning: |
---|
bgColor | #FFFAE6 |
---|
| If you do not want to commit these changes, you can change the Using Commit: to | DEVELOPER, DEVELOPMENT in the next step | , so it will use the changes made in the translator without a commit. |
|
Expand |
---|
title | Step STEP 4 - : Exit the translator and change the commit to the new one or select Development mode |
---|
|
Image RemovedNOTE: Image AddedClick the ellipses to change the commit. If you do not want to commit these the changes you made, you can change the Using Commit: to DEVELOPER DEVELOPMENT so it will use the changes made in the translator without a commit.
|
...
The custom field you created in the translator, TestField, now shows up. Now we can change and manage the custom field values for the component to use during runtime.
|
Additional Information:
Expand |
---|
title | How does the Lua script get access to the fields |
---|
|
To get programatic access of the values of the custom fields, there is this api call: Code Block |
---|
| local Fields = component.fields(); |
This returns a Lua table with the custom fields and their values for the component. |
...
Expand |
---|
title | Where are the custom field values defined for each component |
---|
|
title | What is the format of config.json - the definition for the Custom Field values set in the component card are encrypted and stored locally in an encrypted filecomponents.json file in the component configuration directory. Code Block |
---|
<instance<working root>directory>/IguanaXconfig/configurations/fieldscomps/<component guid>/component.json |
See Custom Fields Configuration File for more information. |
---|
Expand |
---|
Expand |
---|
title | The Count library is a useful library which takes advantage of custom fields to do a custom incrementing counter |
---|
|
The custom fields and default values | in each component
This is what the format looks like: Code Block |
---|
| {
"fields": [
{
"default": "/ff/",
"name": "Folder",
"type": "folder"
},
{
"default": "fdsf",
"name": "File",
"type": "file"
},
{
"default": "",
"name": "String",
"type": "string"
},
{
"default": "1",
"name": "Number",
"type": "number"
},
{
"default": "true",
"name": "Boolean",
"type": "bool"
},
{
"default": "",
"name": "Password",
"type": "password"
},
{
"default": "",
"name": "Port",
"type": "port"
}
]
} |
|
See COUNT Library , stored in config.json are stored in the component repository files and checked into Git. See Component Configuration Files. |