ㅑ후
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 discoveryContainerWidth: number;
|
||||
private discoveryContainerHeight: number;
|
||||
private discoveryStartDate: Date;
|
||||
|
||||
hosts: Host[];
|
||||
ports: Port[];
|
||||
|
@ -389,10 +390,9 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
|||
zoomToFit(paddingPercent, transitionDuration) {
|
||||
const root = d3.select(this.discoveryTargetRef.nativeElement);
|
||||
const bounds = root.node().getBBox();
|
||||
const parent = root.node().parentElement;
|
||||
|
||||
const fullWidth = parent.clientWidth;
|
||||
const fullHeight = parent.clientHeight;
|
||||
const fullWidth = this.discoveryContainerWidth;
|
||||
const fullHeight = this.discoveryContainerHeight;
|
||||
|
||||
const width = bounds.width;
|
||||
const height = bounds.height;
|
||||
|
@ -470,6 +470,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
|||
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryStart' })
|
||||
public DiscoveryStart(startDate: Date) {
|
||||
console.log('DiscoveryStart', startDate);
|
||||
this.discoveryStartDate = startDate;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -478,6 +479,38 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
|||
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryStop' })
|
||||
public DiscoveryStop(stopDate: Date) {
|
||||
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.simulationRestart(true);
|
||||
this.zoomToFit(0.95, 500);
|
||||
|
|
Loading…
Reference in New Issue
Block a user