Skip to content

Commit c6b7f1f

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 ae22539 commit c6b7f1f

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
@@ -205,7 +205,9 @@ function makePhase(phase: RawPhase, running: boolean) {
205205
measurements = Object.keys(phase.measurements).map(key => {
206206
const rawMeasuredValue = phase.measurements[key].measured_value;
207207
let measuredValue = null;
208-
if (typeof rawMeasuredValue !== 'undefined') {
208+
if (typeof rawMeasuredValue === 'object') {
209+
measuredValue = JSON.stringify(rawMeasuredValue);
210+
} else if (typeof rawMeasuredValue !== 'undefined') {
209211
measuredValue = `${rawMeasuredValue}`;
210212
}
211213
return new Measurement({

0 commit comments

Comments
 (0)