Sidebar icons are now highlighted and focus works when instrumented from backend

This commit is contained in:
Gabor PEK
2018-04-20 09:29:16 +02:00
committed by Kristóf Tóth
parent 3e249e8582
commit 5e3e619423
4 changed files with 29 additions and 10 deletions

View File

@ -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;