Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Components are re-usable so you can have many instances of the same component with different settings for the custom fields each one has. You can add/remove and change custom fields for each component:

Expand
titleHave an editable component and enter the translator.
Image Removed

Expand
titleClick Step1 - In the translator click on config.json to open and edit the custom fields.
Expand
titleStep 2 - Add a test field and save.
Expand
titleStep 3 - Commit these changes by pressing the commit button.

NOTE: If you do not want to commit these changes, you can change the Using Commit: to DEVELOPER, in the next step,so it will use the changes made in the translator without a commit.

Expand
titleStep 4 - Exit the translator and change the commit to the new one .or select Development mode

NOTE: If you do not want to commit these changes, you can change the Using Commit: to DEVELOPER so it will use the changes made in the translator without a commit.

Video and Configurations about Custom Fields

One of the big improvements in Iguana X is ability to define custom fields on components. These are intended to make it easy to build re-usable components that can be configured by operations staff:

...

These fields are defined such that:

  • The definition of the fields is part of the component and stored in configuration file called config.json

  • The values of these fields is part of the operation configuration of each component

    • This means a component can be used many times and have different configurations

For example on the component card we can see the configuration fields:

...

The values are stored as part of the /wiki/spaces/DEVELOPMEN/pages/2318368811 here:

<instance>/componentsSome more information:

Expand
titleHow 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
languagelua
local Fields = component.fields();

This returns a Lua table with the custom fields and their values for the component.

Expand
titleWhere are the custom field values defined for each component

<instance root>/IguanaX/configurations/fields/<component guid>.json

For example:

Code Block
languagejson
{
    "fields": {
        "Folder": "/Folder/",
        "Number": "1e3",
        "Password": "4E4D90C9F91E21FCD59F9F31D88F71FB",
        "Port": "64000",
        "String": "A String"
    }
}

As mentioned - there could be many instances of a component with different configuration files. Notice some fields are not present?

These will have default values which are defined in the config.json in the translator. This is the GUI used to edit them. Notice the default value column?

...

Expand
titleWhat is the format of config.json the definition for for the fields in each component

This is what the format looks like:

Code Block
languagejson
{
    "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"
        }
    ]
}

To get programatic access of the values of the custom fields the best way is to use this Lua API:

Code Block
languagelua
local Fields = component.fields();

...