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

90% Statements 9/10
100% Branches 2/2
80% Functions 4/5
88.88% Lines 8/9

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 33 34 35 36 37 38 39 40 41 42 43                          92x             1x 1x         1x 1x   1x 1x 1x                      
import { Component, OnInit } from '@angular/core';
import { Event } from '../../models/events';
import { ActivatedRoute } from '@angular/router';
import { TwinpadApiService } from '../../services/twinpad-api.service';
import { DatePipe, NgIf } from '@angular/common';
import { SignalsGraphsComponent } from '../signals-graphs/signals-graphs.component';
import { HttpErrorResponse } from '@angular/common/http';
@Component({
  selector: 'app-event',
  imports: [DatePipe, NgIf, SignalsGraphsComponent],
  templateUrl: './event.component.html',
  styleUrl: './event.component.scss'
})
export class EventComponent implements OnInit{
  eventId: string;
  event: Event;
  error: HttpErrorResponse;
  eventDate: number;
  signalIds: string[];
 
  constructor(private twinpadApiService: TwinpadApiService,
    private route: ActivatedRoute
    ) {}
 
  ngOnInit() {
 
    this.eventId = this.route.snapshot.params['event_id'];
    this.twinpadApiService.getEvent(this.eventId)
    .subscribe({next: (data: Event) => {
      this.event = data;
      this.eventDate = 1000*this.event.timestamp;
      this.signalIds = this.event.event_rule.signalIds();
    },
      error: (error)=>{
        this.error = error;
      }
    });
 
  }
 
 
}