mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-19 13:07:52 +00:00
Merge pull request #519 from GNS3/WebUI-Cannot-read-property-'forEach'-of-undefined
Web ui cannot read property 'for each' of undefined
This commit is contained in:
commit
0ab0e7712e
@ -28,14 +28,14 @@ export class NodeToMapNodeConverter implements Converter<Node, MapNode> {
|
|||||||
mapNode.consoleHost = node.console_host;
|
mapNode.consoleHost = node.console_host;
|
||||||
mapNode.firstPortName = node.first_port_name;
|
mapNode.firstPortName = node.first_port_name;
|
||||||
mapNode.height = node.height;
|
mapNode.height = node.height;
|
||||||
mapNode.label = this.labelToMapLabel.convert(node.label, { node_id: node.node_id });
|
mapNode.label = this.labelToMapLabel ? this.labelToMapLabel.convert(node.label, { node_id: node.node_id }) : undefined;
|
||||||
mapNode.locked = node.locked;
|
mapNode.locked = node.locked;
|
||||||
mapNode.name = node.name;
|
mapNode.name = node.name;
|
||||||
mapNode.nodeDirectory = node.node_directory;
|
mapNode.nodeDirectory = node.node_directory;
|
||||||
mapNode.nodeType = node.node_type;
|
mapNode.nodeType = node.node_type;
|
||||||
mapNode.portNameFormat = node.port_name_format;
|
mapNode.portNameFormat = node.port_name_format;
|
||||||
mapNode.portSegmentSize = node.port_segment_size;
|
mapNode.portSegmentSize = node.port_segment_size;
|
||||||
mapNode.ports = node.ports.map(port => this.portToMapPort.convert(port));
|
mapNode.ports = node.ports ? node.ports.map(port => this.portToMapPort.convert(port)) : [];
|
||||||
mapNode.projectId = node.project_id;
|
mapNode.projectId = node.project_id;
|
||||||
mapNode.status = node.status;
|
mapNode.status = node.status;
|
||||||
mapNode.symbol = node.symbol;
|
mapNode.symbol = node.symbol;
|
||||||
|
@ -34,31 +34,39 @@ export class GraphDataManager {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
public setNodes(nodes: Node[]) {
|
public setNodes(nodes: Node[]) {
|
||||||
const mapNodes = nodes.map(n => this.nodeToMapNode.convert(n));
|
if (nodes) {
|
||||||
this.mapNodesDataSource.set(mapNodes);
|
const mapNodes = nodes.map(n => this.nodeToMapNode.convert(n));
|
||||||
|
this.mapNodesDataSource.set(mapNodes);
|
||||||
|
|
||||||
this.assignDataToLinks();
|
this.assignDataToLinks();
|
||||||
this.onDataUpdate();
|
this.onDataUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setLinks(links: Link[]) {
|
public setLinks(links: Link[]) {
|
||||||
const mapLinks = links.map(l => this.linkToMapLink.convert(l));
|
if (links) {
|
||||||
this.mapLinksDataSource.set(mapLinks);
|
const mapLinks = links.map(l => this.linkToMapLink.convert(l));
|
||||||
|
this.mapLinksDataSource.set(mapLinks);
|
||||||
|
|
||||||
this.assignDataToLinks();
|
this.assignDataToLinks();
|
||||||
this.onDataUpdate();
|
this.onDataUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setDrawings(drawings: Drawing[]) {
|
public setDrawings(drawings: Drawing[]) {
|
||||||
const mapDrawings = drawings.map(d => this.drawingToMapDrawing.convert(d));
|
if (drawings) {
|
||||||
this.mapDrawingsDataSource.set(mapDrawings);
|
const mapDrawings = drawings.map(d => this.drawingToMapDrawing.convert(d));
|
||||||
|
this.mapDrawingsDataSource.set(mapDrawings);
|
||||||
this.onDataUpdate();
|
|
||||||
|
this.onDataUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSymbols(symbols: Symbol[]) {
|
public setSymbols(symbols: Symbol[]) {
|
||||||
const mapSymbols = symbols.map(s => this.symbolToMapSymbol.convert(s));
|
if (symbols) {
|
||||||
this.mapSymbolsDataSource.set(mapSymbols);
|
const mapSymbols = symbols.map(s => this.symbolToMapSymbol.convert(s));
|
||||||
|
this.mapSymbolsDataSource.set(mapSymbols);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getNodes() {
|
public getNodes() {
|
||||||
|
@ -16,16 +16,17 @@ export class InterfaceStatusWidget implements Widget {
|
|||||||
const link_group = select<SVGGElement, MapLink>(this);
|
const link_group = select<SVGGElement, MapLink>(this);
|
||||||
const link_path = link_group.select<SVGPathElement>('path');
|
const link_path = link_group.select<SVGPathElement>('path');
|
||||||
|
|
||||||
const start_point: SVGPoint = link_path.node().getPointAtLength(45);
|
|
||||||
const end_point: SVGPoint = link_path.node().getPointAtLength(link_path.node().getTotalLength() - 45);
|
|
||||||
|
|
||||||
let statuses = [];
|
let statuses = [];
|
||||||
|
if (link_path.node()) {
|
||||||
|
const start_point: SVGPoint = link_path.node().getPointAtLength(45);
|
||||||
|
const end_point: SVGPoint = link_path.node().getPointAtLength(link_path.node().getTotalLength() - 45);
|
||||||
|
|
||||||
if (link_path.node().getTotalLength() > 2 * 45 + 10) {
|
if (link_path.node().getTotalLength() > 2 * 45 + 10) {
|
||||||
statuses = [
|
statuses = [
|
||||||
new LinkStatus(start_point.x, start_point.y, l.source.status),
|
new LinkStatus(start_point.x, start_point.y, l.source.status),
|
||||||
new LinkStatus(end_point.x, end_point.y, l.target.status)
|
new LinkStatus(end_point.x, end_point.y, l.target.status)
|
||||||
];
|
];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const status_started = link_group
|
const status_started = link_group
|
||||||
|
Loading…
Reference in New Issue
Block a user