Message Debugger

This widget is used to inspect the message within an action pipeline. It is mostly used together with the send action invoked from an action pipeline. Refer to the Actions documentation for more information.

Model

{
    "type": "messagedebugger",
    "actions": {},
    "content": {},
    "dataSource": {},
    "editorOptions": {},
    "toolbars": {}
}
Field Description

actions

Optional property, used to configure action pipelines for selected trigger events.

content

Property used to define the content of the message debugger

dataSource

Optional property used to retrieve data from the system

editorOptions

Additional options for the editor. See the editor options for all available options.

toolbars

This property is used to add, customise or hide toolbars. See the toolbars section below.

To see how this works, create a new compilation consisting of the advancedform model shown below. Also add a messagedebugger widget.

{
    "type": "advancedform",
    "actions": {
        "onSubmit": {
            "type": "send",
            "to": "debugger"
        }
    },
    "data": {
        "firstName": "Joe",
        "lastName": "Bloggs"
    },
    "schema": {
        "type": "object",
        "required": [
            "firstName",
            "lastName"
        ],
        "properties": {
            "firstName": {
                "type": "string",
                "title": "First name"
            },
            "lastName": {
                "type": "string",
                "title": "Last name"
            }
        }
    }
}

The onSubmit action is configured to send the form data to the message debugger when the form "Submit" button in the bottom toolbar is pressed. With the default form data in place the following JSON is shown in the messagedebugger.

{
    "payload": {
        "firstName": "Joe",
        "lastName": "Bloggs"
    }
}

Clearing the content

The content of the messagedebugger can be cleared by sending it a message in which the payload contains a content field set to "". For example:

{
    "type": "button",
    "label": "Clear Debugger",
    "actions": {
        "onClick": {
            "type": "send",
            "to": "debugger",
            "message": {
                "payload": {
                    "content": ""
                }
            }
        }
    }
}

Actions

The actions property of the message debugger widget is used to implement action pipelines for specific trigger events.

Action Hooks

In addition to the general widget action hooks, the Message Debugger widget supports the following action hook:

onContentChange

The onContentChange action hook will be invoked when the content in the message debugger changes. It can be used together with the send action pipeline to send the content to other widgets.

{
    "actions": {
        "onContentChange": [
            {
                "type": "send",
                "to": "Id of widget to send message to"
            }
        ]
    }
}

Receive messages (Send Topics)

The message debugger widget can receive messages from other widgets. This widget only supports the generic message topics refresh and update.

DataSource

Refer to the generic widget page for a description of the general principles governing the treatment of data retrieved from a dataSource.

If a dataSource is defined as an object, then the message payload returned by the dataSource is determined by whether the type field matches the widget type. If the type field in the payload matches the widget type, then any matching model properties defined in the payload will be merged to the model. If the type is not defined or does not match, then the content field is checked for in the payload and merged into the model. In the event that neither the type or content fields are specified, the whole message payload is assigned to the content property in the model.

If the message payload is not defined as an object, then the whole payload will be merged to the content property in the model.

DataSource Pipeline

DataSource Examples

The sections below contain examples of the message payload returned by the dataSource on the Message Debugger widget and the expected merge behavior when applied to the model.

Message payload, defined as an object, where the type field matches the widget type

Suppose that the dataSource for a message debugger returns the following message payload. As the type property matches the widget type, any matching model properties in the payload will be merged to the model. In this example, the captionBar, editorOptions and content properties will be merged to the model.

{
    "payload": {
        "type": "messagedebugger",
        "captionBar": {
            "hidden": true
        },
        "editorOptions": {
            "fontWeight": "bold",
            "fontSize": 16
        },
        "content": {
            "name": "FC4711",
            "quality": "Good",
            "timestamp": 1699959561632,
            "value": 52.491416931152344
        }
    }
}

Message payload where the type field is not specified and the content field is defined

Suppose that the dataSource returns the following message payload, where the type field is not provided but the content field is defined. As the content field is the only field defined in the payload, the content field will be merged with the model.

{
    "payload": {
        "content": {
            "name": "FC4711",
            "quality": "Good",
            "timestamp": 1699959561632,
            "value": 52.491416931152344
        }
    }
}

If other fields, such as options, toolbars or actions, are defined in the payload in addition to the content field, the payload as a whole will be merged to the content property in the model.

{
    "payload": {
        "content": {
            "name": "FC4711",
            "quality": "Good",
            "timestamp": 1699959561632,
            "value": 52.491416931152344
        },
        "captionBar": false,
        "toolbars": {
            "top": {
                "tools": {
                    "refresh": {
                        "type": "button",
                        "subType": "refresh"
                    }
                },
                "leftOrTop": {
                    "toolsOrder": [
                        "refresh"
                    ]
                }
            }
        }
    }
}

Similarly, if the message payload is defined as an array or a string, the payload as a whole will be merged to the content property in the model.

Toolbars

The message debugger widget supports multiple custom toolbars. By default, the message debugger has a toolbar at the top widget. For information on configuring custom toolbars, see the toolbars section in the widget documentation.

Tools

The following tools have a default implementation in the message debugger widget.

Icon Name Description

JSON Format

Format

This tool can be used to format the text in the message debugger if required.

Refresh Btn

Refresh

Refreshes the message debugger widget.

Spacer

Defines the spacing between the tools in the widget toolbar and can be customised using the style and styleByTheme properties.