-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Printing docstring on the web frontend #1000
Comments
Tracing back the commit history, it appears that the feature was mentioned at [1], which in turn results in the merge request [2]. I don't know how the control script Any suggestions on how to port over the code from repo # src/openhtf/output/web_gui/src/app/stations/station/phase.component.html
<div class="htf-layout-header" [class.header-with-measurements]="showMeasurements" [class.teardown-phase]="isTeardown">
<span class="u-clamp-text">
<strong class="phase-name">{{ phase.name }}</strong>
- <span class="phase-doc">: {{ phase.doc }}</span>
+ <span *ngIf="!showDocExtended" class="phase-doc">: {{ phase.doc }}</span>
<span *ngIf="phase.status !== PhaseStatus.waiting">
{{ phase \| elapsedTime:'(%s)' }}
</span> # src/openhtf/output/web_gui/src/app/shared/models/phase.model.ts
@@ -40,7 +40,7 @@ export class Phase {
if (params.doc) docLines = params.doc.split("\n");
else docLines = []
params.doc = docLines.length > 0 ? docLines[0] : '';
- params.docExtended = docLines.slice(1).join("\n");
+ params.docExtended = docLines.join("\n");
Object.assign(this, params);
}
} # openhtf/output/web_gui/src/app/stations/station/phase.component.ts
ngOnChanges(changes: SimpleChanges) {
if (changes.phase) {
this.computeDocExtended()
}
}
+ computeDocExtended() {
+ const doc = this.markdownService.compile(this.phase.docExtended);
+ // const safeHtml = this.sanitizer.sanitize(SecurityContext.HTML, doc);
+ this.docExtended = this.sanitizer.bypassSecurityTrustHtml(doc);
+ }
get isTeardown() {
return this.phase.runOptions && this.phase.runOptions.type === 'TEARDOWN';
}
+ get showDocExtended() {
+ const shouldShow = this.expand || (this.expandIfRunning && this.phase.status === PhaseStatus.running);
+ return shouldShow && this.phase.docExtended;
+ }
[1] https://gitlab.com/tackv/spintop-openhtf/-/issues/10 |
Hi! I am wondering how I can modify the openhtf code to print the test phase docstring on the web frontend?
For multi-line docstring, only the first line is shown. The rest of the docstrings are shown when we click the "expand all" button on the web frontend.
I know this is achievable because I have seen it work on a forked project https://gitlab.com/tackv/spintop-openhtf . In fact, I have been using spintop until the underlying company (TackV GmBH) went out of business last year.
Reference:
https://gitlab.com/tackv/spintop-openhtf/-/blob/master/docs/docs/doc/documenting.md#L6
The text was updated successfully, but these errors were encountered: