Skip to content

Commit a7fa915

Browse files
committed
fix: apply detail/trace link changes to ports.html
ports.html is the template used for the embedded device tab view. The previous commit only updated deviceview.html (standalone page).
1 parent 5c1a5d8 commit a7fa915

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

  • netbox_device_view/templates/netbox_device_view

netbox_device_view/templates/netbox_device_view/ports.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ <h2 class="card-header">Deviceview {% if object.virtual_chassis %}{{ object.virt
5252
>
5353
{% for int in interfaces %}
5454
<a
55-
href="{{int.get_absolute_url}}trace/"
55+
href="{{int.get_absolute_url}}"
5656
class="device-view-port
5757
{% if cable_colors == "on" and int.cable.color == "" or cable_colors == "on" and int.cable == None %}
5858
nocolor
@@ -78,6 +78,7 @@ <h2 class="card-header">Deviceview {% if object.virtual_chassis %}{{ object.virt
7878
{% endif %}
7979
{% endfor %}
8080
{% endif %}
81+
<hr><a href='{{int.get_absolute_url}}trace/'>Trace</a>
8182
"
8283
style="grid-area: {{ int.stylename }}{% if cable_colors == 'on' and int.cable.color != '' %}; background-color: #{{ int.cable.color }}{% endif %}"
8384
data-bs-toggle="tooltip"
@@ -112,7 +113,8 @@ <h2 class="card-header">Deviceview {% if object.virtual_chassis %}{{ object.virt
112113
{
113114
device: "{{ switch }}",
114115
stylename: "{{ int.stylename }}",
115-
url: "{{ int.get_absolute_url }}trace/",
116+
detailUrl: "{{ int.get_absolute_url }}",
117+
traceUrl: "{{ int.get_absolute_url }}trace/",
116118
name: "{{ int.name|escapejs }}",
117119
enabled: {% if int.enabled or int.is_port %}true{% else %}false{% endif %},
118120
connected: {% if int.connected_endpoints|length > 0 or int.is_port and int.link_peers|length > 0 %}true{% else %}false{% endif %},
@@ -161,13 +163,14 @@ <h2 class="card-header">Deviceview {% if object.virtual_chassis %}{{ object.virt
161163

162164
g.setAttribute("role", "link");
163165
g.style.cursor = "pointer";
164-
g.addEventListener("click", function () { window.location.href = p.url; });
166+
g.addEventListener("click", function () { window.location.href = p.detailUrl; });
165167
g.addEventListener("keydown", function (e) {
166-
if (e.key === "Enter" || e.key === " ") { window.location.href = p.url; }
168+
if (e.key === "Enter" || e.key === " ") { window.location.href = p.detailUrl; }
167169
});
168170
var title = p.name;
169171
var peers = p.connectedEndpoints.length > 0 ? p.connectedEndpoints : p.linkPeers;
170172
if (peers.length > 0) { title += "<hr>" + peers.join("<br>"); }
173+
title += '<hr><a href="' + p.traceUrl + '">Trace</a>';
171174
g.setAttribute("data-bs-html", "true");
172175
g.setAttribute("data-bs-custom-class", "device-view-tooltip");
173176
g.setAttribute("title", title);

0 commit comments

Comments
 (0)