Here is new documentation version.
You are reading outdated documentation, which will be shutdown soon!

EP Label

Overview

EP Label widget displays custom image and last readings of a certain time series from a single endpoint above it.

example

Widget configuration

EP Label widget has the following configuration:

config:
  type: epLabel           # Widget type. Must always equal "label" for this widget type. REQUIRED.
  header:
   title:                 # Widget title text.
   displayTitle: true     # Indicates whether to display widget title text.
   iconPath:              # Path to icon.
  backgroundImage:
    url:                  # Link to image file used as widget background. Supports placeholders with metadata fields. REQUIRED.
    values:               # List of mappings used to substitute placeholders in URL.
      - name:             # Name of the placeholder used in URL field, e.g. "pictureUrl" will substitute ${pictureUrl} in URL.
        path:             # Path to metadata value used in the placeholder, e.g. "metadata.pictureUrl"
  serviceIntegration:
    serviceName:          # Name of the service instance to get data from. REQUIRED.
    metadataServiceName:  # EPR service instance name. Used for populating placeholders in image URL.
    endpoint:             # Takes value of ${dashboard.id} to fetch the data for the current endpoint on the
                          # dashboard or a pre-defined endpoint ID for any available endpoint.
    updateInterval:       # Data fetching interval in milliseconds. Equals 3000 by default.
  fields:                 # List of label fields. REQUIRED.
    - timeSeriesName:     # Name of time series to get data from. Rewrites upper scope value. REQUIRED if not defined in upper scope.            
      values:             # List of field values.
        - type: static    # Type of the field value. Available values are 'static', 'path' or 'icon'.
          value:
          style:          # Styles that override the default ones.
        - type: path
          path:           # Path to the value contained in the service response.
          displayScale:   # Rounds recived value to defined precission.
          style:
        - type: icon
          path:           # Path to the value contained in the service response. REQUIRED for conditional icons.
          icons:          # Array of icons.
            - icon:       # URI of icon image.
              condition:  # Declares in which case icon will be displayed. REQUIRED if more than one icon is specified.
          style:          
      coordinates:        # Coordinates of current label. REQUIRED.
        x1:               # X coordinate of the upper-left corner of the label. REQUIRED.
        y1:               # Y coordinate of the upper-left corner of the label. REQUIRED.
      styling:
        color:            # Label text color.
        fontSize:         # Text font-size in pixels. Equals 20 by default.
        additionalStyles: # Styles that override the default ones.

Conditional icons

Any label can display different icons depending on certain conditions. To set a condition for an icon to be displayed, specify it in the {operator}{value} format where {operator} is one of the following values: >, >=, <, <=, =; and {value} is an integer or a floating point number. For example, an icon with condition >=10 will only be displayed in when the value is bigger than 10. Also, you should specify one icon with condition: default—it will be displayed by default when none of the other conditions are applied.

Example configuration

Minimal valid configuration of the EP Label widget:

config:
  type: epLabel
  header:
    title: Endpoint Label
    displayTitle: true
  image: https://i.imgur.com/llIVBrg.png
  serviceIntegration:
    serviceName: epts
    endpoint: '${dashboard.id}'
  fields:
    - timeSeriesName: value1
      text: Name - ${shipName} ${rocket}
      coordinates:
        x1: 20
        y1: 20
      values:
        - type: icon
          path: value
          icons:
            - icon: https://image.flaticon.com/icons/svg/32/32909.svg
              condition: default
            - icon: https://www.svgrepo.com/show/22577/thermometer.svg
              condition: '<0.2'
            - icon: http://lp.colortone.ru/local/templates/main/img/thermometer.svg
              condition: '>0.8'
        - type: static
          value: '-'
        - type: path
          path: metadata.shipName
    - timeSeriesName: value2
      coordinates:
        x1: 200
        y1: 200
      values:
        - type: static
          value: 'Flag -'
        - type: path
          path: metadata.flag
        - type: static
          value: 'Dwt -'
        - type: path
          path: metadata.dwt
        - type: static
          value: 'Imo -'
        - type: path
          path: metadata.imo

Interfaces

EP Label supports a number of service interfaces to perform its functional role. The key supported interfaces are summarized in the following diagram.

EP Label interfaces diagram

For service communication, WD widgets mainly use REST APIs.