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