Move deploy blur logic to parent component

This commit is contained in:
Gabor PEK
2018-03-12 15:03:38 +01:00
parent 8f4a6fd83e
commit 97ed48b408
6 changed files with 32 additions and 27 deletions

View File

@ -1,10 +1,28 @@
import { Component } from '@angular/core';
import {Component, OnDestroy, OnInit} from '@angular/core';
import {DeploymentNotificationService} from '../services/deployment-notification.service';
import {Subscription} from 'rxjs/Subscription';
@Component({
selector: 'app-dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent {
constructor() {}
export class DashboardComponent implements OnInit, OnDestroy {
deploying = false;
deploymentNotificationSubscription: Subscription;
constructor(private deploymentNotificationService: DeploymentNotificationService) {}
ngOnInit() {
this.deploymentNotificationSubscription = this.deploymentNotificationService.deploying.subscribe(
(deploying) => this.deploying = deploying
);
}
ngOnDestroy() {
if (this.deploymentNotificationSubscription) {
this.deploymentNotificationSubscription.unsubscribe();
}
}
}