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",
"ngrx-store-freeze": "^0.2.4",
"npm-run-all": "^4.1.3",
"primeng": "^6.1.0",
"primeng": "^6.1.3",
"primer-support": "^4.0.0",
"protractor": "~5.3.0",
"source-map-support": "^0.5.8",
@ -88,4 +88,4 @@
"zone.js": "^0.8.26",
"ip-cidr": "^2.0.0"
}
}
}

View File

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

View File

@ -15,6 +15,7 @@ import { Link } from '../../../commons/model/link';
import { RPCError } from '@overflow/rpc-js';
import { toMetaIPType, MetaIPTypeEnum, toMetaCryptoType, MetaCryptoTypeEnum } from '@overflow/model/meta';
import { Message } from 'primeng/primeng';
@Component({
selector: 'app-pages-home',
@ -49,6 +50,8 @@ export class HomePageComponent implements OnInit, OnDestroy {
hosts: Host[];
ports: Port[];
resultMsg: Message[] = [];
@HostListener('window:resize', ['$event'])
onResize(event) {
if (undefined !== this.discoveryTargetRef) {
@ -148,6 +151,7 @@ export class HomePageComponent implements OnInit, OnDestroy {
console.log(this.zone);
console.log(this.discoverHost);
console.log('########################################################');
this.resultMsg = [];
this.showIntro = false;
this.changeDetector.detectChanges();
@ -534,9 +538,21 @@ export class HomePageComponent implements OnInit, OnDestroy {
this.discoveryConfigService.setStarted(false);
this.simulationRestart(true);
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();
}
/**
* DiscoveryMode
*/
@RPCSubscriber({ method: 'DiscoveryService.DiscoveryMode' })
public DiscoveryMode(mode: string) {
this.discoveryConfigService.setDiscoveryMode(mode);
}
/**
* DiscoverHost
*/

View File

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

View File

@ -61,6 +61,8 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
rippleMouseDownListener: any;
discoveryMode: string;
constructor(
public renderer: Renderer,
public zone: NgZone,
@ -75,6 +77,9 @@ export class PagesComponent implements AfterViewInit, OnDestroy, OnInit {
return;
}
this.zone.runOutsideAngular(() => { this.bindRipple(); });
this.discoveryConfigService.discoveryMode.subscribe(res => {
this.discoveryMode = res as string;
});
}
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">
<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> -->
<div _ngcontent-c1="" class="text">
<div _ngcontent-c1="" class="description" *ngIf="selected">{{selected.network || ''}}</div>
<div _ngcontent-c1="" class="title" *ngIf="selected">{{selected.friendlyName || ''}}</div>
<div _ngcontent-c1="" class="text" *ngIf="selected else loading">
<div _ngcontent-c1="" class="description">{{selected.network || ''}}</div>
<div _ngcontent-c1="" class="title">{{selected.friendlyName || ''}}</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"
height="16px">
height="16px" *ngIf="selected">
<path _ngcontent-c1="" d="M0 5l6 6 6-6z">
</path>
</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">
<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> -->
<div _ngcontent-c1="" class="text">
<div _ngcontent-c1="" class="text" *ngIf="ipSummary && portSummary else loading">
<div class="text-row">
<div _ngcontent-c1="" class="description">IP &nbsp;</div>
<div _ngcontent-c1="" class="title">{{ipSummary}}</div>
@ -15,8 +15,11 @@
<div _ngcontent-c1="" class="title">{{portSummary}}</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"
height="16px">
height="16px" *ngIf="ipSummary && portSummary">
<path _ngcontent-c1="" d="M0 5l6 6 6-6z">
</path>
</svg>

View File

@ -11,16 +11,19 @@ export class DiscoveryConfigService {
private discoverHostSubject = new BehaviorSubject<DiscoverHost>(null);
private zoneSubject = new BehaviorSubject<Zone>(null);
private startSubject = new BehaviorSubject<boolean>(false);
private discoveryModeSubject = new BehaviorSubject<string>('');
discoverHost: Observable<DiscoverHost>;
zone: Observable<Zone>;
started: Observable<boolean>;
discoveryMode: Observable<string>;
constructor() {
this.discoverHost = this.discoverHostSubject.asObservable();
this.zone = this.zoneSubject.asObservable();
this.started = this.startSubject.asObservable();
this.discoveryMode = this.discoveryModeSubject.asObservable();
}
public setZone(zone: Zone): void {
@ -35,4 +38,7 @@ export class DiscoveryConfigService {
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"
utila "~0.4"
primeng@^6.1.0:
version "6.1.2"
resolved "https://nexus.loafle.net/repository/npm-all/primeng/-/primeng-6.1.2.tgz#b13e6f27ab36482dc4f3657d20aa29f48428a9cb"
primeng@^6.1.3:
version "6.1.3"
resolved "https://nexus.loafle.net/repository/npm-all/primeng/-/primeng-6.1.3.tgz#720590da9e671fd47de15911636d1c0a7a442852"
primer-support@^4.0.0:
version "4.6.0"