aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/notifications/notifications.component.ts
blob: cad8a95f1b119cc10f60900454412abc611d741e (plain) (blame)
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
import { Component, OnInit } from '@angular/core';
import { SignalRService } from 'src/app/_services/signal-r.service';
import Notification from 'src/app/_data/Notification';

@Component({
  selector: 'app-notifications',
  templateUrl: './notifications.component.html',
  styleUrls: ['./notifications.component.css']
})
export class NotificationsComponent implements OnInit {

  notifications: Notification[] = [];
  closed: boolean = false;

  constructor(private signalRService: SignalRService) {

  }

  ngOnInit(): void {
    if (this.signalRService.hubConnection) {
      this.signalRService.hubConnection.on("NotifyDataset", (message: string) => {
        this.notifications.push(new Notification(message, "datasetIDOvde!!!", 1.0));
      });

      this.signalRService.hubConnection.on("NotifyEpoch", (message: string) => {
        this.notifications.push(new Notification(message, "predictorIDOvde!!!", 0.5 /*(epoch / model.epochs)*/));
      });
    } else {
      console.warn("Notifications: No connection!");
    }
  }

}