end discovery result

This commit is contained in:
snoop 2018-03-30 19:37:49 +09:00
parent cadbb23893
commit b8e19b227a
3 changed files with 12 additions and 10 deletions

View File

@ -137,7 +137,7 @@ export class SettingComponent implements OnInit, AfterContentInit {
return;
}
console.log('convertTreeViewZone');
// console.log('convertTreeViewZone');
const treeNodes: any[] = [];
zones.forEach((value: Zone, key: string, map) => {
@ -332,7 +332,7 @@ export class SettingComponent implements OnInit, AfterContentInit {
convertViewService(services): any[] {
if (services === undefined && services.size <= 0) {
if (services === undefined || services === null || services.size <= 0) {
return null;
}

View File

@ -52,14 +52,15 @@ export function reducer(state = initialState, action: Actions): State {
}
if (undefined === zone) {
console.error(`Discovery.discoveredHost: Zone[${host.zone.network}] is not exist`);
// console.error(`Discovery.discoveredHost: Zone[${host.zone.network}] is not exist`);
zone = new Map();
}
if (null === zone.hosts || undefined === zone.hosts) {
zone.hosts = new Map();
zone.hosts.set(host.ip, host);
} else {
if (zone.hosts.has(host.ip) === false) {
zone.host.set(host.ip, host);
zone.hosts.set(host.ip, host);
}
}
@ -110,7 +111,7 @@ export function reducer(state = initialState, action: Actions): State {
host = port.host;
}
if (null === host.ports) {
if (null === host.ports || undefined === host.ports) {
host.ports = new Map();
host.ports.set(port.portNumber, port);
} else {
@ -163,20 +164,20 @@ export function reducer(state = initialState, action: Actions): State {
// }
const host: Host = zone.hosts.get(service.port.host.ip);
if (null === host.ports || undefined === host.ports.get(service.port.portNumber)) {
// console.error(`Discovery.DiscoveredPort: Port[${service.port.portNumber}] is not exist`);
if (null === host.ports || undefined === host.ports) {
host.ports = new Map();
}
host.ports.set(service.port.portNumber, service.port);
}
const port: Port = host.ports.get(service.port.portNumber);
if (null === port.services) {
if (null === port.services || undefined === port.services) {
port.services = new Map();
}
port.services.set(service.serviceName, service);
host.ports.set(service.port.portNumber, port);
zone.hosts.set(host.ip, host);
zones.set(zone.network, zone);
const newZones: Map<string, Zone> = new Map();

View File

@ -41,6 +41,7 @@ export class DiscoverySubscriber {
}
@RPCSubscriber({method: 'DiscoveryService.discoveredService'})
public discoveredService(service: Service): void {
this.loggerService.debug('DiscoverySubscriber.discoveredService service:', service);
this.store.dispatch(new DiscoverStore.DiscoveredService(service));
}
}