diff --git a/netbox/project-static/js/cabletrace.js b/netbox/project-static/js/cabletrace.js
new file mode 100644
index 000000000..2307cef87
--- /dev/null
+++ b/netbox/project-static/js/cabletrace.js
@@ -0,0 +1,24 @@
+$('#cabletrace_modal').on('show.bs.modal', function (event) {
+ var button = $(event.relatedTarget);
+ var obj = button.data('obj');
+ var url = button.data('url');
+ var modal_title = $(this).find('.modal-title');
+ var modal_body = $(this).find('.modal-body');
+ modal_title.text(obj);
+ modal_body.empty();
+ $.ajax({
+ url: url,
+ dataType: 'json',
+ success: function(json) {
+ $.each(json, function(i, segment) {
+ modal_body.append(
+ '
' +
+ '
' + segment[0].device.name + '
' + segment[0].name + '
' +
+ '
Cable #' + segment[1].id + '
' +
+ '
' + segment[2].device.name + '
' + segment[2].name + '
' +
+ '
'
+ );
+ })
+ }
+ });
+});
diff --git a/netbox/templates/circuits/provider.html b/netbox/templates/circuits/provider.html
index 4ec9adee1..733632342 100644
--- a/netbox/templates/circuits/provider.html
+++ b/netbox/templates/circuits/provider.html
@@ -205,7 +205,7 @@
-{% include 'inc/graphs_modal.html' %}
+{% include 'inc/modal.html' with modal_name='graphs' %}
{% endblock %}
{% block javascript %}
diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html
index 29f187825..1c2bbfccd 100644
--- a/netbox/templates/dcim/device.html
+++ b/netbox/templates/dcim/device.html
@@ -776,7 +776,8 @@
{% endif %}
-{% include 'inc/graphs_modal.html' %}
+{% include 'inc/modal.html' with modal_name='graphs' %}
+{% include 'inc/modal.html' with modal_name='cabletrace' %}
{% include 'secrets/inc/private_key_modal.html' %}
{% endblock %}
@@ -847,6 +848,7 @@ $('button.toggle-ips').click(function() {
return false;
});
+
{% endblock %}
diff --git a/netbox/templates/dcim/inc/interface.html b/netbox/templates/dcim/inc/interface.html
index 1ee1706ab..8b6583ace 100644
--- a/netbox/templates/dcim/inc/interface.html
+++ b/netbox/templates/dcim/inc/interface.html
@@ -32,6 +32,9 @@
{% if iface.cable %}
{{ iface.cable }}
+
{% else %}
—
{% endif %}
diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html
index f4623b57b..8fedfbcee 100644
--- a/netbox/templates/dcim/site.html
+++ b/netbox/templates/dcim/site.html
@@ -330,7 +330,7 @@
-{% include 'inc/graphs_modal.html' %}
+{% include 'inc/modal.html' with modal_name='graphs' %}
{% endblock %}
{% block javascript %}
diff --git a/netbox/templates/inc/graphs_modal.html b/netbox/templates/inc/modal.html
similarity index 68%
rename from netbox/templates/inc/graphs_modal.html
rename to netbox/templates/inc/modal.html
index 29eaf18bf..b70b9115f 100644
--- a/netbox/templates/inc/graphs_modal.html
+++ b/netbox/templates/inc/modal.html
@@ -1,9 +1,9 @@
- |