All files / src/app/components/dashboard dashboard.component.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 5/5
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                              182x       91x     46x 77x         80x      
import { Component, OnDestroy, OnInit } from '@angular/core';
import { TwinpadApiService } from '../../services/twinpad-api.service';
import { TwinPadStatus } from '../../models/status';
import { NgClass, NgIf } from '@angular/common';
import { TabsModule } from 'primeng/tabs';
import { Subscription } from 'rxjs';
 
import { CalendarHeatmapComponent } from '../calendar-heatmap/calendar-heatmap.component';
 
@Component({
    selector: 'app-dashboard',
    imports: [NgClass, NgIf, CalendarHeatmapComponent, TabsModule],
    templateUrl: './dashboard.component.html',
    styleUrl: './dashboard.component.scss'
})
export class DashboardComponent implements OnInit, OnDestroy {
  status: TwinPadStatus;
  subscription: Subscription;
 
  constructor(private twinpadApiService: TwinpadApiService){}
 
  ngOnInit() {
    this.subscription = this.twinpadApiService.cloudStatusBehaviorSubject$.subscribe(value => {
      this.status = value;
    });
  }
 
  ngOnDestroy(): void {
    this.subscription?.unsubscribe();
  }
}