3 minute readApplies to: v4

How to use custom labelling

Overview

Custom labelling allows you to specify exactly how you want resources to be displayed, using both static text and dynamic properties.

Supported tiles

Tiles that support custom labels come preconfigured with some useful labels and, in the case of Performance tiles, will even attempt to automatically select the most useful label based on the selected resource and metric. You can however choose the custom option which will allow you to precisely control the label.

The following tiles support custom labels:

You can configure a custom label by configuring the label panel when creating or editing a supported tile. Below are some examples of using both a predefined and custom label.

The mustache helper

Custom labels use Mustache syntax to insert values from the resource. If you're familiar with mustache, you can specify advanced labels that can transform properties prior to displaying them (such as showing only a portion of text, converting a number or reformatting a date).

When specifying a mustache for a custom label, clicking the {{}} button or typing {{ brings up a helpful picker which shows all the properties of your selected resources, along with sample values.

Once the mustache helper is displayed, the list of properties will automatically filter based on what you type, allowing you to quickly find a property using a partial name or likely term. Clicking an item in the list will automatically insert that property into your label and complete the mustache.

Property names are case-sensitive and should be written as they appear in the mustache helper (e.g. availabilityStatus.location not AvailabilityStatus.location).

Display virtual machines with a custom sub-label

You may wish to specify your own sublabel rather an use the default resource summary sublabel.

  1. Create a Status resources (icons) tile.
  2. On the scope panel select type and enter Virtual Machines.
  3. Click on the sublabel panel.
  4. Click on custom.
  5. In the sublabel template paste in {{location}} {{properties.storageProfile.imageReference.offer}} {{properties.storageProfile.imageReference.sku}}.
  6. Click on done.

Timeago

Use timeago to convert Unix timestamps to show a readable date and time:

To show the date:

{{timeago(value, true, false)}}

To show the date and time:

{{timeago(value, true, true)}}

To show how long ago it occurred:

{{timeago(value)}}

Wikipedia: Mustache template system

Ractive 0.7 Mustache extensions

Regular Expression

Squared Up Ltd. (c) 2020Report an issue with this article