All Products
Search
Document Center

DataWorks:Advanced feature: Define options for an extension

Last Updated:Nov 08, 2024

The developer of an extension can define options for the extension when the developer registers the extension. Users of the extension can configure the options based on their business requirements to implement custom process management in different workspaces. For example, the developer of an extension can define an option for the extension to specify the maximum length of SQL statements. Users of the extension can configure the option to specify different maximum lengths of SQL statements in different workspaces.

Background information

  • The options for an extension are defined by the developer of the extension during extension registration. Users of the extension can configure the options based on their business requirements in different workspaces.

    • For more information about how a developer registers an extension, see Preparation 2: Register an extension.

    • Before a user of an extension enables the extension, the user can configure the options for the extension by clicking Configure Extension Options in the Actions column on the Extension configuration page, as shown in the following figure.image

  • After an extension user such as a user that is assigned the Workspace Administrator role configures the options for an extension in a workspace, the developer of the extension can call the GetOptionValueForProject operation to obtain the configurations of the options.

Usage notes

The options for an extension and related UI text are defined by the developer of the extension. DataWorks is not responsible for risks that may be caused by the option content.

Supported components

The developer of an extension can use the following components to define options for the extension: text, single-line text field, multi-line text field, single-select drop-down box, multi-select drop-down box, check box, and radio button. The following figure shows the components.组件

Define options for an extension

When a developer registers an extension in the Register Extension dialog box, the developer can define options for the extension in the Options for Extension field in the JSON format.

{
    "type": "object",
    "properties": {

        "Unique component name": {
        "type": "string",
            "title": "For more information about how to configure this parameter, see the table in the Parameter parsing section.",
            "x-decorator": "For more information about how to configure this parameter, see the table in the Parameter parsing section.",
            "x-component": "For more information about how to configure this parameter, see the table in the Parameter parsing section.",
            "x-decorator-props": {
                "tooltip": "Description"
            },
            "x-component-props": {
                "dataSource": "For more information about how to configure this parameter, see the table in the Parameter parsing section.",
                "mode": "multiple"
            }
        }

    }
}

References:

Parameter parsing

Parameter

Component type

Value

title

Text

Text

Single-line text field

Single-line text field

Multi-line text field

Multi-line text field

Single-select drop-down box

Single-select drop-down box

Multi-select drop-down box

Multi-select drop-down box

Check box

Check box

Radio button

Radio button

x-decorator

Text

FormItem

Single-line text field

FormItem

Multi-line text field

FormItem

Single-select drop-down box

FormItem

Multi-select drop-down box

FormItem

Check box

FormItem

Radio button

FormItem

x-component

Text

PreviewText.Input

Single-line text field

Input

Multi-line text field

Input.TextArea

Single-select drop-down box

Select

Multi-select drop-down box

Select

Check box

Checkbox.Group

Radio button

Radio.Group

dataSource

Text

Optional

Single-line text field

Optional

Multi-line text field

Optional

Single-select drop-down box

Optional. Customize this component based on your business requirements. Make sure that the content of the value and label fields in each pair of braces {} is unique. The label field indicates the UI text that is displayed. The value field indicates the ID of the UI text. Sample code:

[{
    "value": "10001",
    "label": "opt1"
}, {
    "value": "10001",
    "label": "opt1"
}]

Multi-select drop-down box

Optional. Customize this component based on your business requirements. Make sure that the content of the value and label fields in each pair of braces {} is unique. The label field indicates the UI text that is displayed. The value field indicates the ID of the UI text. Sample code:

[{
    "value": "10001",
    "label": "opt1"
}, {
    "value": "10001",
    "label": "opt1"
}]

Check box

Optional. Customize this component based on your business requirements. Make sure that the content of the value and label fields in each pair of braces {} is unique. The label field indicates the UI text that is displayed. The value field indicates the ID of the UI text. Sample code:

[{
    "value": "10001",
    "label": "opt1"
}, {
    "value": "10001",
    "label": "opt1"
}]

Radio button

Optional. Customize this component based on your business requirements. Make sure that the content of the value and label fields in each pair of braces {} is unique. The label field indicates the UI text that is displayed. The value field indicates the ID of the UI text. Sample code:

[{
    "value": "10001",
    "label": "opt1"
}, {
    "value": "10001",
    "label": "opt1"
}]

Configuration example: Define an option to specify the maximum number of CUs that an SQL task consumes

The following figures show the process and result of configuring the CU consumption threshold for an SQL task.

cu阈值

JSON-formatted configurations for the option:

{
    "type": "object",
    "properties": {
        "cuNumber": {
            "type": "string",
            "title": "CU Threshold",
            "x-decorator": "FormItem",
            "x-component": "Input",
            "x-decorator-props": {
                "tooltip": "Enter the maximum number of CUs that an SQL task consumes"
            }
        }
    }
}

Configuration example: Use all seven types of components

The following figures show the process and result of configuring the usage of all seven types of components.

使用7类组件

JSON-formatted configurations for the option:

Note

If you want to use all seven types of components at a time, copy the following JSON data and modify the data based on your business requirements.

{
    "type":"object",
    "properties":{

        "text":{
            "type":"string",
            "title":"Text",
            "x-decorator":"FormItem",
            "x-component":"PreviewText.Input",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "default":"This is text information"
        },
        "input":{
            "type":"string",
            "title":"Single-line text field",
            "x-decorator":"FormItem",
            "x-component":"Input",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "x-component-props":{

            },
            "default":"This is the default value"
        },


        "textarea":{
            "type":"string",
            "title":"Multi-line text field",
            "x-decorator":"FormItem",
            "x-component":"Input.TextArea",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "x-component-props":{

            },
            "default":"This is the default value"
        },

        "select":{
            "type":"string",
            "title":"Single-select drop-down box",
            "x-decorator":"FormItem",
            "x-component":"Select",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "x-component-props":{
                "dataSource":[
                    {
                        "value":"10001",
                        "label":"opt1"
                    },
                    {
                        "value":10002,
                        "label":"opt2"
                    },
                    {
                        "value":10003,
                        "label":"opt3",
                        "disabled":true
                    }
                ]
            },
            "default":"10001"
        },

        "selectmore":{
            "type":"string",
            "title":"Multi-select drop-down box",
            "x-decorator":"FormItem",
            "x-component":"Select",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "x-component-props":{
                "dataSource":[
                    {
                        "value":"10001",
                        "label":"opt1"
                    },
                    {
                        "value":10002,
                        "label":"opt2"
                    },
                    {
                        "value":10003,
                        "label":"opt3",
                        "disabled":true
                    }
                ],
                "mode":"multiple"
            },
            "default":["10001","10002"]
        },

        "checkbox":{
            "type":"array",
            "title":"Check box",
            "x-decorator":"FormItem",
            "x-component":"Checkbox.Group",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "x-component-props":{
                "dataSource":[
                    {
                        "value":"10001",
                        "label":"opt1"
                    },
                    {
                        "value":10002,
                        "label":"opt2"
                    },
                    {
                        "value":10003,
                        "label":"opt3",
                        "disabled":true
                    }
                ],
                "mode":"multiple"
            },
            "default":["10001","10002"]
        },

        "radio":{
            "type":"number",
            "title":"Radio button",
            "x-decorator":"FormItem",
            "x-component":"Radio.Group",
            "x-decorator-props":{
                "tooltip":"Description file"
            },
            "x-component-props":{
                "dataSource":[
                    {
                        "value":"10001",
                        "label":"opt1"
                    },
                    {
                        "value":10002,
                        "label":"opt2"
                    },
                    {
                        "value":10003,
                        "label":"opt3",
                        "disabled":true
                    }
                ],
                "mode":"multiple"
            },
            "default":"10001"
        }

    }
}