Configure action interfaces

更新时间:
复制 MD 格式

You can create an action interface to allow external widgets to call a block. For example, if an external widget needs to control the color of a Vertical Capsule Column Chart widget within the block, you can create an Update Style action. You can use this action in the blueprint editor of the visualization application. This topic describes how to configure action interfaces within a block and explains the purpose of this feature.

In the block editor, click the 动作图标 icon in the upper-right corner and configure actions on the Action Settings tab.

Switch modes

At the top of the dialog box, you can switch the action mode. The options are View mode and Code mode.

Mode

Description

View mode

In view mode, you can see the style of the sample action. Configure your action based on the sample style without writing code.

The following image shows an example of the action panel in view mode.视图模式下的动作面板示例

Code mode

In code mode, you can write custom code for your action based on the sample code. This lets you add or configure actions.

The following image shows an example of the action panel in code mode.代码模式下的动作面板示例

Note

For information about the code standards for action interfaces, see Overview of widget developer package files.

Configure an action interface

On the Action Settings tab, a sample action is provided by default. You can customize this action.动作接口示例

Operation

Description

Expand the action details

Click the 下拉图标 icon to the right of the sample action to open its configuration details.

Edit basic action information

Each action contains multiple parameters. You can edit the basic information of the action.

  • Name: The name of the action.

  • Display Name: The external display name of the action. After you change the display name, press Enter. The result immediately appears in the configuration panel.

  • Description: The description of the action.

  • Data Type: Select a data type for the action. Options are Object, Array, Any, and None.

Delete an action

Click the 删除图标 icon to the right of an action to delete it.

Add an action

On the Action Settings tab, click Add Action to add a new action in the configuration area below.

Note

You can add or edit multiple actions for the block interface.

Configure action fields

In the action configuration panel, sample action fields are added by default. You can customize these fields.动作字段示例

Operation

Description

Edit basic field information

Each action field contains multiple parameters. You can edit the field parameters.

  • Field Name: Enter the name of the action field in English. The field name must consist of English characters and serves as the key when passing parameters.

  • Display Name: Enter a display name for the field. The name must be 10 characters or less and is used to explain the purpose of the field.

  • Description: Enter a detailed description for the field. The description must be 25 characters or less.

  • Type: Select a type for the field. Options are String, Number, Object, Array, Boolean, and Binary.

  • Default Value: Enter a default value for the field. This is optional.

  • Optionality: Specify if the field is Required or Optional. This setting is optional.

Add a field

Click the 新增按键 icon to the right of a field row and select Add Sibling Node to add a new field row.

Arrange fields

If the data interface has multiple field rows, click the 调整位置图标 icon on the far left of a row and drag the row to change its vertical order.

Delete a field

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

Note

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

添加字段

View and use action interfaces in a visualization application

After you configure an action interface in the block editor, you can use the block in a visualization application. The blueprint editor displays all action interfaces for the block. Follow these steps to configure and view the interface information in a visualization application.

  1. In the block editor, preview the configured action interface and test the data interface. After the interface test is complete, publish the block. For more information, see Preview Block and Publish Block.Test and modify action parameter styles

  2. Switch to the Workbench page. Hover over a dashboard and click Edit to open the canvas editor.

  3. Click the Widget Library tab, select the Blocks module, and view all published blocks in the block list.

  4. Click a block to add it to the canvas editor.

  5. Right-click the block on the canvas and select Enter Blueprint Editor. You can then view all the events and action interfaces for the block in the blueprint editor.

    Other widgets in the blueprint editor can call the event and action interfaces by wiring and configuring logic nodes. For more information, see Function Introduction.Block actions panel

Preview action configurations in real time

On the Action Settings tab, the left side of the dialog box is the area where you customize actions, and the right side is the real-time preview area. All action parameters that you configure on the left are immediately displayed in the preview interface on the right. This lets you easily check the configured actions.预览动作区域示例