Make iframe toggleable

This commit is contained in:
Kristóf Tóth 2019-08-28 15:28:26 +02:00
parent 48a8facd50
commit c07538dc13
2 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@
</div> </div>
<div class="tfw-web tao-grid-top-left" <div class="tfw-web tao-grid-top-left"
[ngClass]="{'deploy-blur': deploying || polling}"> [ngClass]="{'deploy-blur': deploying || polling}">
<div class="iframe-container"> <div *ngIf="iframeUrl | async" class="iframe-container">
<div *ngIf="showUrlBar | async" class="urlbar-container"> <div *ngIf="showUrlBar | async" class="urlbar-container">
<button class="refresh btn btn-sm rounded-circle" (click)="reloadIframe()">&#8635;</button> <button class="refresh btn btn-sm rounded-circle" (click)="reloadIframe()">&#8635;</button>
<input type="text" <input type="text"

View File

@ -115,15 +115,15 @@ export class DashboardComponent implements OnInit, OnDestroy {
this.terminalMenuItem.next(item); this.terminalMenuItem.next(item);
} }
scrollMessagesToBottom(): void { scrollMessagesToBottom() {
const element = this.messages.nativeElement; const element = this.messages.nativeElement;
// This must be done in the Angular event loop to avoid messing up // This must be done in the Angular event loop to avoid messing up
// change detection (not in the template like ConsoleComponent does) // change detection (not in the template like ConsoleComponent does)
element.scrollTop = element.scrollHeight; element.scrollTop = element.scrollHeight;
} }
iframeLoad(): void { iframeLoad() {
if (this.webiframe) { if (this.webiframe && this.iframeUrl.value) {
const href = this.webiframe.nativeElement.contentWindow.frames.location.href; const href = this.webiframe.nativeElement.contentWindow.frames.location.href;
const niceURL = href.match(/.*?\/\/.*?(\/.*)/)[1]; const niceURL = href.match(/.*?\/\/.*?(\/.*)/)[1];
this.actualIframeUrl = niceURL; this.actualIframeUrl = niceURL;