Suffix for text output

100%! A man after my own heart!

This is not something that Mustache supports - but (IIRC) a hack workaround. In fact, I am pretty sure @dceejay has mentioned this recently.

One solution would be the use of filters (like the angular filters). There is such a concept for vue (example) but I remember reading recently they were dropped from Vue 3.

Vue has written the recommended approach now is to use computed however this does not help in cases like this where you are not coding but there is a 2nd alternative suggestion "globalProperties" in that link that might be useful (assuming the D1 mustache-ish syntax support is added to D2).

In short, it would mean we may be able to offer support for things like {{ $filters.formatNumber(payload, { fixed: 2, suffix: ' °C' }) }}

The thing is, it isn't really low-code nor is it JavaScript. Its not even JSONata, its another awkward workaround. Don't get me wrong I want a better way of formatting values but I am not certain the original D1 way was the best and so mimicking it in d2 may be worse current solution.


outlandish ideas:

# 1

How about a dashboard config section that accepts JS code where a user can add to a list of "filters". This set of filters would then be presented on the node and the user selects the appropriate filter for the data. Of course there would be a default set like "2 decimal places", "uppercase", "title case" etc but users could then generate their own "divide by 100 and suffix with ' volts'" filter.

# 2

How about (forgive me) permitting the option of msg. and JSONata for the fields that require formatting? Easier to implement BUT harder for users (and a chain around the necks of D2 devs for ever more)

# 3

Something else?