VICE / Client / src / app / manager / manager.component.ts
manager.component.ts
Raw
import { Component, OnInit } from '@angular/core';
import { map } from 'rxjs/operators';
import { interval } from 'rxjs';
import { Breakpoints, BreakpointObserver } from '@angular/cdk/layout';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { IssueService } from '../issue.service';
import { ServerDataService } from '../server-data.service';

@Component({
  selector: 'app-manager',
  templateUrl: './manager.component.html',
  styleUrls: ['./manager.component.css']
})
export class ManagerComponent{
  cards = this.breakpointObserver.observe(Breakpoints.Handset).pipe(
    map(({ matches }) => {
      if (matches) {
        return [

          { title: 'Issue Summary', cols: 2, rows: 1 }

        ];
      }

      return [

        { title: 'Issue Summary', cols: 2, rows: 1 }

      ];
    })
  );

  public issues: any;
  public vms: any;
  public fws: any;
  public now: number = Date.now();
  private timer = interval(60000);
  math = Math;
  issueID: string;
  header: any;

   constructor(private breakpointObserver: BreakpointObserver, private http: HttpClient,
               private dataService: ServerDataService)
  {
    this.issueID = "";
  }


  ngOnInit()
  {
    this.dataService.issueList
    .subscribe( (data:any) => {
      this.issues = data;
    });

    this.dataService.vmList
    .subscribe( (data:any) => {
      this.vms = data;
    });

    this.dataService.fwList
    .subscribe( (data:any) => {
      this.fws = data;
    });

    this.timer.subscribe( () => {
      this.now = Date.now();
    });

  }

}