-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';
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,
) {}
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() {