Reload iframe handler added

This commit is contained in:
Hajbo 2019-02-24 01:11:54 +01:00
parent 79a4017386
commit 327c741aab

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;