This commit is contained in:
insanity 2018-06-21 21:41:30 +09:00
parent 7c5ce366ed
commit 674b6860b3
2 changed files with 16 additions and 7 deletions

View File

@ -9,7 +9,7 @@ import { TreeNode, Message } from 'primeng/primeng';
import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { Anim } from './animation';
import { TargetService } from '@overflow/target/service/target.service';
import { InfraService, InfraHost, Infra, MetaInfraTypeEnum, toMetaInfraType, InfraZone, Target, Page, PageParams } from '@overflow/commons-typescript';
import { InfraService, InfraHost, Infra, MetaInfraTypeEnum, toMetaInfraType, InfraZone, Target, Page, PageParams, InfraHostIP } from '@overflow/commons-typescript';
import { InfraService as InfraManageService } from '../../infra/service/infra.service';
import { Observable, of } from 'rxjs';
import { catchError, map, tap, take } from 'rxjs/operators';
@ -146,6 +146,9 @@ export class DiscoveryInfraTreeComponent implements OnChanges {
}
addInfraHost(infraHost: InfraHost) {
if (infraHost.infraHostIPs[0].address.indexOf('/') >= 0) {
return;
}
const target: Target = this.checkAlreadyTarget(infraHost.id);
const ip = infraHost.infraHostIPs[0].address;
const idx = this.findHostIndex(ip);
@ -199,6 +202,8 @@ export class DiscoveryInfraTreeComponent implements OnChanges {
}
saveDiscoveredInfras() {
console.log(this.discoveredHosts);
console.log(this.discoveredServices);
this.infraManageService.registDiscoverd(
this.probeHost.probe.id,
this.discoveredHosts,
@ -261,9 +266,10 @@ export class DiscoveryInfraTreeComponent implements OnChanges {
addService(service: Service) {
let exist = false;
this.infraServices.forEach(infraService => {
if (infraService.metaTargetServiceType.name === service.key &&
if (infraService.metaTargetServiceType.key === service.key &&
infraService.infraHostPort.port === service.port.portNumber &&
infraService.infraHostPort.infraHostIP.address === service.port.host.address
infraService.infraHostPort.infraHostIP.address === service.port.host.address &&
infraService.infraHostPort.metaPortType.key === service.port.metaPortType.key
) {
exist = true;
return;
@ -368,9 +374,10 @@ export class DiscoveryInfraTreeComponent implements OnChanges {
} else if (infra.metaInfraType.key === toMetaInfraType(MetaInfraTypeEnum.SERVICE).key) {
const infraService: InfraService = infra;
const service: Service = node.data.object;
if (infraService.metaTargetServiceType.name === service.name &&
if (infraService.metaTargetServiceType.key === service.key &&
infraService.infraHostPort.infraHostIP.address === service.port.host.address &&
infraService.infraHostPort.port === service.port.portNumber
infraService.infraHostPort.port === service.port.portNumber &&
infraService.infraHostPort.metaPortType.key === service.port.metaPortType.key
) {
infraID = infraService.id;
}
@ -392,6 +399,8 @@ export class DiscoveryInfraTreeComponent implements OnChanges {
targets.push(target);
});
console.log(targets);
this.targetService.registAll(targets, this.probeHost.probe.id)
.pipe(
tap(() => {

View File

@ -3,8 +3,8 @@
<div class="ui-g">
<div *ngFor="let service of services">
<p-toggleButton offLabel="{{service.name}}" onLabel="{{service.name}}" [style]="{'width':'100px'}" (onChange)="onServiceFilter($event, service)"
[(ngModel)]="filterServices[service.name]"></p-toggleButton>
<p-toggleButton offLabel="{{service.key}}" onLabel="{{service.key}}" [style]="{'width':'100px'}" (onChange)="onServiceFilter($event, service)"
[(ngModel)]="filterServices[service.key]"></p-toggleButton>
<!-- <p-checkbox [(ngModel)]="filterServices" label="{{service.serviceName}}" value="{{service.serviceName}}"></p-checkbox> -->