X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fcore%2Fnavigation%2Fnotifications%2Fnotifications.component.ts;h=aaedd546eff48a33d20136f97958840d2c3b9df8;hb=1911f103e16ae0d04db10fb41db8217ef4c320d3;hp=ec615cc4c1a4eb882655f0b4fa170897ec9c3bae;hpb=78f773100ed5d2ebc9d99e65a3d7e3a6f541a97e;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.ts index ec615cc4c..aaedd546e 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.ts @@ -1,6 +1,6 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnDestroy, OnInit } from '@angular/core'; -import * as _ from 'lodash'; +import { Subscription } from 'rxjs'; import { Icons } from '../../../shared/enum/icons.enum'; import { NotificationService } from '../../../shared/services/notification.service'; @@ -11,10 +11,10 @@ import { SummaryService } from '../../../shared/services/summary.service'; templateUrl: './notifications.component.html', styleUrls: ['./notifications.component.scss'] }) -export class NotificationsComponent implements OnInit { +export class NotificationsComponent implements OnInit, OnDestroy { icons = Icons; - hasRunningTasks = false; + private subs = new Subscription(); constructor( public notificationService: NotificationService, @@ -22,12 +22,18 @@ export class NotificationsComponent implements OnInit { ) {} ngOnInit() { - this.summaryService.subscribe((data: any) => { - if (!data) { - return; - } - this.hasRunningTasks = data.executing_tasks.length > 0; - }); + this.subs.add( + this.summaryService.subscribe((data: any) => { + if (!data) { + return; + } + this.hasRunningTasks = data.executing_tasks.length > 0; + }) + ); + } + + ngOnDestroy(): void { + this.subs.unsubscribe(); } toggleSidebar() {