Merge pull request #34 from avatao-content/reload-iframe

Reload iframe handler added
This commit is contained in:
therealkrispet 2019-05-28 15:17:37 +02:00 committed by GitHub
commit cef95812eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -31,7 +31,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
'layout': this.layoutHandler.bind(this),
'hideMessages': this.hideMessagesHandler.bind(this),
'terminalMenuItem': this.terminalMenuItemHandler.bind(this),
'reloadFrontend': this.reloadFrontendHandlder.bind(this)
'reloadFrontend': this.reloadFrontendHandlder.bind(this),
'reloadIframe': this.reloadIframeHandler.bind(this)
};
constructor(private deploymentNotificationService: DeploymentNotificationService,
@ -101,6 +102,10 @@ export class DashboardComponent implements OnInit, OnDestroy {
setTimeout(() => window.location.reload(), 2000);
}
reloadIframeHandler(data: CommandMessage) {
setTimeout(() => this.reloadIframeNoSubmit(), 200);
}
setLayout(layout: string) {
this.layout = layout;
// We need to trigger a 'resize' event manually, otherwise editor stays collapsed
@ -120,6 +125,13 @@ export class DashboardComponent implements OnInit, OnDestroy {
});
}
reloadIframeNoSubmit() {
// Sometimes it is needed to reload the iframe without resending the previous form data
setTimeout(() => {
this.webiframe.nativeElement.contentWindow.location = this.webiframe.nativeElement.contentWindow.location.href;
})
}
selectTerminalMenuItem(item: string) {
if (!item.match('(terminal|console)')) {
return;