Skip to content

Commit af8ec0e

Browse files
committed
Json stringify object measurements
This change will e.g. make the values of `typing.NamedTuple`s visible in the Web UI. Before this change they were displayed as `[object Object]`. I believe the measurements are guaranteed to be json-serializable because they are coming in via the websocket transport, which uses json already.
1 parent 7cef208 commit af8ec0e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

openhtf/output/web_gui/src/app/stations/station/station-data.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ function makePhase(phase: RawPhase, running: boolean) {
181181
measurements = Object.keys(phase.measurements).map(key => {
182182
const rawMeasuredValue = phase.measurements[key].measured_value;
183183
let measuredValue = null;
184-
if (typeof rawMeasuredValue !== 'undefined') {
184+
if (typeof rawMeasuredValue === 'object') {
185+
measuredValue = JSON.stringify(rawMeasuredValue);
186+
} else if (typeof rawMeasuredValue !== 'undefined') {
185187
measuredValue = `${rawMeasuredValue}`;
186188
}
187189
return new Measurement({

0 commit comments

Comments
 (0)