discovery mode / result msg

This commit is contained in:
insanity 2018-09-14 16:54:00 +09:00
parent 5b3a12231d
commit fa8b1fcf5c
9 changed files with 49 additions and 11 deletions

View File

@ -74,7 +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",
"primeng": "^6.1.0", "primeng": "^6.1.3",
"primer-support": "^4.0.0", "primer-support": "^4.0.0",
"protractor": "~5.3.0", "protractor": "~5.3.0",
"source-map-support": "^0.5.8", "source-map-support": "^0.5.8",

View File

@ -72,6 +72,8 @@
</div> </div>
</p-sidebar> </p-sidebar>
<p-growl [(value)]="resultMsg" [sticky]="true"></p-growl>
<!-- <div class="ui-fluid"> <!-- <div class="ui-fluid">
<div class="ui-g"> <div class="ui-g">

View File

@ -15,6 +15,7 @@ import { Link } from '../../../commons/model/link';
import { RPCError } from '@overflow/rpc-js'; import { RPCError } from '@overflow/rpc-js';
import { toMetaIPType, MetaIPTypeEnum, toMetaCryptoType, MetaCryptoTypeEnum } from '@overflow/model/meta'; import { toMetaIPType, MetaIPTypeEnum, toMetaCryptoType, MetaCryptoTypeEnum } from '@overflow/model/meta';
import { Message } from 'primeng/primeng';
@Component({ @Component({
selector: 'app-pages-home', selector: 'app-pages-home',
@ -49,6 +50,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
hosts: Host[]; hosts: Host[];
ports: Port[]; ports: Port[];
resultMsg: Message[] = [];
@HostListener('window:resize', ['$event']) @HostListener('window:resize', ['$event'])
onResize(event) { onResize(event) {
if (undefined !== this.discoveryTargetRef) { if (undefined !== this.discoveryTargetRef) {
@ -148,6 +151,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
console.log(this.zone); console.log(this.zone);
console.log(this.discoverHost); console.log(this.discoverHost);
console.log('########################################################'); console.log('########################################################');
this.resultMsg = [];
this.showIntro = false; this.showIntro = false;
this.changeDetector.detectChanges(); this.changeDetector.detectChanges();
@ -534,9 +538,21 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.discoveryConfigService.setStarted(false); this.discoveryConfigService.setStarted(false);
this.simulationRestart(true); this.simulationRestart(true);
this.zoomToFit(0.95, 500); this.zoomToFit(0.95, 500);
const countSum = 'Host: ' + hostCount + ' / ' + 'Service: ' + serviceCount;
const timeSpentSum = hours + ':' + minutes + ':' + seconds;
this.resultMsg.push({ severity: 'success', summary: countSum, detail: timeSpentSum });
// this.simulation.stop(); // this.simulation.stop();
} }
/**
* DiscoveryMode
*/
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryMode' })
public DiscoveryMode(mode: string) {
this.discoveryConfigService.setDiscoveryMode(mode);
}
/** /**
* DiscoverHost * DiscoverHost
*/ */

View File

@ -19,6 +19,9 @@
</svg> </svg>
</button> </button>
</div> </div>
<div *ngIf="discoveryMode">
<span>{{discoveryMode}} Mode</span>
</div>
<!-- <div class="sidebar-section" style="width: 250px;"> <!-- <div class="sidebar-section" style="width: 250px;">
<div class="toolbar-dropdown closed" aria-expanded="false"> <div class="toolbar-dropdown closed" aria-expanded="false">

View File

@ -61,6 +61,8 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
rippleMouseDownListener: any; rippleMouseDownListener: any;
discoveryMode: string;
constructor( constructor(
public renderer: Renderer, public renderer: Renderer,
public zone: NgZone, public zone: NgZone,
@ -75,6 +77,9 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
return; return;
} }
this.zone.runOutsideAngular(() => { this.bindRipple(); }); this.zone.runOutsideAngular(() => { this.bindRipple(); });
this.discoveryConfigService.discoveryMode.subscribe(res => {
this.discoveryMode = res as string;
});
} }
bindRipple() { bindRipple() {

View File

@ -4,12 +4,15 @@
<!-- <svg _ngcontent-c1="" aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 10 16" width="16px" height="16px"> <!-- <svg _ngcontent-c1="" aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 10 16" width="16px" height="16px">
<path _ngcontent-c1="" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path> <path _ngcontent-c1="" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path>
</svg> --> </svg> -->
<div _ngcontent-c1="" class="text"> <div _ngcontent-c1="" class="text" *ngIf="selected else loading">
<div _ngcontent-c1="" class="description" *ngIf="selected">{{selected.network || ''}}</div> <div _ngcontent-c1="" class="description">{{selected.network || ''}}</div>
<div _ngcontent-c1="" class="title" *ngIf="selected">{{selected.friendlyName || ''}}</div> <div _ngcontent-c1="" class="title">{{selected.friendlyName || ''}}</div>
</div> </div>
<ng-template #loading>
Loading...
</ng-template>
<svg _ngcontent-c1="" aria-hidden="true" class="octicon dropdownArrow" version="1.1" viewBox="0 0 12 16" width="16px" <svg _ngcontent-c1="" aria-hidden="true" class="octicon dropdownArrow" version="1.1" viewBox="0 0 12 16" width="16px"
height="16px"> height="16px" *ngIf="selected">
<path _ngcontent-c1="" d="M0 5l6 6 6-6z"> <path _ngcontent-c1="" d="M0 5l6 6 6-6z">
</path> </path>
</svg> </svg>

View File

@ -5,7 +5,7 @@
<!-- <svg _ngcontent-c1="" aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 10 16" width="16px" height="16px"> <!-- <svg _ngcontent-c1="" aria-hidden="true" class="octicon icon" version="1.1" viewBox="0 0 10 16" width="16px" height="16px">
<path _ngcontent-c1="" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path> <path _ngcontent-c1="" d="M8 1a1.993 1.993 0 0 0-1 3.72V6L5 8 3 6V4.72A1.993 1.993 0 0 0 2 1a1.993 1.993 0 0 0-1 3.72V6.5l3 3v1.78A1.993 1.993 0 0 0 5 15a1.993 1.993 0 0 0 1-3.72V9.5l3-3V4.72A1.993 1.993 0 0 0 8 1zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3 10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zm3-10c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path>
</svg> --> </svg> -->
<div _ngcontent-c1="" class="text"> <div _ngcontent-c1="" class="text" *ngIf="ipSummary && portSummary else loading">
<div class="text-row"> <div class="text-row">
<div _ngcontent-c1="" class="description">IP &nbsp;</div> <div _ngcontent-c1="" class="description">IP &nbsp;</div>
<div _ngcontent-c1="" class="title">{{ipSummary}}</div> <div _ngcontent-c1="" class="title">{{ipSummary}}</div>
@ -15,8 +15,11 @@
<div _ngcontent-c1="" class="title">{{portSummary}}</div> <div _ngcontent-c1="" class="title">{{portSummary}}</div>
</div> </div>
</div> </div>
<ng-template #loading>
Loading...
</ng-template>
<svg _ngcontent-c1="" aria-hidden="true" class="octicon dropdownArrow" version="1.1" viewBox="0 0 12 16" width="16px" <svg _ngcontent-c1="" aria-hidden="true" class="octicon dropdownArrow" version="1.1" viewBox="0 0 12 16" width="16px"
height="16px"> height="16px" *ngIf="ipSummary && portSummary">
<path _ngcontent-c1="" d="M0 5l6 6 6-6z"> <path _ngcontent-c1="" d="M0 5l6 6 6-6z">
</path> </path>
</svg> </svg>

View File

@ -11,16 +11,19 @@ export class DiscoveryConfigService {
private discoverHostSubject = new BehaviorSubject<DiscoverHost>(null); private discoverHostSubject = new BehaviorSubject<DiscoverHost>(null);
private zoneSubject = new BehaviorSubject<Zone>(null); private zoneSubject = new BehaviorSubject<Zone>(null);
private startSubject = new BehaviorSubject<boolean>(false); private startSubject = new BehaviorSubject<boolean>(false);
private discoveryModeSubject = new BehaviorSubject<string>('');
discoverHost: Observable<DiscoverHost>; discoverHost: Observable<DiscoverHost>;
zone: Observable<Zone>; zone: Observable<Zone>;
started: Observable<boolean>; started: Observable<boolean>;
discoveryMode: Observable<string>;
constructor() { constructor() {
this.discoverHost = this.discoverHostSubject.asObservable(); this.discoverHost = this.discoverHostSubject.asObservable();
this.zone = this.zoneSubject.asObservable(); this.zone = this.zoneSubject.asObservable();
this.started = this.startSubject.asObservable(); this.started = this.startSubject.asObservable();
this.discoveryMode = this.discoveryModeSubject.asObservable();
} }
public setZone(zone: Zone): void { public setZone(zone: Zone): void {
@ -35,4 +38,7 @@ export class DiscoveryConfigService {
this.startSubject.next(isStarted); this.startSubject.next(isStarted);
} }
public setDiscoveryMode(mode: string): void {
this.discoveryModeSubject.next(mode);
}
} }

View File

@ -5878,9 +5878,9 @@ pretty-error@^2.0.2:
renderkid "^2.0.1" renderkid "^2.0.1"
utila "~0.4" utila "~0.4"
primeng@^6.1.0: primeng@^6.1.3:
version "6.1.2" version "6.1.3"
resolved "https://nexus.loafle.net/repository/npm-all/primeng/-/primeng-6.1.2.tgz#b13e6f27ab36482dc4f3657d20aa29f48428a9cb" resolved "https://nexus.loafle.net/repository/npm-all/primeng/-/primeng-6.1.3.tgz#720590da9e671fd47de15911636d1c0a7a442852"
primer-support@^4.0.0: primer-support@^4.0.0:
version "4.6.0" version "4.6.0"