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;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,12 +157,13 @@ class NodeContext {
|
|||
this.nodeEditModal = nodeEditModal;
|
||||
this.servicesModal = servicesModal;
|
||||
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();
|
||||
}
|
||||
|
||||
show(nodeId, x, y) {
|
||||
const node = this.coreNetwork.nodes.get(nodeId);
|
||||
const node = this.coreNetwork.getCoreNode(nodeId);
|
||||
console.log('context node: ', node);
|
||||
this.coreRest.isRunning()
|
||||
.then(isRunning => {
|
||||
|
@ -172,6 +173,13 @@ class NodeContext {
|
|||
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.css({
|
||||
position: 'absolute',
|
||||
|
|
|
@ -116,8 +116,12 @@
|
|||
|
||||
<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="services">Services</button>
|
||||
<button type="button" class="list-group-item list-group-item-action" href="#" data-option="delete">Delete</button>
|
||||
<button id="node-linkrf-button" type="button" class="list-group-item list-group-item-action d-none" href="#"
|
||||
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 id="edge-context" class="list-group context d-none">
|
||||
|
|
Loading…
Reference in a new issue