discovery

This commit is contained in:
insanity 2018-06-01 11:47:37 +09:00
parent 0a8dfe35fc
commit ccf9ff53a8
2 changed files with 19 additions and 13 deletions

View File

@ -15,7 +15,7 @@ import { DiscoverySubscriber, DiscoveryNotify } from '../subscriber/discovery.su
templateUrl: './discovery.component.html', templateUrl: './discovery.component.html',
animations: Anim animations: Anim
}) })
export class DiscoveryComponent { export class DiscoveryComponent {
@Input() probeHostID; @Input() probeHostID;
pending$: Observable<boolean>; pending$: Observable<boolean>;
@ -24,6 +24,7 @@ export class DiscoveryComponent {
selectedProbe: ProbeHost; selectedProbe: ProbeHost;
requested: boolean; requested: boolean;
discoverZone: DiscoverZone;
constructor( constructor(
@ -35,9 +36,7 @@ export class DiscoveryComponent {
onRequestDiscovery(dz: DiscoverZone) { onRequestDiscovery(dz: DiscoverZone) {
this.requested = true; this.requested = true;
this.discoverZone = dz;
this.requested = true;
this.discoverySubscriber.observable().pipe( this.discoverySubscriber.observable().pipe(
tap(() => { tap(() => {
this.discoveryService.discoverZone(this.selectedProbe.probe.probeKey, dz); this.discoveryService.discoverZone(this.selectedProbe.probe.probeKey, dz);
@ -80,13 +79,13 @@ export class DiscoveryComponent {
} }
}), }),
catchError(error => { catchError(error => {
return of(); return of();
}), }),
).subscribe(); ).subscribe();
} }
onRequestDiscoveryStop() { onRequestDiscoveryStop() {
this.discoverZone = null;
this.requested = false; this.requested = false;
} }
} }

View File

@ -1,9 +1,16 @@
<div *ngIf="discoverZone"> <div *ngIf="discoverZone">
<of-key-value [key]="'Host Range'" [value]="hostRange"></of-key-value> <of-key-value [key]="'Host Range'" [value]="hostRange"></of-key-value>
<of-key-value [key]="'Port Range'" [value]="portRange"></of-key-value> <of-key-value [key]="'Port Range'" [value]="portRange"></of-key-value>
<span *ngIf="discoverZone.discoverHost.discoverPort.includeTCP">TCP</span> <span *ngIf="discoverZone.discoverHost.discoverPort.includeTCP">TCP</span>
<span *ngIf="discoverZone.discoverHost.discoverPort.includeUDP">UDP</span> <span *ngIf="discoverZone.discoverHost.discoverPort.includeUDP">UDP</span>
<div *ngFor="let service of services">
<span>{{service}}</span> <div *ngIf="services.length > 0">
</div> <p-overlayPanel #op>
</div> <div *ngFor="let service of services">
{{service}}
</div>
</p-overlayPanel>
<button type="text" pButton label="{{services.length}} services has selected." (click)="op.toggle($event)"></button>
</div>
</div>