Skip to content

Commit

Permalink
Pretty-print json-stringified measurement values
Browse files Browse the repository at this point in the history
  • Loading branch information
lalten committed Oct 13, 2022
1 parent c6b7f1f commit ce7387c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Component, Input } from '@angular/core';

const ellipsis = '…';
const template = `
{{ trimmedContent }}
<div style="white-space: pre-wrap;">{{ trimmedContent }}</div>
<button *ngIf="buttonLabel !== null" type="button" class="htf-link-button"
(click)="onClick()">
{{ buttonLabel }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ function makePhase(phase: RawPhase, running: boolean) {
measurements = Object.keys(phase.measurements).map(key => {
const rawMeasuredValue = phase.measurements[key].measured_value;
let measuredValue = null;
if (typeof rawMeasuredValue === 'object') {
measuredValue = JSON.stringify(rawMeasuredValue);
} else if (typeof rawMeasuredValue !== 'undefined') {
measuredValue = `${rawMeasuredValue}`;
if (typeof rawMeasuredValue === 'string') {
measuredValue = rawMeasuredValue.trim();
} else {
JSON.stringify(rawMeasuredValue, null, 2);
}

return new Measurement({
name: phase.measurements[key].name,
validators: phase.measurements[key].validators || null,
Expand Down

0 comments on commit ce7387c

Please sign in to comment.