Skip to content

Commit ce7387c

Browse files
committed
Pretty-print json-stringified measurement values
1 parent c6b7f1f commit ce7387c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

openhtf/output/web_gui/src/app/shared/trimmed-text.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { Component, Input } from '@angular/core';
2222

2323
const ellipsis = '…';
2424
const template = `
25-
{{ trimmedContent }}
25+
<div style="white-space: pre-wrap;">{{ trimmedContent }}</div>
2626
<button *ngIf="buttonLabel !== null" type="button" class="htf-link-button"
2727
(click)="onClick()">
2828
{{ buttonLabel }}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,12 @@ 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 === 'object') {
209-
measuredValue = JSON.stringify(rawMeasuredValue);
210-
} else if (typeof rawMeasuredValue !== 'undefined') {
211-
measuredValue = `${rawMeasuredValue}`;
208+
if (typeof rawMeasuredValue === 'string') {
209+
measuredValue = rawMeasuredValue.trim();
210+
} else {
211+
JSON.stringify(rawMeasuredValue, null, 2);
212212
}
213+
213214
return new Measurement({
214215
name: phase.measurements[key].name,
215216
validators: phase.measurements[key].validators || null,

0 commit comments

Comments
 (0)