ing
This commit is contained in:
parent
778fe832c7
commit
ddaec79ab6
|
@ -30,6 +30,7 @@
|
||||||
"src/assets"
|
"src/assets"
|
||||||
],
|
],
|
||||||
"styles": [
|
"styles": [
|
||||||
|
"node_modules/primeicons/primeicons.css",
|
||||||
"node_modules/primeng/resources/primeng.min.css",
|
"node_modules/primeng/resources/primeng.min.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
],
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
"karma-jasmine": "~1.1.1",
|
"karma-jasmine": "~1.1.1",
|
||||||
"ngrx-store-freeze": "^0.2.4",
|
"ngrx-store-freeze": "^0.2.4",
|
||||||
"npm-run-all": "^4.1.3",
|
"npm-run-all": "^4.1.3",
|
||||||
|
"primeicons": "^1.0.0-beta.10",
|
||||||
"primeng": "^6.1.3",
|
"primeng": "^6.1.3",
|
||||||
"primer-support": "^4.0.0",
|
"primer-support": "^4.0.0",
|
||||||
"protractor": "~5.3.0",
|
"protractor": "~5.3.0",
|
||||||
|
|
|
@ -80,6 +80,8 @@
|
||||||
</p-card>
|
</p-card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p-confirmDialog></p-confirmDialog>
|
||||||
|
|
||||||
<p-sidebar [(visible)]="displaySidebar" styleClass="ui-sidebar-md" position="right" (onHide)="onHideDetail()">
|
<p-sidebar [(visible)]="displaySidebar" styleClass="ui-sidebar-md" position="right" (onHide)="onHideDetail()">
|
||||||
<div *ngIf="selectedNode !== null">
|
<div *ngIf="selectedNode !== null">
|
||||||
<app-node-detail [node]="selectedNode" (otherHostSelect)="otherHostSelected($event)"></app-node-detail>
|
<app-node-detail [node]="selectedNode" (otherHostSelect)="otherHostSelected($event)"></app-node-detail>
|
||||||
|
|
|
@ -1,27 +1,34 @@
|
||||||
|
|
||||||
import { Component, OnInit, OnDestroy, ViewChild, ElementRef, ChangeDetectorRef, HostListener } from '@angular/core';
|
import { Component, OnInit, OnDestroy, ViewChild, ElementRef, ChangeDetectorRef, HostListener } from '@angular/core';
|
||||||
|
|
||||||
|
import { Subject, Subscription, of } from 'rxjs';
|
||||||
import { ProbeService, requesterID } from '../../../commons/service/probe.service';
|
import { map, catchError, take } from 'rxjs/operators';
|
||||||
|
|
||||||
import { Zone, Host, Port, Service, DiscoverHost } from '@overflow/model/discovery';
|
|
||||||
|
|
||||||
import { RPCSubscriber } from '@overflow/commons/ui/decorator/RPCSubscriber';
|
|
||||||
import { DiscoveryConfigService } from '../../../commons/service/discovery-config.service';
|
|
||||||
|
|
||||||
import * as d3 from 'd3';
|
import * as d3 from 'd3';
|
||||||
import { Node } from '../../../commons/model/node';
|
|
||||||
import { Link } from '../../../commons/model/link';
|
|
||||||
|
|
||||||
|
import { ConfirmationService } from 'primeng/primeng';
|
||||||
|
|
||||||
|
import { Zone, Host, Port, Service, DiscoverHost } from '@overflow/model/discovery';
|
||||||
|
import { RPCSubscriber } from '@overflow/commons/ui/decorator/RPCSubscriber';
|
||||||
|
import { TypeUtil } from '@overflow/core-js';
|
||||||
import { RPCError } from '@overflow/rpc-js';
|
import { RPCError } from '@overflow/rpc-js';
|
||||||
import { toMetaIPType, MetaIPTypeEnum, toMetaCryptoType, MetaCryptoTypeEnum, toMetaPortType, MetaPortTypeEnum } from '@overflow/model/meta';
|
import { toMetaIPType, MetaIPTypeEnum, toMetaCryptoType, MetaCryptoTypeEnum, toMetaPortType, MetaPortTypeEnum } from '@overflow/model/meta';
|
||||||
import { DiscoveryModeType } from '@overflow/model/discovery/discovery';
|
import { DiscoveryModeType } from '@overflow/model/discovery/discovery';
|
||||||
import { PingResult } from '@overflow/model/ping';
|
import { PingResult } from '@overflow/model/ping';
|
||||||
|
|
||||||
|
import { ProbeService, requesterID } from '../../../commons/service/probe.service';
|
||||||
|
import { DiscoveryConfigService } from '../../../commons/service/discovery-config.service';
|
||||||
|
import { Node } from '../../../commons/model/node';
|
||||||
|
import { Link } from '../../../commons/model/link';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-pages-home',
|
selector: 'app-pages-home',
|
||||||
templateUrl: './home-page.component.html',
|
templateUrl: './home-page.component.html',
|
||||||
styleUrls: ['./home-page.component.scss'],
|
styleUrls: ['./home-page.component.scss'],
|
||||||
|
providers: [
|
||||||
|
ConfirmationService,
|
||||||
|
],
|
||||||
})
|
})
|
||||||
export class HomePageComponent implements OnInit, OnDestroy {
|
export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
|
@ -45,15 +52,16 @@ 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;
|
|
||||||
private discoveryRequestID: string | null;
|
|
||||||
private readonly maxScale: number;
|
private readonly maxScale: number;
|
||||||
private readonly minScale: number;
|
private readonly minScale: number;
|
||||||
|
|
||||||
|
private discoveryStartDate: Date;
|
||||||
|
private 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[];
|
resultMsg: string[];
|
||||||
|
private preventBrowserCloseSubject: Subject<void>;
|
||||||
|
private preventBrowserCloseSubscription: Subscription;
|
||||||
|
|
||||||
@HostListener('window:resize', ['$event'])
|
@HostListener('window:resize', ['$event'])
|
||||||
onResize(event) {
|
onResize(event) {
|
||||||
|
@ -69,11 +77,11 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('window:beforeunload', ['$event'])
|
@HostListener('window:beforeunload', ['$event'])
|
||||||
onBeforeUnload(event) {
|
onBeforeUnload($event: Event) {
|
||||||
if (null !== this.discoveryRequestID) {
|
if (null !== this.discoveryRequestID) {
|
||||||
this.probeService.send('DiscoveryService.DiscoverStop', requesterID, this.discoveryRequestID);
|
this.preventBrowserCloseSubject.next();
|
||||||
|
$event.returnValue = true;
|
||||||
}
|
}
|
||||||
// event.returnValue = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewChild('discoveryTarget') set discoveryTarget(content: ElementRef) {
|
@ViewChild('discoveryTarget') set discoveryTarget(content: ElementRef) {
|
||||||
|
@ -82,18 +90,20 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private changeDetector: ChangeDetectorRef,
|
private changeDetector: ChangeDetectorRef,
|
||||||
|
private confirmationService: ConfirmationService,
|
||||||
private probeService: ProbeService,
|
private probeService: ProbeService,
|
||||||
private discoveryConfigService: DiscoveryConfigService,
|
private discoveryConfigService: DiscoveryConfigService,
|
||||||
) {
|
) {
|
||||||
this.nodes = [];
|
this.nodes = [];
|
||||||
this.links = [];
|
this.links = [];
|
||||||
|
this.maxScale = 1;
|
||||||
|
this.minScale = 0.7;
|
||||||
|
|
||||||
this.hosts = new Map();
|
this.hosts = new Map();
|
||||||
this.ports = new Map();
|
this.ports = new Map();
|
||||||
|
|
||||||
this.discoveryRequestID = null;
|
this.discoveryRequestID = null;
|
||||||
|
this.preventBrowserCloseSubject = new Subject<void>();
|
||||||
this.maxScale = 1;
|
|
||||||
this.minScale = 0.7;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -114,10 +124,31 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.preventBrowserCloseSubscription = this.preventBrowserCloseSubject
|
||||||
|
.pipe(
|
||||||
|
map(() => {
|
||||||
|
this.confirmationService.confirm({
|
||||||
|
message: 'Discovery is in progress.',
|
||||||
|
header: 'Alert',
|
||||||
|
icon: 'pi pi-info-circle',
|
||||||
|
acceptLabel: 'Yes',
|
||||||
|
acceptVisible: true,
|
||||||
|
rejectVisible: false,
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
catchError(error => {
|
||||||
|
console.log(error);
|
||||||
|
alert('An error has occurred.');
|
||||||
|
return of();
|
||||||
|
}),
|
||||||
|
take(1)
|
||||||
|
)
|
||||||
|
.subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.probeService.unsubscribeNotification(this);
|
this.probeService.unsubscribeNotification(this);
|
||||||
|
this.preventBrowserCloseSubscription.unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
blockDocument() {
|
blockDocument() {
|
||||||
|
@ -635,8 +666,6 @@ export class HomePageComponent implements OnInit, OnDestroy {
|
||||||
this.resultMsg.push(hostCount + '');
|
this.resultMsg.push(hostCount + '');
|
||||||
this.resultMsg.push(serviceCount + '');
|
this.resultMsg.push(serviceCount + '');
|
||||||
this.resultMsg.push(hours + ':' + minutes + ':' + seconds);
|
this.resultMsg.push(hours + ':' + minutes + ':' + seconds);
|
||||||
|
|
||||||
// this.simulation.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6005,6 +6005,10 @@ pretty-error@^2.0.2:
|
||||||
renderkid "^2.0.1"
|
renderkid "^2.0.1"
|
||||||
utila "~0.4"
|
utila "~0.4"
|
||||||
|
|
||||||
|
primeicons@^1.0.0-beta.10:
|
||||||
|
version "1.0.0-beta.10"
|
||||||
|
resolved "https://nexus.loafle.net/repository/npm-all/primeicons/-/primeicons-1.0.0-beta.10.tgz#b1a27a8a279c0b28d4bd537a29709b39cfebbd9f"
|
||||||
|
|
||||||
primeng@^6.1.3:
|
primeng@^6.1.3:
|
||||||
version "6.1.3"
|
version "6.1.3"
|
||||||
resolved "https://nexus.loafle.net/repository/npm-all/primeng/-/primeng-6.1.3.tgz#720590da9e671fd47de15911636d1c0a7a442852"
|
resolved "https://nexus.loafle.net/repository/npm-all/primeng/-/primeng-6.1.3.tgz#720590da9e671fd47de15911636d1c0a7a442852"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user