ing
This commit is contained in:
parent
0805e19f6a
commit
a31da5a1fb
|
@ -923,7 +923,8 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
return `${this.getHostId(port.host)}-${port.portNumber}-${port.metaPortType.key}`;
|
return `${this.getHostId(port.host)}-${port.portNumber}-${port.metaPortType.key}`;
|
||||||
}
|
}
|
||||||
getServiceId(service: Service): string {
|
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 {
|
getUnknownServiceId(service: Service): string {
|
||||||
return `${this.getPortId(service.port)}-${MetaServiceTypeEnum.UNKNOWN}`;
|
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 hostId = this.getHostId(service.port.host);
|
||||||
const { node: hostNode } = this.getNode(hostId);
|
const { node: hostNode } = this.getNode(hostId);
|
||||||
|
|
||||||
const unknownServiceId = this.getUnknownServiceId(service);
|
|
||||||
const { index: unknownServiceNodeIdx, node: unknownServiceNode } = this.getNode(unknownServiceId);
|
|
||||||
|
|
||||||
const serviceId = this.getServiceId(service);
|
const serviceId = this.getServiceId(service);
|
||||||
let { node: serviceNode } = this.getNode(serviceId);
|
let { node: serviceNode } = this.getNode(serviceId);
|
||||||
|
|
||||||
let newNode = false;
|
let newNode = false;
|
||||||
|
|
||||||
if (MetaServiceTypeEnum.UNKNOWN === MetaServiceTypeEnum[service.serviceType]) {
|
if (null !== serviceNode) {
|
||||||
if (null !== unknownServiceNode) {
|
serviceNode.infra = service;
|
||||||
unknownServiceNode.infra = service;
|
|
||||||
} else {
|
|
||||||
newNode = true;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (null !== serviceNode) {
|
newNode = true;
|
||||||
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>>;
|
let _servicesMap: Map<number, Map<string, Service>>;
|
||||||
|
@ -1075,5 +1060,71 @@ export class MapComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||||
this.simulationRestart();
|
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();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user