This commit is contained in:
crusader 2018-10-23 15:02:28 +09:00
parent 0805e19f6a
commit a31da5a1fb

View File

@ -923,7 +923,8 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
return `${this.getHostId(port.host)}-${port.portNumber}-${port.metaPortType.key}`;
}
getServiceId(service: Service): string {
return `${this.getPortId(service.port)}-${service.serviceType}`;
// return `${this.getPortId(service.port)}-${service.serviceType}`;
return `${this.getPortId(service.port)}`;
}
getUnknownServiceId(service: Service): string {
return `${this.getPortId(service.port)}-${MetaServiceTypeEnum.UNKNOWN}`;
@ -1013,31 +1014,15 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
const hostId = this.getHostId(service.port.host);
const { node: hostNode } = this.getNode(hostId);
const unknownServiceId = this.getUnknownServiceId(service);
const { index: unknownServiceNodeIdx, node: unknownServiceNode } = this.getNode(unknownServiceId);
const serviceId = this.getServiceId(service);
let { node: serviceNode } = this.getNode(serviceId);
let newNode = false;
if (MetaServiceTypeEnum.UNKNOWN === MetaServiceTypeEnum[service.serviceType]) {
if (null !== unknownServiceNode) {
unknownServiceNode.infra = service;
} else {
newNode = true;
}
if (null !== serviceNode) {
serviceNode.infra = service;
} else {
if (null !== serviceNode) {
serviceNode.infra = service;
} else {
if (null !== unknownServiceNode) {
const { index: linkIdx } = this.getLink(hostNode, unknownServiceNode);
// delete this.links[linkIdx];
// delete this.nodes[unknownServiceNodeIdx];
}
newNode = true;
}
newNode = true;
}
let _servicesMap: Map<number, Map<string, Service>>;
@ -1075,5 +1060,71 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
this.simulationRestart();
}
}
// const hostId = this.getHostId(service.port.host);
// const { node: hostNode } = this.getNode(hostId);
// const unknownServiceId = this.getUnknownServiceId(service);
// const { index: unknownServiceNodeIdx, node: unknownServiceNode } = this.getNode(unknownServiceId);
// const serviceId = this.getServiceId(service);
// let { node: serviceNode } = this.getNode(serviceId);
// let newNode = false;
// if (MetaServiceTypeEnum.UNKNOWN === MetaServiceTypeEnum[service.serviceType]) {
// if (null !== unknownServiceNode) {
// unknownServiceNode.infra = service;
// } else {
// newNode = true;
// }
// } else {
// if (null !== serviceNode) {
// serviceNode.infra = service;
// } else {
// if (null !== unknownServiceNode) {
// const { index: linkIdx } = this.getLink(hostNode, unknownServiceNode);
// // delete this.links[linkIdx];
// // delete this.nodes[unknownServiceNodeIdx];
// }
// newNode = true;
// }
// }
// let _servicesMap: Map<number, Map<string, Service>>;
// if (!this.services.has(service.port.host.address)) {
// _servicesMap = new Map();
// this.services.set(service.port.host.address, _servicesMap);
// } else {
// _servicesMap = this.services.get(service.port.host.address);
// }
// let _services: Map<string, Service>;
// if (!_servicesMap.has(service.port.portNumber)) {
// _services = new Map();
// _servicesMap.set(service.port.portNumber, _services);
// } else {
// _services = _servicesMap.get(service.port.portNumber);
// }
// _services.set(service.serviceType, service);
// if (newNode) {
// serviceNode = new Node(serviceId);
// serviceNode.infra = service;
// serviceNode.group = 'service';
// serviceNode.r = 30;
// serviceNode.x = hostNode.x;
// serviceNode.y = hostNode.y;
// this.nodes.push(serviceNode);
// this.links.push(new Link(hostNode, serviceNode));
// this.displaySummary.increaseService();
// if (requireRefresh) {
// this.simulationRestart();
// }
// }
}
}