Fix flickering bug

This commit is contained in:
balazs 2019-01-21 17:24:02 +01:00
parent 6d136c9279
commit e77489aa3b
2 changed files with 9 additions and 3 deletions

View File

@ -18,7 +18,7 @@
<input type="text"
#urlbar
class="urlbar"
value="{{iframeUrl}}"
value="{{actualIframeUrl}}"
(keyup.enter)="changeIframeURL()">
<button class="go" (click)="changeIframeURL()">G</button>
</div>

View File

@ -26,6 +26,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
layout: string = config.dashboard.currentLayout;
hideMessages: boolean = config.dashboard.hideMessages;
iframeUrl: string = config.dashboard.iframeUrl;
actualIframeUrl: string = this.iframeUrl;
selectedTerminalMenuItem: string = config.dashboard.terminalOrConsole;
command_handlers = {
@ -117,6 +118,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
reloadIframe() {
setTimeout(() => {
console.log('reload timeout');
this.webiframe.nativeElement.contentWindow.location.reload(true);
});
}
@ -143,10 +145,14 @@ export class DashboardComponent implements OnInit, OnDestroy {
}
iframeLoad(): void {
this.iframeUrl = this.webiframe.nativeElement.contentDocument.location.href.replace(document.baseURI, '/');
if (this.webiframe) {
this.actualIframeUrl = this.webiframe.nativeElement.contentWindow.frames.location.pathname;
console.log('load');
}
}
changeIframeURL() {
this.webiframe.nativeElement.contentDocument.location.href = document.baseURI + this.urlbar.nativeElement.value.substr(1);
this.webiframe.nativeElement.contentWindow.frames.location.pathname = this.actualIframeUrl;
console.log('change url');
}
}