web app update to attempt to re-use deleted node ids
This commit is contained in:
parent
f004d20b79
commit
014dea2dd0
3 changed files with 25 additions and 4 deletions
|
@ -43,6 +43,7 @@ class NodeHelper {
|
|||
|
||||
this.defaultNode = 0;
|
||||
this.ptpNode = 12;
|
||||
this.wlanNode = 6;
|
||||
}
|
||||
|
||||
isNetworkNode(node) {
|
||||
|
@ -198,6 +199,7 @@ class CoreNetwork {
|
|||
|
||||
deleteNode(nodeId) {
|
||||
// remove node from graph
|
||||
this.nodeId = nodeId - 1;
|
||||
this.nodes.remove(nodeId);
|
||||
|
||||
// remove node links
|
||||
|
@ -262,6 +264,13 @@ class CoreNetwork {
|
|||
|
||||
nextNodeId() {
|
||||
this.nodeId += 1;
|
||||
while (true) {
|
||||
const node = this.nodes.get(this.nodeId);
|
||||
if (node === null) {
|
||||
break;
|
||||
}
|
||||
this.nodeId += 1;
|
||||
}
|
||||
return this.nodeId;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue