]>
Commit | Line | Data |
---|---|---|
1911f103 | 1 | import { Component, OnDestroy, OnInit } from '@angular/core'; |
11fdf7f2 | 2 | |
1911f103 | 3 | import { Subscription } from 'rxjs'; |
11fdf7f2 | 4 | |
9f95a23c | 5 | import { Icons } from '../../../shared/enum/icons.enum'; |
11fdf7f2 | 6 | import { NotificationService } from '../../../shared/services/notification.service'; |
9f95a23c | 7 | import { SummaryService } from '../../../shared/services/summary.service'; |
11fdf7f2 TL |
8 | |
9 | @Component({ | |
10 | selector: 'cd-notifications', | |
11 | templateUrl: './notifications.component.html', | |
12 | styleUrls: ['./notifications.component.scss'] | |
13 | }) | |
1911f103 | 14 | export class NotificationsComponent implements OnInit, OnDestroy { |
9f95a23c | 15 | icons = Icons; |
9f95a23c | 16 | hasRunningTasks = false; |
1911f103 | 17 | private subs = new Subscription(); |
11fdf7f2 TL |
18 | |
19 | constructor( | |
20 | public notificationService: NotificationService, | |
9f95a23c TL |
21 | private summaryService: SummaryService |
22 | ) {} | |
11fdf7f2 TL |
23 | |
24 | ngOnInit() { | |
1911f103 | 25 | this.subs.add( |
f6b5b4d7 TL |
26 | this.summaryService.subscribe((summary) => { |
27 | this.hasRunningTasks = summary.executing_tasks.length > 0; | |
1911f103 TL |
28 | }) |
29 | ); | |
30 | } | |
31 | ||
32 | ngOnDestroy(): void { | |
33 | this.subs.unsubscribe(); | |
11fdf7f2 TL |
34 | } |
35 | ||
9f95a23c TL |
36 | toggleSidebar() { |
37 | this.notificationService.toggleSidebar(); | |
11fdf7f2 TL |
38 | } |
39 | } |