From 5b3a12231d9904ac1db1da4728274a92e7175014 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 14 Sep 2018 02:15:11 +0900 Subject: [PATCH] ing --- src/app/pages/home/home-page.component.ts | 20 +++++++++++++++++++ .../component/nic-dropdown.component.ts | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/app/pages/home/home-page.component.ts b/src/app/pages/home/home-page.component.ts index e686458..dc57f8e 100644 --- a/src/app/pages/home/home-page.component.ts +++ b/src/app/pages/home/home-page.component.ts @@ -44,6 +44,7 @@ export class HomePageComponent implements OnInit, OnDestroy { private discoveryContainerWidth: number; private discoveryContainerHeight: number; private discoveryStartDate: Date; + private discoveryRequestID: string; hosts: Host[]; ports: Port[]; @@ -61,6 +62,19 @@ export class HomePageComponent implements OnInit, OnDestroy { } } + @HostListener('window:beforeunload', ['$event']) + onBeforeUnload(event) { + this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID); + // event.returnValue = true; + } + + @HostListener('window:onunload', ['$event']) + onUnload(event) { + + } + + + @ViewChild('discoveryTarget') set discoveryTarget(content: ElementRef) { this.discoveryTargetRef = content; } @@ -93,6 +107,8 @@ export class HomePageComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { + + this.probeService.unsubscribeNotification(this); } @@ -446,6 +462,7 @@ export class HomePageComponent implements OnInit, OnDestroy { @RPCSubscriber({ method: 'DiscoveryService.Queueing' }) public DiscoveryQueueing(requestID: string, queueingDate: Date) { console.log('DiscoveryQueueing', requestID, queueingDate); + this.discoveryRequestID = requestID; } /** @@ -462,6 +479,7 @@ export class HomePageComponent implements OnInit, OnDestroy { @RPCSubscriber({ method: 'DiscoveryService.QueueingTimeout' }) public DiscoveryQueueingTimeout(queueingTimeoutDate: Date) { console.log('DiscoveryQueueingTimeout', queueingTimeoutDate); + this.discoveryRequestID = ''; } /** @@ -480,6 +498,8 @@ export class HomePageComponent implements OnInit, OnDestroy { public DiscoveryStop(stopDate: Date) { console.log('DiscoveryStop', stopDate); + this.discoveryRequestID = ''; + const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime()); const _seconds = _millisecond / 1000; diff --git a/src/commons/component/nic-dropdown.component.ts b/src/commons/component/nic-dropdown.component.ts index c81e38d..f13ea87 100644 --- a/src/commons/component/nic-dropdown.component.ts +++ b/src/commons/component/nic-dropdown.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit, EventEmitter, Output, ViewChild } from '@angular/core'; +import { Component, Input, OnInit, EventEmitter, Output, ViewChild, OnDestroy } from '@angular/core'; import { of } from 'rxjs'; import { catchError, map, take } from 'rxjs/operators'; @@ -25,6 +25,7 @@ class NICInfo { styleUrls: ['./nic-dropdown.component.scss'], }) export class NicDropdownComponent implements OnInit { + @Input() blockTarget: any; @Output() select = new EventEmitter(); @ViewChild('panel') panel: DropdownPanelComponent;