* Closes #181: Open cable on double-click * build js Co-authored-by: mattieserver <3049868+mattieserver@users.noreply.github.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -100,9 +100,16 @@ const coordSaveCheckbox = document.querySelector('#id_save_coords')
|
|||||||
})
|
})
|
||||||
|
|
||||||
graph.on('doubleClick', (params) => {
|
graph.on('doubleClick', (params) => {
|
||||||
params.nodes.forEach((node) => {
|
if (params.nodes.length > 0) {
|
||||||
window.open(nodes.get(node).href, '_blank')
|
params.nodes.forEach((node) => {
|
||||||
})
|
window.open(nodes.get(node).href, '_blank')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
params.edges.forEach((edge) => {
|
||||||
|
window.open(edges.get(edge).href, '_blank')
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})()
|
})()
|
||||||
|
|
||||||
|
|||||||
@@ -230,8 +230,10 @@ def create_edge(
|
|||||||
"title"
|
"title"
|
||||||
] = f"{title} between<br>{cable_a_dev_name} [{cable_a_name}]<br>{cable_b_dev_name} [{cable_b_name}]"
|
] = 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 != "":
|
if cable is not None:
|
||||||
edge["color"] = "#" + cable.color
|
edge["href"] = cable.get_absolute_url()
|
||||||
|
if hasattr(cable, 'color') and cable.color != "":
|
||||||
|
edge["color"] = "#" + cable.color
|
||||||
|
|
||||||
return edge
|
return edge
|
||||||
|
|
||||||
@@ -332,6 +334,7 @@ def get_topology_data(
|
|||||||
edges.append(
|
edges.append(
|
||||||
create_edge(
|
create_edge(
|
||||||
edge_id=edge_ids,
|
edge_id=edge_ids,
|
||||||
|
cable=circuit_termination.cable,
|
||||||
circuit=circuit_model,
|
circuit=circuit_model,
|
||||||
termination_a=termination_a,
|
termination_a=termination_a,
|
||||||
termination_b=termination_b,
|
termination_b=termination_b,
|
||||||
@@ -557,6 +560,7 @@ def get_topology_data(
|
|||||||
edges.append(
|
edges.append(
|
||||||
create_edge(
|
create_edge(
|
||||||
edge_id=edge_ids,
|
edge_id=edge_ids,
|
||||||
|
cable=wlan_link,
|
||||||
termination_a=termination_a,
|
termination_a=termination_a,
|
||||||
termination_b=termination_b,
|
termination_b=termination_b,
|
||||||
wireless=wireless,
|
wireless=wireless,
|
||||||
|
|||||||
Reference in New Issue
Block a user