]> git.proxmox.com Git - ceph.git/blame - ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.ts
import 15.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / core / navigation / notifications / notifications.component.ts
CommitLineData
1911f103 1import { Component, OnDestroy, OnInit } from '@angular/core';
11fdf7f2 2
1911f103 3import { Subscription } from 'rxjs';
11fdf7f2 4
9f95a23c 5import { Icons } from '../../../shared/enum/icons.enum';
11fdf7f2 6import { NotificationService } from '../../../shared/services/notification.service';
9f95a23c 7import { 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 14export 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}