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" <input type="text"
#urlbar #urlbar
class="urlbar" class="urlbar"
value="{{iframeUrl}}" value="{{actualIframeUrl}}"
(keyup.enter)="changeIframeURL()"> (keyup.enter)="changeIframeURL()">
<button class="go" (click)="changeIframeURL()">G</button> <button class="go" (click)="changeIframeURL()">G</button>
</div> </div>

View File

@ -26,6 +26,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
layout: string = config.dashboard.currentLayout; layout: string = config.dashboard.currentLayout;
hideMessages: boolean = config.dashboard.hideMessages; hideMessages: boolean = config.dashboard.hideMessages;
iframeUrl: string = config.dashboard.iframeUrl; iframeUrl: string = config.dashboard.iframeUrl;
actualIframeUrl: string = this.iframeUrl;
selectedTerminalMenuItem: string = config.dashboard.terminalOrConsole; selectedTerminalMenuItem: string = config.dashboard.terminalOrConsole;
command_handlers = { command_handlers = {
@ -117,6 +118,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
reloadIframe() { reloadIframe() {
setTimeout(() => { setTimeout(() => {
console.log('reload timeout');
this.webiframe.nativeElement.contentWindow.location.reload(true); this.webiframe.nativeElement.contentWindow.location.reload(true);
}); });
} }
@ -143,10 +145,14 @@ export class DashboardComponent implements OnInit, OnDestroy {
} }
iframeLoad(): void { 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() { 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');
} }
} }