From 1f25903a8c50fdb602893234c163e8a10d57f63d Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 9 May 2024 11:37:06 -0700 Subject: [PATCH] 15496 template include --- .../circuits/circuittermination.html | 84 ++--------------- .../circuits/inc/circuit_termination.html | 88 +----------------- .../inc/circuit_termination_fields.html | 90 +++++++++++++++++++ 3 files changed, 96 insertions(+), 166 deletions(-) create mode 100644 netbox/templates/circuits/inc/circuit_termination_fields.html diff --git a/netbox/templates/circuits/circuittermination.html b/netbox/templates/circuits/circuittermination.html index c0faa74da..7a155073a 100644 --- a/netbox/templates/circuits/circuittermination.html +++ b/netbox/templates/circuits/circuittermination.html @@ -15,93 +15,19 @@
{% if object %} - {% if object.site %} - + - + - {% else %} - - - - - {% endif %} - - - - - - - - - - - - - - - - + {% include 'circuits/inc/circuit_termination_fields.html' with termination=object %}
{% trans "Site" %}{% trans "Circuit" %} - {% if object.site.region %} - {{ object.site.region|linkify }} / - {% endif %} - {{ object.site|linkify }} + {{ object.circuit|linkify }}
{% trans "Termination" %}{% trans "Circuit Provider" %} - {% 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 %} + {{ object.circuit.provider|linkify }}
{% 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 %}
diff --git a/netbox/templates/circuits/inc/circuit_termination.html b/netbox/templates/circuits/inc/circuit_termination.html index a0afebb02..acec208c0 100644 --- a/netbox/templates/circuits/inc/circuit_termination.html +++ b/netbox/templates/circuits/inc/circuit_termination.html @@ -27,93 +27,7 @@ {% if termination %} - {% if termination.site %} - - - - - - - - - {% else %} - - - - - {% endif %} - - - - - - - - - - - - - - - - + {% include 'circuits/inc/circuit_termination_fields.html' with termination=termination %} + + + + + + + +{% else %} + + + + +{% endif %} + + + + + + + + + + + + + + + +
{% trans "Site" %} - {% if termination.site.region %} - {{ termination.site.region|linkify }} / - {% endif %} - {{ termination.site|linkify }} -
{% trans "Termination" %} - {% if termination.mark_connected %} - - {% trans "Marked as connected" %} - {% elif termination.cable %} - {{ termination.cable }} {% trans "to" %} - {% for peer in termination.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" %}{{ termination.provider_network.provider|linkify }} / {{ termination.provider_network|linkify }}
{% trans "Speed" %} - {% if termination.port_speed and termination.upstream_speed %} - {{ termination.port_speed|humanize_speed }}   - {{ termination.upstream_speed|humanize_speed }} - {% elif termination.port_speed %} - {{ termination.port_speed|humanize_speed }} - {% else %} - {{ ''|placeholder }} - {% endif %} -
{% trans "Cross-Connect" %}{{ termination.xconnect_id|placeholder }}
{% trans "Patch Panel/Port" %}{{ termination.pp_info|placeholder }}
{% trans "Description" %}{{ termination.description|placeholder }}
{% trans "Tags" %} diff --git a/netbox/templates/circuits/inc/circuit_termination_fields.html b/netbox/templates/circuits/inc/circuit_termination_fields.html new file mode 100644 index 000000000..97d194f24 --- /dev/null +++ b/netbox/templates/circuits/inc/circuit_termination_fields.html @@ -0,0 +1,90 @@ +{% load helpers %} +{% load i18n %} + +{% if termination.site %} +
{% trans "Site" %} + {% if termination.site.region %} + {{ termination.site.region|linkify }} / + {% endif %} + {{ termination.site|linkify }} +
{% trans "Termination" %} + {% if termination.mark_connected %} + + {% trans "Marked as connected" %} + {% elif termination.cable %} + {{ termination.cable }} {% trans "to" %} + {% for peer in termination.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" %}{{ termination.provider_network.provider|linkify }} / {{ termination.provider_network|linkify }}
{% trans "Speed" %} + {% if termination.port_speed and termination.upstream_speed %} + {{ termination.port_speed|humanize_speed }}   + {{ termination.upstream_speed|humanize_speed }} + {% elif termination.port_speed %} + {{ termination.port_speed|humanize_speed }} + {% else %} + {{ ''|placeholder }} + {% endif %} +
{% trans "Cross-Connect" %}{{ termination.xconnect_id|placeholder }}
{% trans "Patch Panel/Port" %}{{ termination.pp_info|placeholder }}
{% trans "Description" %}{{ termination.description|placeholder }}