This commit is contained in:
crusader 2018-09-14 02:15:11 +09:00
parent 29cf1bb868
commit 5b3a12231d
2 changed files with 22 additions and 1 deletions

View File

@ -44,6 +44,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
private discoveryContainerWidth: number; private discoveryContainerWidth: number;
private discoveryContainerHeight: number; private discoveryContainerHeight: number;
private discoveryStartDate: Date; private discoveryStartDate: Date;
private discoveryRequestID: string;
hosts: Host[]; hosts: Host[];
ports: Port[]; 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) { @ViewChild('discoveryTarget') set discoveryTarget(content: ElementRef) {
this.discoveryTargetRef = content; this.discoveryTargetRef = content;
} }
@ -93,6 +107,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
} }
ngOnDestroy(): void { ngOnDestroy(): void {
this.probeService.unsubscribeNotification(this); this.probeService.unsubscribeNotification(this);
} }
@ -446,6 +462,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
@RPCSubscriber({ method: 'DiscoveryService.Queueing' }) @RPCSubscriber({ method: 'DiscoveryService.Queueing' })
public DiscoveryQueueing(requestID: string, queueingDate: Date) { public DiscoveryQueueing(requestID: string, queueingDate: Date) {
console.log('DiscoveryQueueing', requestID, queueingDate); console.log('DiscoveryQueueing', requestID, queueingDate);
this.discoveryRequestID = requestID;
} }
/** /**
@ -462,6 +479,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
@RPCSubscriber({ method: 'DiscoveryService.QueueingTimeout' }) @RPCSubscriber({ method: 'DiscoveryService.QueueingTimeout' })
public DiscoveryQueueingTimeout(queueingTimeoutDate: Date) { public DiscoveryQueueingTimeout(queueingTimeoutDate: Date) {
console.log('DiscoveryQueueingTimeout', queueingTimeoutDate); console.log('DiscoveryQueueingTimeout', queueingTimeoutDate);
this.discoveryRequestID = '';
} }
/** /**
@ -480,6 +498,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
public DiscoveryStop(stopDate: Date) { public DiscoveryStop(stopDate: Date) {
console.log('DiscoveryStop', stopDate); console.log('DiscoveryStop', stopDate);
this.discoveryRequestID = '';
const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime()); const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime());
const _seconds = _millisecond / 1000; const _seconds = _millisecond / 1000;

View File

@ -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 { of } from 'rxjs';
import { catchError, map, take } from 'rxjs/operators'; import { catchError, map, take } from 'rxjs/operators';
@ -25,6 +25,7 @@ class NICInfo {
styleUrls: ['./nic-dropdown.component.scss'], styleUrls: ['./nic-dropdown.component.scss'],
}) })
export class NicDropdownComponent implements OnInit { export class NicDropdownComponent implements OnInit {
@Input() blockTarget: any; @Input() blockTarget: any;
@Output() select = new EventEmitter<Zone>(); @Output() select = new EventEmitter<Zone>();
@ViewChild('panel') panel: DropdownPanelComponent; @ViewChild('panel') panel: DropdownPanelComponent;