ㅑ후
This commit is contained in:
parent
79885e9a8c
commit
5f0f49c1be
|
@ -43,6 +43,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
private zoomBehavior: d3.ZoomBehavior<Element, {}>;
|
private zoomBehavior: d3.ZoomBehavior<Element, {}>;
|
||||||
private discoveryContainerWidth: number;
|
private discoveryContainerWidth: number;
|
||||||
private discoveryContainerHeight: number;
|
private discoveryContainerHeight: number;
|
||||||
|
private discoveryStartDate: Date;
|
||||||
|
|
||||||
hosts: Host[];
|
hosts: Host[];
|
||||||
ports: Port[];
|
ports: Port[];
|
||||||
|
@ -389,10 +390,9 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
zoomToFit(paddingPercent, transitionDuration) {
|
zoomToFit(paddingPercent, transitionDuration) {
|
||||||
const root = d3.select(this.discoveryTargetRef.nativeElement);
|
const root = d3.select(this.discoveryTargetRef.nativeElement);
|
||||||
const bounds = root.node().getBBox();
|
const bounds = root.node().getBBox();
|
||||||
const parent = root.node().parentElement;
|
|
||||||
|
|
||||||
const fullWidth = parent.clientWidth;
|
const fullWidth = this.discoveryContainerWidth;
|
||||||
const fullHeight = parent.clientHeight;
|
const fullHeight = this.discoveryContainerHeight;
|
||||||
|
|
||||||
const width = bounds.width;
|
const width = bounds.width;
|
||||||
const height = bounds.height;
|
const height = bounds.height;
|
||||||
|
@ -470,6 +470,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryStart' })
|
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryStart' })
|
||||||
public DiscoveryStart(startDate: Date) {
|
public DiscoveryStart(startDate: Date) {
|
||||||
console.log('DiscoveryStart', startDate);
|
console.log('DiscoveryStart', startDate);
|
||||||
|
this.discoveryStartDate = startDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -478,6 +479,38 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryStop' })
|
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryStop' })
|
||||||
public DiscoveryStop(stopDate: Date) {
|
public DiscoveryStop(stopDate: Date) {
|
||||||
console.log('DiscoveryStop', stopDate);
|
console.log('DiscoveryStop', stopDate);
|
||||||
|
|
||||||
|
const _millisecond = Math.abs(stopDate.getTime() - this.discoveryStartDate.getTime());
|
||||||
|
|
||||||
|
const _seconds = _millisecond / 1000;
|
||||||
|
const seconds = Math.floor(_seconds % 60);
|
||||||
|
const _minutes = _seconds / 60;
|
||||||
|
const minutes = Math.floor(_minutes % 60);
|
||||||
|
const _hours = _minutes / 60;
|
||||||
|
const hours = Math.floor(_hours % 24);
|
||||||
|
const days = Math.floor(_hours / 24);
|
||||||
|
|
||||||
|
console.log(`${days}일 ${hours}시 ${minutes}분 ${seconds}초`);
|
||||||
|
|
||||||
|
let hostCount = 0;
|
||||||
|
let serviceCount = 0;
|
||||||
|
|
||||||
|
this.nodes.forEach((node) => {
|
||||||
|
switch (node.group) {
|
||||||
|
case 'host':
|
||||||
|
hostCount++;
|
||||||
|
break;
|
||||||
|
case 'service':
|
||||||
|
serviceCount++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(`Host: ${hostCount}개 Service: ${serviceCount}개`);
|
||||||
|
|
||||||
this.discoveryConfigService.setStarted(false);
|
this.discoveryConfigService.setStarted(false);
|
||||||
this.simulationRestart(true);
|
this.simulationRestart(true);
|
||||||
this.zoomToFit(0.95, 500);
|
this.zoomToFit(0.95, 500);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user