cloudsoft.io

Widgets

Widgets are blocks which describe how a resource should be decorated in the Maeztro UI. In the simplest form, one can write:

widget "speed" {}

This will show the value of the sensor speed, underneath a label “SPEED”.

One can also use explicitly typed widgets:

  • widget sensor "id" { sensor = "sensor_name" }: shows the value of the sensor sensor_name (or id if sensor is not specified)
  • widget attribute "id" { attribute = "attr" }: shows the value of the Terraform attribute attr (or id if attribute is not specified)
  • widget value "id" { value = self.some_expression }: shows the value of the given value HCL expression, resolved against the resource entity

These all support the following optional attributes:

  • label: a title; if blank, none shown; if omitted, the id is used
  • unit: a unit to be displayed after the value
  • type: to render the value as a specific type, such as duration; when omitted, the explicit declared type of the value is used, such as on a sensor
  • description: a description to associate with the widget

The simple form, where the type is omitted, attempts to infer the type based on the attributes specified, or falls back to a sensor name if no identifying attributes are specified.