diff options
author | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-04-20 00:12:42 +0000 |
---|---|---|
committer | Danijel Andjelkovic <adanijel99@gmail.com> | 2022-04-20 00:12:42 +0000 |
commit | b814ef17d31dca80a3f23b3fbe4ce56885192a4c (patch) | |
tree | d7a297db46d57267b5516a8c20ee906dd39571ed /frontend/src/app/_elements/notifications/notifications.component.ts | |
parent | 9a480b28ac9b93dee082925b9cb4beef3244b135 (diff) | |
parent | e6d9e3fd2dcf83c90db8560e749544dfd9910d07 (diff) |
Merge branch 'dev' into 'master'
Merge master
See merge request igrannonica/neuronstellar!27
Diffstat (limited to 'frontend/src/app/_elements/notifications/notifications.component.ts')
-rw-r--r-- | frontend/src/app/_elements/notifications/notifications.component.ts | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/frontend/src/app/_elements/notifications/notifications.component.ts b/frontend/src/app/_elements/notifications/notifications.component.ts index e199f70a..f324662a 100644 --- a/frontend/src/app/_elements/notifications/notifications.component.ts +++ b/frontend/src/app/_elements/notifications/notifications.component.ts @@ -21,13 +21,33 @@ export class NotificationsComponent implements OnInit { 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)); + this.signalRService.hubConnection.on("NotifyEpoch", (mName: string, mId: string, stat: string, totalEpochs: number, currentEpoch: number) => { + const existingNotification = this.notifications.find(x => x.id === mId) + const progress = ((currentEpoch + 1) / totalEpochs); + //console.log("Ukupno epoha", totalEpochs, "Trenutna epoha:", currentEpoch); + if (!existingNotification) + this.notifications.push(new Notification(`Treniranje modela: ${mName}`, mId, progress, true)); + else { + existingNotification.progress = progress; + } + }); + + this.signalRService.hubConnection.on("NotifyModel", (mName: string, mId: string, stat: string, totalEpochs: number, currentEpoch: number) => { + const existingNotification = this.notifications.find(x => x.id === mId) + const progress = ((currentEpoch + 1) / totalEpochs); + if (!existingNotification) + this.notifications.push(new Notification(`Treniranje modela: ${mName}`, mId, progress, true)); + else { + existingNotification.progress = progress; + } }); } else { console.warn("Notifications: No connection!"); } } + removeNotification(notification: Notification) { + this.notifications.splice(this.notifications.indexOf(notification), 1); + } + } |