mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:11:32 +00:00
Refactor command handling initialization in DashboardComponent
This commit is contained in:
parent
5d0fb1ab19
commit
3980051823
@ -29,10 +29,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit() {
|
||||
this.webSocketService.connect();
|
||||
this.webSocketService.observeKey<LayoutCommand>('dashboard').subscribe((event) => {
|
||||
this.command_handlers[event.data.command](event.data);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
this.initCommandHandling();
|
||||
this.deploymentNotificationSubscription = this.deploymentNotificationService.deploying.subscribe(
|
||||
(deploying) => {
|
||||
this.deploying = deploying;
|
||||
@ -42,6 +39,13 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
initCommandHandling() {
|
||||
this.webSocketService.observeKey<LayoutCommand>('dashboard').subscribe((event) => {
|
||||
this.command_handlers[event.data.command](event.data);
|
||||
this.changeDetectorRef.detectChanges();
|
||||
});
|
||||
}
|
||||
|
||||
layoutHandler(data: LayoutCommand) {
|
||||
if (config.dashboard.enabledLayouts.includes(data.layout)) {
|
||||
this.setLayout(data.layout);
|
||||
|
Loading…
Reference in New Issue
Block a user