Skip to content

Commit a8fa970

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 7581ab2 commit a8fa970

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
@@ -189,7 +189,9 @@ function makePhase(phase: RawPhase, running: boolean) {
189189
measurements = Object.keys(phase.measurements).map(key => {
190190
const rawMeasuredValue = phase.measurements[key].measured_value;
191191
let measuredValue = null;
192-
if (typeof rawMeasuredValue !== 'undefined') {
192+
if (typeof rawMeasuredValue === 'object') {
193+
measuredValue = JSON.stringify(rawMeasuredValue);
194+
} else if (typeof rawMeasuredValue !== 'undefined') {
193195
measuredValue = `${rawMeasuredValue}`;
194196
}
195197
return new Measurement({

0 commit comments

Comments
 (0)