Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Add pretty print on info/error
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrouand committed Nov 29, 2023
1 parent f16e80a commit d422d9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
</span>
</div>
<div class="align-self-center">
<pre [class]="inOutCtxToggleClass(ctxVarsToggle)"><code [innerHTML]="entry.value | stringify | prettyPrint: true | safe: 'html'"></code></pre>
<pre [class]="inOutCtxToggleClass(prettyPrintToggle)"><code [innerHTML]="entry.value | stringify | prettyPrint: true | safe: 'html'"></code></pre>
</div>
</div>
</div>
Expand Down Expand Up @@ -219,7 +219,7 @@
</span>
</div>
<div class="align-self-center">
<pre [class]="inOutCtxToggleClass(inputsToggle)"><code [innerHTML]="input.value | stringify | prettyPrint: true | safe: 'html'"></code></pre>
<pre [class]="inOutCtxToggleClass(prettyPrintToggle)"><code [innerHTML]="input.value | stringify | prettyPrint: true | safe: 'html'"></code></pre>
</div>
</div>
</div>
Expand All @@ -230,13 +230,13 @@
</ng-container>
<ng-container *ngIf="step.information && step.information.length > 0">
<div class="infos" [ngClass]="{'d-none': !infosToggle}">
<pre *rxFor="let info of step.information" class="step-info mb-0"
<pre *rxFor="let info of step.information" class="step-info mb-0" [class]="inOutCtxToggleClass(prettyPrintToggle)"
[innerHTML]="((info | prettyPrint: true | thumbnail) | safe: 'html')">
</pre>
</div>
</ng-container>
<div *ngIf="step.errors && step.errors.length > 0" class="errors" [ngClass]="{'d-none': !errorsToggle}">
<pre *rxFor="let error of step.errors" class="step-error mb-0"
<pre *rxFor="let error of step.errors" class="step-error mb-0" [class]="inOutCtxToggleClass(prettyPrintToggle)"
[innerHTML]="((error | prettyPrint: true | thumbnail) | safe: 'html')">
</pre>
</div>
Expand All @@ -255,7 +255,7 @@
</span>
</div>
<div class="align-self-center">
<pre [class]="inOutCtxToggleClass(outputsToggle)"><code [innerHTML]="output.value | stringify | prettyPrint: true | safe: 'html'"></code></pre>
<pre [class]="inOutCtxToggleClass(prettyPrintToggle)"><code [innerHTML]="output.value | stringify | prettyPrint: true | safe: 'html'"></code></pre>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,62 +389,37 @@ export class ScenarioExecutionComponent implements OnInit, OnDestroy, AfterViewI
}

togglePayloads() {
this.toggleCtxVars();
this.toggleInputs(false);
this.toggleOutputs(false);
this.prettyPrintToggle = !this.prettyPrintToggle;

timer(250).subscribe(() => this.setLefPanelHeight());
}

private inOutCtxToggle_onClass = 'm-0 text-wrap text-break';
private inOutCtxToggle_offClass = 'm-0 d-block overflow-auto';
prettyPrintToggle = true;
inOutCtxToggleClass(toggleValue: boolean): string {
return toggleValue ? this.inOutCtxToggle_onClass : this.inOutCtxToggle_offClass;
}

ctxVarsToggle = true;
private toggleCtxVars() {
this.ctxVarsToggle = !this.ctxVarsToggle;
this.querySelector('.ctx-var-raw pre').forEach(e => {
e.className = this.inOutCtxToggleClass(this.ctxVarsToggle);
});
}

toggleInputsOutputs() {
this.toggleInputs(true);
this.toggleOutputs(true);
this.toggleInputs();
this.toggleOutputs();
}

inputsToggle = true;
inputsDNoneToggle = true;
private toggleInputs(dNone: boolean) {
if (dNone) {
this.inputsDNoneToggle = !this.inputsDNoneToggle;
this.querySelector('.report-raw .inputs').forEach(e => {
this.toggleDisplayNone(e, this.inputsDNoneToggle);
});
} else {
this.inputsToggle = !this.inputsToggle;
this.querySelector('.report-raw .inputs pre').forEach(e => {
e.className = this.inOutCtxToggleClass(this.inputsToggle);
});
}
private toggleInputs() {
this.inputsDNoneToggle = !this.inputsDNoneToggle;
this.querySelector('.report-raw .inputs').forEach(e => {
this.toggleDisplayNone(e, this.inputsDNoneToggle);
});
}

outputsToggle = true;
outputsDNoneToggle = true;
private toggleOutputs(dNone: boolean) {
if (dNone) {
this.outputsDNoneToggle = !this.outputsDNoneToggle;
this.querySelector('.report-raw .outputs').forEach(e => {
this.toggleDisplayNone(e, this.outputsDNoneToggle);
});
} else {
this.outputsToggle = !this.outputsToggle;
this.querySelector('.report-raw .outputs pre').forEach(e => {
e.className = this.inOutCtxToggleClass(this.outputsToggle);
});
}
private toggleOutputs() {
this.outputsDNoneToggle = !this.outputsDNoneToggle;
this.querySelector('.report-raw .outputs').forEach(e => {
this.toggleDisplayNone(e, this.outputsDNoneToggle);
});
}

toggleInfosErrors() {
Expand Down

0 comments on commit d422d9c

Please sign in to comment.