configure-data-interfaces

更新时间:
复制 MD 格式

This topic describes how to configure data interfaces within a block.

In the block editor, you can click the 数据接口设置图标icon in the upper-right corner of the block editor. On the Data Interface Settings tab, you can configure the following data interfaces.

Switch between the edit mode and the revision mode

In the upper part of the dialog box, you can switch the data interface mode. You can select View Mode or Code Mode.

Value of mode

Description

View Mode

In view mode, you can view the style of the sample data interface and customize the content of the data interface based on the sample style without writing code.

View Mode Configuration Panel Example 视图模式配置面板示例

Script mode

In code mode, you can customize the code of the required data interface based on the sample interface code. Implement the contents of a new or configured data interface. 代码模式面板示例

Note

For more information about how to configure data interface code, see Overview.

Configure Data Interface

On the Data Interface Settings tab, you can configure a data interface by default. 数据接口示例样式

Operation

Procedure

Expand Data Interface Details List

Click the 下拉图标icon on the right of the sample data interface to open the detailed configuration information list of the current data interface.

Edit the basic information of a data interface

Each data interface contains multiple parameters. You can customize the basic information of the data interface.

  • Name: the name of the data interface.

  • Display Name: the name of the data interface. Press the Enter key after confirming to change the display name, and the result will be displayed in the configuration panel immediately.

  • Description: the description of the data interface.

  • Data Type: Select a data type for the data interface. Valid values: Object, Array, Any Value, and None.

Delete Data Interface

Click the 删除图标icon on the right of a data port to delete the current data port.

Add a data interface

On the Data Interface Settings tab, click Add Data Interface to add a new data interface in the Data Interface Settings section.

Note

You can add or edit multiple data interfaces for block interface use.

Configure data fields

On the Data Interface Settings tab, the system automatically adds two sample data fields by default. You can customize the data fields by operation. 字段配置示例

Operation

Procedure

Edit basic field information

Each data field contains multiple field parameters. You can customize the parameter content of a field.

  • Field Name: Enter the English name of the data field. The field name must contain English characters and is used as the key value when you pass the parameter.

  • Chinese Name: Enter the Chinese name of the field. The name must be no more than 10 characters in length to explain the meaning of the field.

  • Description: Enter a detailed description of the field. The description must contain no more than 25 words.

  • Type: Select the type of the field. You can select String, Number, Object, Array, Boolean, or Binary.

Create a field.

Click the 新增按键icon next to a field row and select Add Same Level.

Adjust Field Position

After you add multiple field rows to a data interface, you can click the 调整位置图标icon on the left of the field row and drag the field rows to adjust the order of the field rows.

Delete a field

Click the 删除字段图标icon on the right of the field row to delete the field content.

Note

After you delete all fields from the field list, you can click Add Field to add a field.

添加字段

Configure field default data

You can configure the default data of an added field as the sample data content of the field. 示例数据配置样式

View and use data interfaces in visual applications

After you configure data interfaces in the block editor, you can view all data interfaces of a block when you use the block in Canvas Editor. To configure and view interface information in a visualization application, perform the following steps:

  1. In the block editor, preview and test the configured data interface content. After the interface is tested, publish the block. 测试区块并发布

  2. Switch to the console page in the console. Move the pointer over a dashboard and click Edit to enter Canvas Editor.

  3. Click the Component Library tab and select Block. You can view all published blocks in the block list.

  4. Click a block to add the block to Canvas Editor.

  5. Click a block on the canvas. In the right-side configuration panel, click the Data Source tab to view all configurations of the data interface of the block. 1

Real-time Preview Data Interface Configuration

On the Data Interface Settings tab, the left side of the dialog box is used to configure custom data interfaces. The right side of the dialog box is the real-time preview area. All data interface parameters configured on the left side can be directly displayed on the preview page on the right side, so that you can view the configured data interface parameters. 预览数据接口配置