Closes #181: Open cable on double-click (#225)

* Closes #181: Open cable on double-click

* build js

Co-authored-by: mattieserver <3049868+mattieserver@users.noreply.github.com>
This commit is contained in:
Mario
2022-12-27 14:57:32 +01:00
committed by GitHub
co-authored by mattieserver
parent dfb0b532b9
commit 0cb0c10dbb
3 changed files with 17 additions and 6 deletions
File diff suppressed because one or more lines are too long
+10 -3
View File
@@ -100,9 +100,16 @@ const coordSaveCheckbox = document.querySelector('#id_save_coords')
})
graph.on('doubleClick', (params) => {
params.nodes.forEach((node) => {
window.open(nodes.get(node).href, '_blank')
})
if (params.nodes.length > 0) {
params.nodes.forEach((node) => {
window.open(nodes.get(node).href, '_blank')
})
}
else {
params.edges.forEach((edge) => {
window.open(edges.get(edge).href, '_blank')
})
}
})
})()
+6 -2
View File
@@ -230,8 +230,10 @@ def create_edge(
"title"
] = f"{title} between<br>{cable_a_dev_name} [{cable_a_name}]<br>{cable_b_dev_name} [{cable_b_name}]"
if cable is not None and cable.color != "":
edge["color"] = "#" + cable.color
if cable is not None:
edge["href"] = cable.get_absolute_url()
if hasattr(cable, 'color') and cable.color != "":
edge["color"] = "#" + cable.color
return edge
@@ -332,6 +334,7 @@ def get_topology_data(
edges.append(
create_edge(
edge_id=edge_ids,
cable=circuit_termination.cable,
circuit=circuit_model,
termination_a=termination_a,
termination_b=termination_b,
@@ -557,6 +560,7 @@ def get_topology_data(
edges.append(
create_edge(
edge_id=edge_ids,
cable=wlan_link,
termination_a=termination_a,
termination_b=termination_b,
wireless=wireless,