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>
<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="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>
</p-footer>
</p-card>

View File

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

View File

@ -186,7 +186,12 @@ export function reducer(state = initialState, action: Actions): State {
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) {
port.services = new Map();