aboutsummaryrefslogtreecommitdiff
path: root/frontend/src/app/_elements/notifications
diff options
context:
space:
mode:
authorSonja Galovic <galovicsonja@gmail.com>2022-04-13 22:44:06 +0200
committerSonja Galovic <galovicsonja@gmail.com>2022-04-13 22:44:06 +0200
commit5d856cf20177711074b473cc2d2133b85826fe63 (patch)
treec7029d75af6d53e40bf806c51f1f4fcfc2136104 /frontend/src/app/_elements/notifications
parent3c4bfb16f55aa51a50ee99327caca639e072cdab (diff)
parent3cb8b60ed4e36f39187e64270479f472e08fb615 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into dev
Diffstat (limited to 'frontend/src/app/_elements/notifications')
-rw-r--r--frontend/src/app/_elements/notifications/notifications.component.html5
-rw-r--r--frontend/src/app/_elements/notifications/notifications.component.ts22
2 files changed, 16 insertions, 11 deletions
diff --git a/frontend/src/app/_elements/notifications/notifications.component.html b/frontend/src/app/_elements/notifications/notifications.component.html
index 0b87e4fc..4e33f77c 100644
--- a/frontend/src/app/_elements/notifications/notifications.component.html
+++ b/frontend/src/app/_elements/notifications/notifications.component.html
@@ -1,6 +1,5 @@
-<div *ngIf="notifications" class="position-fixed card card-body p-1 m-3" style="bottom: 0; right: 0; width: 18rem;">
- <h2 class="m-auto" (click)="closed = !closed;" data-bs-toggle="collapse" href="#collapseNotifs" role="button"
- aria-expanded="true" aria-controls="collapseNotifs">Notifikacije
+<div *ngIf="notifications && notifications.length > 0" class="position-fixed card card-body p-1 m-3" style="bottom: 0; right: 0; width: 18rem;">
+ <h2 class="m-auto" (click)="closed = !closed;" data-bs-toggle="collapse" href="#collapseNotifs" role="button" aria-expanded="true" aria-controls="collapseNotifs">Notifikacije
<button class="border-0 bg-white">
<mat-icon class="position-absolute" style="top: 8px; right: 12px;">{{closed ? 'keyboard_arrow_up' :
'keyboard_arrow_down'}}</mat-icon>
diff --git a/frontend/src/app/_elements/notifications/notifications.component.ts b/frontend/src/app/_elements/notifications/notifications.component.ts
index 5863f669..cad8a95f 100644
--- a/frontend/src/app/_elements/notifications/notifications.component.ts
+++ b/frontend/src/app/_elements/notifications/notifications.component.ts
@@ -9,19 +9,25 @@ import Notification from 'src/app/_data/Notification';
})
export class NotificationsComponent implements OnInit {
- notifications?: Notification[];
+ notifications: Notification[] = [];
closed: boolean = false;
- constructor(private signalRService:SignalRService) {
- this.notifications = [
- new Notification("Titanik (Preziveli)", "79768456867", 0.2),
- new Notification("Test Prediktor 1", "56758768678", 0.4),
- new Notification("Test Prediktor 2", "11344556425", 0.7)
- ]
+ constructor(private signalRService: SignalRService) {
+
}
ngOnInit(): void {
- // this.wsService.send('test');
+ 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!");
+ }
}
}