From 4d329a7c9b5ce02dfb28f737d24dc79b24c0b8ab Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 16 Jan 2023 14:12:36 -0500 Subject: [PATCH] Standardize usage of inc/panel_table.html --- netbox/ipam/views.py | 1 - netbox/templates/inc/panel_table.html | 22 ++++++++++------------ netbox/templates/ipam/fhrpgroup.html | 11 +---------- netbox/templates/ipam/ipaddress.html | 25 ++----------------------- 4 files changed, 13 insertions(+), 46 deletions(-) diff --git a/netbox/ipam/views.py b/netbox/ipam/views.py index 02a9d2206..9741be66b 100644 --- a/netbox/ipam/views.py +++ b/netbox/ipam/views.py @@ -714,7 +714,6 @@ class IPAddressView(generic.ObjectView): return { 'parent_prefixes_table': parent_prefixes_table, 'duplicate_ips_table': duplicate_ips_table, - 'more_duplicate_ips': duplicate_ips.count() > 10, 'related_ips_table': related_ips_table, 'services': services, } diff --git a/netbox/templates/inc/panel_table.html b/netbox/templates/inc/panel_table.html index f8b66647e..15c34daaf 100644 --- a/netbox/templates/inc/panel_table.html +++ b/netbox/templates/inc/panel_table.html @@ -1,16 +1,14 @@ {% load render_table from django_tables2 %} -
- {% if heading %} -
- {{ heading }} -
+
+ {% if heading %} +
{{ heading }}
+ {% endif %} +
+ {% if table.rows %} + {% render_table table 'inc/table.html' %} + {% else %} +
None
{% endif %} -
- {% if table.rows %} - {% render_table table 'inc/table.html' %} - {% else %} -
None
- {% endif %} -
+
diff --git a/netbox/templates/ipam/fhrpgroup.html b/netbox/templates/ipam/fhrpgroup.html index 6a43f9eca..a712a0ccb 100644 --- a/netbox/templates/ipam/fhrpgroup.html +++ b/netbox/templates/ipam/fhrpgroup.html @@ -81,16 +81,7 @@
{% endif %} -
-
Members
-
- {% if members_table.rows %} - {% render_table members_table 'inc/table.html' %} - {% else %} -
None
- {% endif %} -
-
+ {% include 'inc/panel_table.html' with table=members_table heading='Members' %} {% plugin_full_width_page object %} diff --git a/netbox/templates/ipam/ipaddress.html b/netbox/templates/ipam/ipaddress.html index 131087253..74c1131ca 100644 --- a/netbox/templates/ipam/ipaddress.html +++ b/netbox/templates/ipam/ipaddress.html @@ -114,30 +114,9 @@
{% include 'inc/panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %} {% if duplicate_ips_table.rows %} - {# Custom version of panel_table.html #} -
-
- Duplicate IP Addresses - {% if more_duplicate_ips %} -
- Show all -
- {% endif %} -
-
- {% render_table duplicate_ips_table 'inc/table.html' %} -
-
+ {% include 'inc/panel_table.html' with table=duplicate_ips_table heading='Duplicate IPs' panel_class='danger' %} {% endif %} -
- {% include 'inc/panel_table.html' with table=related_ips_table heading='Related IP Addresses' %} -
+ {% include 'inc/panel_table.html' with table=related_ips_table heading='Related IPs' %} {% include 'inc/panels/services.html' %} {% plugin_right_page object %}