aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/notifications/notifications.component.ts
blob: e199f70a8eea51c58ce681b0735bc08224f45d7a (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", (dName: string, dId: string) => {
        this.notifications.push(new Notification(`Obrađen izvor podataka: ${dName}`, dId, 1.0, false));
      });

      this.signalRService.hubConnection.on("NotifyEpoch", (epoch: string, mName: string, mId: string, numEpochs) => {
        //todo epoch
        this.notifications.push(new Notification(`Treniranje modela: ${mName}`, mId, 0.5));
      });
    } else {
      console.warn("Notifications: No connection!");
    }
  }

}