* corrected nodeId handling * add models * import models, migrate db * correct migration deps * load coordinates from db * add serializers, correct imports * add views and templates * fix X-Y swap in help text * add non-devices to coordinate group view
This commit is contained in:
@@ -79,7 +79,26 @@ const coordSaveCheckbox = document.querySelector('#id_save_coords')
|
||||
Promise.allSettled(
|
||||
Object.entries(graph.getPositions(params.nodes)).map(
|
||||
async ([nodeId, nodePosition]) => {
|
||||
window.nodes.update({id: parseInt(nodeId), physics: false, x: nodePosition.x, y: nodePosition.y});
|
||||
if(!isNaN(parseInt(nodeId))) {
|
||||
nodeKey = parseInt(nodeId);
|
||||
}
|
||||
else {
|
||||
nodeKey = nodeId;
|
||||
}
|
||||
|
||||
try {
|
||||
window.nodes.update({id: nodeKey, physics: false, x: nodePosition.x, y: nodePosition.y});
|
||||
}
|
||||
catch (e) {
|
||||
console.log([
|
||||
'Error while executing window.nodes.update()',
|
||||
'nodeId: ' + nodeId,
|
||||
'nodeKey: ' + nodeKey,
|
||||
'x: ' + nodePosition.x,
|
||||
'y: ' + nodePosition.y
|
||||
]);
|
||||
console.log(e);
|
||||
}
|
||||
const res = await fetch(
|
||||
'/' + basePath + 'api/plugins/netbox_topology_views/save-coords/save_coords/',
|
||||
{
|
||||
@@ -97,8 +116,6 @@ const coordSaveCheckbox = document.querySelector('#id_save_coords')
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
console.log(nodeId, res.status, res.statusText)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user