Implement reloading of frontend from API

This commit is contained in:
Kristóf Tóth 2018-04-20 14:50:43 +02:00
parent eabd7d6c75
commit bafb88012d

View File

@ -16,7 +16,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
deploymentNotificationSubscription: Subscription;
layout: string = config.dashboard.currentLayout;
hide_messages: boolean = config.dashboard.hide_messages;
command_handlers = {'layout': this.layoutHandler.bind(this)};
command_handlers = {'layout': this.layoutHandler.bind(this),
'reload_frontend': this.reloadFrontendHandlder.bind(this)};
constructor(private deploymentNotificationService: DeploymentNotificationService,
private webSocketService: WebSocketService,
@ -44,6 +45,10 @@ export class DashboardComponent implements OnInit, OnDestroy {
}
}
reloadFrontendHandlder(data: LayoutCommand) {
setTimeout(() => window.location.reload(), 2000);
}
setLayout(layout: string) {
this.layout = layout;
// We need to trigger a 'resize' event manually, otherwise ace editor stays collapsed