Project

General

Profile

« Previous | Next » 

Revision 57606

[Monitor Dashboard]: Add hasSidebar default true and if false is needed, should added on the route config

View differences:

sideBar.service.ts
1 1
import {Injectable} from "@angular/core";
2 2
import {BehaviorSubject, Observable} from "rxjs";
3
import {ActivationStart, Router} from "@angular/router";
3 4

  
4 5
@Injectable({
5 6
  providedIn: 'root'
......
17 18
   */
18 19
  private hasSidebarSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(true);
19 20

  
20
  constructor() {}
21
  constructor(private router: Router) {
22
    this.router.events.subscribe(event => {
23
      if (event instanceof ActivationStart) {
24
        let data = event.snapshot.data;
25
        if (this.hasSidebarSubject.value === true &&
26
          data['hasSidebar'] !== undefined &&
27
          data['hasSidebar'] === false) {
28
          this.setHasSidebar(false);
29
        } else if (this.hasSidebarSubject.value === false) {
30
          this.setHasSidebar(true);
31
        }
32
      }
33
    });
34
  }
21 35

  
22 36
  get open(): boolean {
23 37
    return this.openSubject.getValue();

Also available in: Unified diff