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.defaultNode = 0;
|
||||||
this.ptpNode = 12;
|
this.ptpNode = 12;
|
||||||
|
this.wlanNode = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
isNetworkNode(node) {
|
isNetworkNode(node) {
|
||||||
|
@ -198,6 +199,7 @@ class CoreNetwork {
|
||||||
|
|
||||||
deleteNode(nodeId) {
|
deleteNode(nodeId) {
|
||||||
// remove node from graph
|
// remove node from graph
|
||||||
|
this.nodeId = nodeId - 1;
|
||||||
this.nodes.remove(nodeId);
|
this.nodes.remove(nodeId);
|
||||||
|
|
||||||
// remove node links
|
// remove node links
|
||||||
|
@ -262,6 +264,13 @@ class CoreNetwork {
|
||||||
|
|
||||||
nextNodeId() {
|
nextNodeId() {
|
||||||
this.nodeId += 1;
|
this.nodeId += 1;
|
||||||
|
while (true) {
|
||||||
|
const node = this.nodes.get(this.nodeId);
|
||||||
|
if (node === null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
this.nodeId += 1;
|
||||||
|
}
|
||||||
return this.nodeId;
|
return this.nodeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -157,12 +157,13 @@ class NodeContext {
|
||||||
this.nodeEditModal = nodeEditModal;
|
this.nodeEditModal = nodeEditModal;
|
||||||
this.servicesModal = servicesModal;
|
this.servicesModal = servicesModal;
|
||||||
this.$nodeContext = $('#node-context');
|
this.$nodeContext = $('#node-context');
|
||||||
this.$deleteButton = this.$nodeContext.find('button[data-option="delete"]');
|
this.$linkRfButton = $('#node-linkrf-button');
|
||||||
|
this.$deleteButton = $('#node-delete-button');
|
||||||
this.onClick();
|
this.onClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
show(nodeId, x, y) {
|
show(nodeId, x, y) {
|
||||||
const node = this.coreNetwork.nodes.get(nodeId);
|
const node = this.coreNetwork.getCoreNode(nodeId);
|
||||||
console.log('context node: ', node);
|
console.log('context node: ', node);
|
||||||
this.coreRest.isRunning()
|
this.coreRest.isRunning()
|
||||||
.then(isRunning => {
|
.then(isRunning => {
|
||||||
|
@ -172,6 +173,13 @@ class NodeContext {
|
||||||
this.$deleteButton.removeAttr('disabled');
|
this.$deleteButton.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('node type: ', node.type);
|
||||||
|
if (node.type === CoreNodeHelper.wlanNode) {
|
||||||
|
this.$linkRfButton.removeClass('d-none');
|
||||||
|
} else {
|
||||||
|
this.$linkRfButton.addClass('d-none');
|
||||||
|
}
|
||||||
|
|
||||||
this.$nodeContext.data('node', nodeId);
|
this.$nodeContext.data('node', nodeId);
|
||||||
this.$nodeContext.css({
|
this.$nodeContext.css({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
|
|
|
@ -116,8 +116,12 @@
|
||||||
|
|
||||||
<div id="node-context" class="list-group context d-none">
|
<div id="node-context" class="list-group context d-none">
|
||||||
<button type="button" class="list-group-item list-group-item-action" href="#" data-option="edit">Edit Node</button>
|
<button type="button" class="list-group-item list-group-item-action" href="#" data-option="edit">Edit Node</button>
|
||||||
<button type="button" class="list-group-item list-group-item-action" href="#" data-option="services">Services</button>
|
<button id="node-linkrf-button" type="button" class="list-group-item list-group-item-action d-none" href="#"
|
||||||
<button type="button" class="list-group-item list-group-item-action" href="#" data-option="delete">Delete</button>
|
data-option="linkrf">Link All Routers</button>
|
||||||
|
<button type="button" class="list-group-item list-group-item-action" href="#"
|
||||||
|
data-option="services">Services</button>
|
||||||
|
<button id="node-delete-button" type="button" class="list-group-item list-group-item-action" href="#"
|
||||||
|
data-option="delete">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="edge-context" class="list-group context d-none">
|
<div id="edge-context" class="list-group context d-none">
|
||||||
|
|
Loading…
Reference in a new issue