From b21d3e735c43bb8d68fa12abe6a8ded2f80d43c5 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 6 May 2024 14:25:03 -0700 Subject: [PATCH] 15496 detail view template --- netbox/circuits/models/circuits.py | 2 +- netbox/circuits/tables/circuits.py | 5 +- .../circuits/circuittermination.html | 126 ++++++++++++++++++ 3 files changed, 130 insertions(+), 3 deletions(-) create mode 100644 netbox/templates/circuits/circuittermination.html diff --git a/netbox/circuits/models/circuits.py b/netbox/circuits/models/circuits.py index 7b65d52ad..fa21d7cd3 100644 --- a/netbox/circuits/models/circuits.py +++ b/netbox/circuits/models/circuits.py @@ -227,7 +227,7 @@ class CircuitTermination( return f'{self.circuit}: Termination {self.term_side}' def get_absolute_url(self): - return self.circuit.get_absolute_url() + return reverse('circuits:circuittermination', args=[self.pk]) def clean(self): super().clean() diff --git a/netbox/circuits/tables/circuits.py b/netbox/circuits/tables/circuits.py index b7c308269..b13c43f56 100644 --- a/netbox/circuits/tables/circuits.py +++ b/netbox/circuits/tables/circuits.py @@ -96,6 +96,7 @@ class CircuitTerminationTable(NetBoxTable): class Meta(NetBoxTable.Meta): model = CircuitTermination fields = ( - 'pk', 'id', 'circuit', 'term_side', 'created', 'last_updated', 'actions', + 'pk', 'id', 'circuit', 'term_side', 'site', 'provider_network', 'port_speed', 'upstream_speed', + 'xconnect_id', 'pp_info', 'description', 'created', 'last_updated', 'actions', ) - default_columns = ('pk', 'id', 'circuit', 'term_side') + default_columns = ('pk', 'id', 'circuit', 'term_side', 'description') diff --git a/netbox/templates/circuits/circuittermination.html b/netbox/templates/circuits/circuittermination.html new file mode 100644 index 000000000..267024d20 --- /dev/null +++ b/netbox/templates/circuits/circuittermination.html @@ -0,0 +1,126 @@ +{% extends 'generic/object.html' %} +{% load helpers %} +{% load plugins %} +{% load i18n %} + +{% block breadcrumbs %} + {{ block.super }} + +{% endblock %} + +{% block content %} +
+
+ +
+ {% if object %} + + {% if object.site %} + + + + + + + + + {% else %} + + + + + {% endif %} + + + + + + + + + + + + + + + + +
{% trans "Site" %} + {% if object.site.region %} + {{ object.site.region|linkify }} / + {% endif %} + {{ object.site|linkify }} +
{% trans "Termination" %} + {% if object.mark_connected %} + + {% trans "Marked as connected" %} + {% elif object.cable %} + {{ object.cable }} {% trans "to" %} + {% for peer in object.link_peers %} + {% if peer.device %} + {{ peer.device|linkify }}
+ {% elif peer.circuit %} + {{ peer.circuit|linkify }}
+ {% endif %} + {{ peer|linkify }}{% if not forloop.last %},{% endif %} + {% endfor %} +
+ + {% trans "Trace" %} + + {% if perms.dcim.change_cable %} + + {% trans "Edit" %} + + {% endif %} + {% if perms.dcim.delete_cable %} + + {% trans "Disconnect" %} + + {% endif %} +
+ {% elif perms.dcim.add_cable %} + + {% endif %} +
{% trans "Provider Network" %}{{ object.provider_network.provider|linkify }} / {{ object.provider_network|linkify }}
{% trans "Speed" %} + {% if object.port_speed and object.upstream_speed %} + {{ object.port_speed|humanize_speed }}   + {{ object.upstream_speed|humanize_speed }} + {% elif object.port_speed %} + {{ object.port_speed|humanize_speed }} + {% else %} + {{ ''|placeholder }} + {% endif %} +
{% trans "Cross-Connect" %}{{ object.xconnect_id|placeholder }}
{% trans "Patch Panel/Port" %}{{ object.pp_info|placeholder }}
{% trans "Description" %}{{ object.description|placeholder }}
+ {% else %} +
+ {% trans "None" %} +
+ {% endif %} +
+ {% plugin_left_page object %} +
+
+ {% include 'inc/panels/custom_fields.html' %} + {% include 'inc/panels/tags.html' %} + {% include 'inc/panels/comments.html' %} + {% plugin_right_page object %} +
+
+
+
+ {% plugin_full_width_page object %} +
+
+{% endblock %}