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

90.9% Statements 10/11
100% Branches 2/2
75% Functions 3/4
90% Lines 9/10

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                          112x 1x 1x                   1x 1x   1x 1x 1x             111x        
import { Component, OnInit, inject } from '@angular/core';
import { Event } from '../../models/events';
import { ActivatedRoute } from '@angular/router';
import { TwinpadApiService } from '../../services/twinpad-api.service';
import { DatePipe } from '@angular/common';
import { SignalsGraphsComponent } from '../signals-graphs/signals-graphs.component';
import { HttpErrorResponse } from '@angular/common/http';
@Component({
  selector: 'app-event',
  imports: [DatePipe, SignalsGraphsComponent],
  templateUrl: './event.component.html',
  styleUrl: './event.component.scss'
})
export class EventComponent implements OnInit{
  private twinpadApiService = inject(TwinpadApiService);
  private route = inject(ActivatedRoute);
 
  eventId: string;
  event: Event;
  error: HttpErrorResponse;
  eventDate: number;
  signalIds: string[];
 
  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;
      }
    });
 
  }
 
 
}