fixed discovery result

This commit is contained in:
snoop 2018-04-05 19:03:26 +09:00
parent b8e19b227a
commit 07046522c7
3 changed files with 42 additions and 1 deletions

View File

@ -18,6 +18,8 @@ import * as DiscoverStore from '../../store/discover';
import * as RegistStore from '../../store/regist';
import { Host } from 'packages/discovery/model/Host';
import { Port } from 'packages/discovery/model/Port';
import { Service } from 'packages/discovery/model/Service';
import * as ProbeDetailStore from 'packages/probe/store';
import { Probe } from 'packages/probe/model';
@ -254,6 +256,22 @@ export class SettingComponent implements OnInit, AfterContentInit {
}
convertMapToList(map: Map<any, any>): Array<any> {
if (undefined === map || null === map || map.size < 0) {
return null;
}
const retArr = new Array();
map.forEach((v: any, k: any) => {
retArr.push(v);
});
return retArr;
}
discoveryResultSave() {
// console.log(this.checkedSet);
@ -267,11 +285,32 @@ export class SettingComponent implements OnInit, AfterContentInit {
// FIXME: getHosts
const hosts: Host[] = [];
zone.hosts.forEach((h: Host, hKey: string) => {
// if (h.ports !== undefined && h.ports !== null) {
// h.portList = [];
// h.ports.forEach((p: Port, pKey: number) => {
// if (p.services !== undefined && p.services !== null) {
// p.serviceList = [];
// p.services.forEach((s: Service, sKey: string) => {
// p.serviceList.push(s);
// });
// }
// h.portList.push(p);
// });
// }
hosts.push(h);
});
if (hosts.length > 0) {
this.registStore.dispatch(new RegistStore.DiscoverySaveAllTarget({ hosts: hosts, probe: { id: 1 } }));
const sd: any = { hosts: hosts, probe: { id: 1 } };
console.log(JSON.stringify(sd));
console.log('--------');
this.registStore.dispatch(new RegistStore.DiscoverySaveAllTarget(sd));
}
}

View File

@ -11,4 +11,5 @@ export interface Host {
target?: boolean;
ports: Map<number, Port> | null;
portList: Port[] | null;
}

View File

@ -11,4 +11,5 @@ export interface Port {
isTarget?: boolean;
services: Map<string, Service> | null;
serviceList: Service[] | null;
}