fixed discovery

This commit is contained in:
snoop 2018-04-24 21:05:57 +09:00
parent 0e45ff03cf
commit 27066e5240
3 changed files with 27 additions and 15 deletions

View File

@ -122,7 +122,7 @@
<p-footer> <p-footer>
<div dir="rtl"> <div dir="rtl">
<button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="closeDialog()"></button> <button pButton type="button" label="Cancel" icon="fa-close" class="ui-button-secondary ui-button-width-fit" (click)="closeDialog()"></button>
<button pButton type="button" label="Save" icon="fa-check" class="ui-button-width-fit"></button> <button pButton type="button" label="Save" icon="fa-check" class="ui-button-width-fit" (click)="discoveryResultSave()"></button>
</div> </div>
</p-footer> </p-footer>
</p-card> </p-card>

View File

@ -332,28 +332,35 @@ export class SettingComponent implements OnInit, AfterContentInit {
// this.registStore.dispatch(new DiscoverStore.DiscoverZone( // this.registStore.dispatch(new DiscoverStore.DiscoverZone(
// {probeID: '52abd6fd57e511e7ac52080027658d13', discoveryZone: discoveryZone})); // {probeID: '52abd6fd57e511e7ac52080027658d13', discoveryZone: discoveryZone}));
console.log(this.zones);
// isTarget Check
this.zones.forEach((zone: Zone, key: string) => { this.zones.forEach((zone: Zone, key: string) => {
if (zone.hosts !== undefined && zone.hosts !== null && zone.hosts.size > 0) { if (zone.hosts !== undefined && zone.hosts !== null && zone.hosts.size > 0) {
// FIXME: getHosts // FIXME: getHosts
const hosts: Host[] = []; const hosts: Host[] = [];
zone.hosts.forEach((h: Host, hKey: string) => { zone.hosts.forEach((h: Host, hKey: string) => {
// if (h.ports !== undefined && h.ports !== null) { h.zone = null;
// h.portList = []; if (h.ports !== undefined && h.ports !== null) {
// h.ports.forEach((p: Port, pKey: number) => { h.portList = [];
h.ports.forEach((p: Port, pKey: number) => {
// if (p.services !== undefined && p.services !== null) { p.host = null;
// p.serviceList = []; if (p.services !== undefined && p.services !== null) {
p.serviceList = [];
// p.services.forEach((s: Service, sKey: string) => { p.services.forEach((s: Service, sKey: string) => {
// p.serviceList.push(s); s.port = null;
// });
// } p.serviceList.push(s);
});
// h.portList.push(p); }
// });
// } h.portList.push(p);
});
}
hosts.push(h); hosts.push(h);
}); });
@ -450,7 +457,7 @@ export class SettingComponent implements OnInit, AfterContentInit {
convertViewPort(ports): any[] { convertViewPort(ports): any[] {
if (ports === undefined || ports === null || ports.length === undefined) { if (ports === undefined || ports === null || ports.size < 0) {
return null; return null;
} }

View File

@ -186,7 +186,12 @@ export function reducer(state = initialState, action: Actions): State {
host.ports.set(service.port.portNumber, service.port); host.ports.set(service.port.portNumber, service.port);
} }
const port: Port = host.ports.get(service.port.portNumber); let port: Port = null;
port = host.ports.get(service.port.portNumber);
if (undefined === port || null === port) {
port = service.port;
}
if ( undefined === port.services || null === port.services) { if ( undefined === port.services || null === port.services) {
port.services = new Map(); port.services = new Map();