mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-06-28 23:25:13 +00:00
Sidebar icons are now highlighted and focus works when instrumented from backend
This commit is contained in:
@ -1,22 +1,26 @@
|
||||
import { Component, OnDestroy, OnInit, ChangeDetectorRef } from '@angular/core';
|
||||
import { Component, OnDestroy, OnInit, ChangeDetectorRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { DeploymentNotificationService } from '../services/deployment-notification.service';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { WebSocketService } from '../services/websocket.service';
|
||||
import { LayoutCommand } from './layout-command';
|
||||
import { config } from '../config';
|
||||
import { SidebarComponent } from '../sidebar/sidebar.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dashboard',
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrls: ['./dashboard.component.scss']
|
||||
})
|
||||
export class DashboardComponent implements OnInit, OnDestroy {
|
||||
export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
deploying = false;
|
||||
deploymentNotificationSubscription: Subscription;
|
||||
enabledLayouts: Set<string> = config.dashboard.enabledLayouts;
|
||||
layout: string = config.dashboard.currentLayout ;
|
||||
command_handlers = {'layout': this.layoutHandler.bind(this)};
|
||||
|
||||
@ViewChild(SidebarComponent)
|
||||
private sidebarComponent: SidebarComponent;
|
||||
|
||||
constructor(private deploymentNotificationService: DeploymentNotificationService,
|
||||
private webSocketService: WebSocketService,
|
||||
private changeDetectorRef: ChangeDetectorRef) {}
|
||||
@ -32,6 +36,10 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
);
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.layout = this.sidebarComponent.layout;
|
||||
}
|
||||
|
||||
layoutHandler(data: LayoutCommand) {
|
||||
if (this.enabledLayouts.has(data.layout)) {
|
||||
this.layout = data.layout;
|
||||
|
Reference in New Issue
Block a user