discovery result modified
This commit is contained in:
parent
316b2d033d
commit
dd15424eec
|
@ -68,15 +68,15 @@
|
||||||
</g>
|
</g>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
<p-card class="ui-map-info" *ngIf="resultMsg">
|
<p-card class="ui-map-info" *ngIf="discoveryResult">
|
||||||
<div class="ui-map-info-row ui-border-bottom">
|
<div class="ui-map-info-row ui-border-bottom">
|
||||||
<div>Total Hosts: </div>{{resultMsg[0]}}
|
<div>Total Hosts: </div>{{discoveryResult.totalHosts}}
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-map-info-row ui-border-bottom">
|
<div class="ui-map-info-row ui-border-bottom">
|
||||||
<div>Total Services: </div>{{resultMsg[1]}}
|
<div>Total Services: </div>{{discoveryResult.totalServices}}
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-map-info-row">
|
<div class="ui-map-info-row">
|
||||||
<div>Elapsed: </div>{{resultMsg[2]}}
|
<div>Elapsed: </div>{{discoveryResult.elapsedTime}}
|
||||||
</div>
|
</div>
|
||||||
</p-card>
|
</p-card>
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,52 @@ import { Node } from '../../../commons/model/node';
|
||||||
import { Link } from '../../../commons/model/link';
|
import { Link } from '../../../commons/model/link';
|
||||||
|
|
||||||
|
|
||||||
|
export class DiscoveryResult {
|
||||||
|
totalHosts: number;
|
||||||
|
totalServices: number;
|
||||||
|
elapsedTime: string;
|
||||||
|
|
||||||
|
hTimer: any;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.totalHosts = 0;
|
||||||
|
this.totalServices = 0;
|
||||||
|
this.elapsedTime = '00:00:00';
|
||||||
|
}
|
||||||
|
|
||||||
|
start() {
|
||||||
|
const __this = this;
|
||||||
|
const startTime = new Date().getTime();
|
||||||
|
this.hTimer = setInterval(function () {
|
||||||
|
// Get todays date and time
|
||||||
|
const now = new Date().getTime();
|
||||||
|
|
||||||
|
// Find the distance between now and the count down date
|
||||||
|
const distance = now - startTime;
|
||||||
|
|
||||||
|
// Time calculations for days, hours, minutes and seconds
|
||||||
|
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
|
||||||
|
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||||
|
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
||||||
|
|
||||||
|
__this.elapsedTime = hours + ':' + minutes + ':' + seconds;
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
stop(elapsedTime: string) {
|
||||||
|
clearInterval(this.hTimer);
|
||||||
|
this.elapsedTime = elapsedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
increaseHost() {
|
||||||
|
this.totalHosts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
increaseService() {
|
||||||
|
this.totalServices++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-pages-home',
|
selector: 'app-pages-home',
|
||||||
templateUrl: './home-page.component.html',
|
templateUrl: './home-page.component.html',
|
||||||
|
@ -58,7 +104,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
discoveryRequestID: string | null;
|
discoveryRequestID: string | null;
|
||||||
hosts: Map<string, Host>;
|
hosts: Map<string, Host>;
|
||||||
ports: Map<string, Map<number, Port>>;
|
ports: Map<string, Map<number, Port>>;
|
||||||
resultMsg: string[];
|
discoveryResult: DiscoveryResult;
|
||||||
private preventBrowserCloseSubject: Subject<void>;
|
private preventBrowserCloseSubject: Subject<void>;
|
||||||
private preventBrowserCloseSubscription: Subscription;
|
private preventBrowserCloseSubscription: Subscription;
|
||||||
|
|
||||||
|
@ -103,6 +149,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.discoveryRequestID = null;
|
this.discoveryRequestID = null;
|
||||||
this.preventBrowserCloseSubject = new Subject<void>();
|
this.preventBrowserCloseSubject = new Subject<void>();
|
||||||
|
this.discoveryResult = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -187,7 +234,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
console.log(this.discoverHost);
|
console.log(this.discoverHost);
|
||||||
console.log('########################################################');
|
console.log('########################################################');
|
||||||
|
|
||||||
this.resultMsg = null;
|
this.discoveryResult = new DiscoveryResult();
|
||||||
this.showIntro = false;
|
this.showIntro = false;
|
||||||
this.changeDetector.detectChanges();
|
this.changeDetector.detectChanges();
|
||||||
|
|
||||||
|
@ -630,6 +677,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
public DiscoveryStart(startDate: Date) {
|
public DiscoveryStart(startDate: Date) {
|
||||||
console.log('DiscoveryStart', startDate);
|
console.log('DiscoveryStart', startDate);
|
||||||
this.discoveryStartDate = startDate;
|
this.discoveryStartDate = startDate;
|
||||||
|
|
||||||
|
this.discoveryResult.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -677,10 +726,11 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
this.simulationRestart(true);
|
this.simulationRestart(true);
|
||||||
this.zoomToFit(0.95, 500);
|
this.zoomToFit(0.95, 500);
|
||||||
|
|
||||||
this.resultMsg = [];
|
this.discoveryResult.stop(hours + ':' + minutes + ':' + seconds);
|
||||||
this.resultMsg.push(hostCount + '');
|
// this.resultMsg = [];
|
||||||
this.resultMsg.push(serviceCount + '');
|
// this.resultMsg.push(hostCount + '');
|
||||||
this.resultMsg.push(hours + ':' + minutes + ':' + seconds);
|
// this.resultMsg.push(serviceCount + '');
|
||||||
|
// this.resultMsg.push(hours + ':' + minutes + ':' + seconds);
|
||||||
this.stopping = false;
|
this.stopping = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -738,6 +788,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.nodes.push(hostNode);
|
this.nodes.push(hostNode);
|
||||||
this.links.push(new Link(this.zoneNode, hostNode));
|
this.links.push(new Link(this.zoneNode, hostNode));
|
||||||
|
|
||||||
|
this.discoveryResult.increaseHost();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.simulationRestart();
|
this.simulationRestart();
|
||||||
|
@ -784,6 +836,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
this.nodes.push(serviceNode);
|
this.nodes.push(serviceNode);
|
||||||
this.links.push(new Link(hostNode, serviceNode));
|
this.links.push(new Link(hostNode, serviceNode));
|
||||||
|
|
||||||
|
this.discoveryResult.increaseService();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.simulationRestart();
|
this.simulationRestart();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user