From 97ed48b408fc4b662cccba48bf2d45877193f7af Mon Sep 17 00:00:00 2001 From: Gabor PEK Date: Mon, 12 Mar 2018 15:03:38 +0100 Subject: [PATCH] Move deploy blur logic to parent component --- src/app/dashboard/dashboard.component.html | 4 +++- src/app/dashboard/dashboard.component.scss | 5 +++++ src/app/dashboard/dashboard.component.ts | 24 +++++++++++++++++++--- src/app/login/login.component.html | 4 +--- src/app/login/login.component.scss | 3 --- src/app/login/login.component.ts | 19 ++--------------- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/app/dashboard/dashboard.component.html b/src/app/dashboard/dashboard.component.html index 1c89e60..56499d4 100755 --- a/src/app/dashboard/dashboard.component.html +++ b/src/app/dashboard/dashboard.component.html @@ -1,7 +1,9 @@
-
+
+ +
diff --git a/src/app/dashboard/dashboard.component.scss b/src/app/dashboard/dashboard.component.scss index 25c25fa..5e6dee3 100755 --- a/src/app/dashboard/dashboard.component.scss +++ b/src/app/dashboard/dashboard.component.scss @@ -107,3 +107,8 @@ $layout: ( } } + +.deploy-blur { + filter: blur(3px); +} + diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index c6740c4..5cbdb86 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -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(); + } + } } diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index 56df332..75f908c 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -1,4 +1,4 @@ -
+

Login page

@@ -31,6 +31,4 @@ You don't have admin privileges.

-
- diff --git a/src/app/login/login.component.scss b/src/app/login/login.component.scss index adbd706..e69de29 100644 --- a/src/app/login/login.component.scss +++ b/src/app/login/login.component.scss @@ -1,3 +0,0 @@ -.deploy-blur { - filter: blur(3px); -} diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 0cbc273..c50b681 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -10,17 +10,14 @@ import {Subscription} from 'rxjs/Subscription'; templateUrl: './login.component.html', styleUrls: ['./login.component.scss'] }) -export class LoginComponent implements OnInit, OnDestroy { +export class LoginComponent { model = new Login('', ''); submitted = false; is_admin: boolean; logged_in_email: string; - deploying = false; - deploymentNotificationSubscription: Subscription; constructor( - private http: HttpClient, - private deploymentNotificationService: DeploymentNotificationService + private http: HttpClient ) {} onSubmit() { @@ -36,16 +33,4 @@ export class LoginComponent implements OnInit, OnDestroy { postLogin(login: Login): Observable { return this.http.post('/login', login); } - - ngOnInit() { - this.deploymentNotificationSubscription = this.deploymentNotificationService.deploying.subscribe( - (deploying) => this.deploying = deploying - ); - } - - ngOnDestroy() { - if (this.deploymentNotificationSubscription) { - this.deploymentNotificationSubscription.unsubscribe(); - } - } }