Article Content

  1. Execute Button Element
  2. ResetFilterButton Element
  3. ToggleButton Element


Execute Button Element

type = "executeButton"

With this Element you can execute a Workflow, Production Line or Function.


Properties

Property
Type
Description
Example Value
id
string
The unique id assigned to the Element.  
  "id": "execButton1"
type
string
Type of the Element
  "type": "executeButton"
config
object
Configuration of the Element.
  "config": {
    // ID of the endpoint
    "endpoint": "TestEndpoint",
    // Button Icon (default
    // is a play button) 
    "icon": "",
     // Label of the button
    "label": "Execute Test Workflow"
  }
config.
messages
objectConfiguration of the displayed execution messages.
The default messages will be used if no message is defined.
  "messages": {
    "started": {
      // Headline text
      "headline": "Started",
      // Message text
      "message": ""
    },
    "error": {
      "headline": "Error",
      "message": ""
    },
    "failed": {
      "headline": "Failed",
      "message": ""
    },
    "aborted": {
      "headline": "Aborted",
      "message": ""
    },
    "success": {
      "headline": "Success",
      "message": "" 
    }
  }
config.
messages.
success.
messagePath
string

A JSONPath expression defining where to find the text of the message in the object returned by the function. If this is omitted or the respective field does not exist in the function response, the text from 'message' will be shown.


This relates to Function feature.
 Further information below.
config.
messages.
hideAfter
Seconds
number

By default the message will not be hidden and has to be closed by the user. Setting this value to 4 on the other hand, auto-hides the message after 4 seconds. This can also be configured globally, see Global>Messages.


  "messages": {
    "hideAfterSeconds": 4
  }

config.
messages.
disabled
boolean

Disables the message all together, hiding it from the user. Defaults to false. This can also be configured globally, see Global>Messages.


  "messages": {
    "disabled": false
  }

config.
showSpecific
Error
Messages
booleanEnable specific ONE DATA Error or Warning messages.
  "showSpecificErrorMessages": true
config.
disabled
booleanProperty to disable the Execute Button
  "disabled": false
config.
diableExecute
Button.
untilFinished
numberProperty to disable Execute Button until the Workflow / Production Line is finished.
 "disableExecuteButton": {
    "untilFinished": true
  },
config.
diableExecute
Button.
forTime
number

Property to disable the Execution Button for 5 seconds after click. Something like 1.2 is also possible


  "disableExecuteButton": {
    "forTime": 4
  },


Example

{ 
  "version": "0.1",
  "screens": [
    {
      "layout": "layout1",
      "conditions": {
        "minScreenWidth": 0
      }
    }
  ],
  "endpoints": [
    {
      "id": "TestEndpoint",
      "type": "workflow",
      "async": true,
      "config": {
        "workflowId": "",
        "projectId": "",
        "version": 0,
        "variableAssignments": [
          {
            "variableName": "",
            "variableType": "STRING",
            "variableValue": 0
          }
        ]
      }
    }
  ],
  // ... layouts
  // ... datasources
  "elements": [
    {
      "type": "executeButton",
      "id": "execButton1",
      "config": {
        "endpoint": "TestEndpoint",
        "icon": "",
        "label": "Execute Test Workflow"
      }
    },
  //... more Elements
  ]
}



Executing Functions with customizable messages

When triggering Endpoints of type "function" additional possibilities for customizing user-facing messages are available. This section explains additional possibilities for customizing the toast messages in both success and error cases.

 

The examples in this section assume that the the following Python-function was already created in the Processing Library or Use Cases module of ONE DATA. It accepts a dictionary with a name field as parameter, validates that the name is not empty and returns an object containing a greeting.


def handle(req):
    # Get the function payload
     user = req['args']
    # Validate that a name is provided
    if 'name' not in user or not user['name']:
        raise Exception('No name was provided')
    # Generate and return the message
    return {
      'greeting': {
        'text': 'Welcome to Apps, %s!' % user['name']
      }
    }


Given this Function a Function endpoint can be defined and used for the execute button. In this configuration it is possible to customize the toast message shown to the user using a value from the functions return value. The property messages.success.messagePath allows to specify a JSONPath expression pointing to any string value in the functions return value that should be used as text for the toast. The following example shows how the greeting generated by the above function can be shown to the user when the function was successfully executed. 


  "messages": {
    "success": {
      "headline": "Greetings",
      "messagePath": "greeting.text"
  }



ResetFilterButton Element

type = "resetFilter"

With this Element you can add a one click button to reset all Filters


Properties

PropertyTypeDescriptionExample Value
idstringThe unique id assigned to the Element. This is defined by the user and used to refer to the Element in layouts."myElementId"
typestringType of your Element"resetFilter"
config.labelstringThe label (button text) that should be displayed."Reset all filters"
config.iconstringThe icon which will be displayed in front of the label."arrowleft" or "refresh"


Example

{
  "id": "resetFilterButton",
  "type": "resetFilter",
  "config": {
    "label": "Reset all Filter",
    "icon": "arrowleft"
  }
}



ToggleButton Element

type = "toggleButton"

With this Element you can switch between two states.


Properties

PropertyTypeDescriptionExample Value
idstringThe unique id assigned to the Element. This is defined by the user and used to refer to the Element in Layouts."myElementId"
typestringType of your Element"toggleButton"
config.variablestringName of the variable you want to change."foo"
config.leftobjectProperties for the left state of the toggle button.
  "left": {
    "label": "Table",
    "value": {
      "sub1": "table",
      "sub2": "table"
    }
  }
config.rightobjectProperties for the right state of the toggle button.
  "right": {
    "label": "Highchart",
    "value": {
      "sub1": "highcharts",
      "sub2": "highcharts"
    }
  }
.config.checkedbooleanProperty to set the default state of the toggle button to the right state.
      "checked": true
config.disabledbooleanProperty to disable the toggle button.
      "disabled": false


Example

  "id": "tb",
  "type": "toggleButton",
  "config": {
    "variable": "foo",
    "left": {
      "label": "Table",
      "value": {
        "sub1": "table",
        "sub2": "table"
      }
    },
    "right": {
      "label": "Highchart",
      "value": {
        "sub1": "highcharts",
        "sub2": "highcharts"
      }
    },
    "checked": false,
    "disabled": false
  }