From ae5c2d49c65628269c4f512f4215420ce16c2284 Mon Sep 17 00:00:00 2001 From: checktheroads Date: Wed, 14 Jul 2021 16:25:59 -0700 Subject: [PATCH] #6372: Simplify & streamline table config & table filter elements --- .../templates/dcim/device/consoleports.html | 6 +-- .../dcim/device/consoleserverports.html | 6 +-- netbox/templates/dcim/device/devicebays.html | 6 +-- netbox/templates/dcim/device/frontports.html | 6 +-- netbox/templates/dcim/device/interfaces.html | 32 +++++++++------- netbox/templates/dcim/device/inventory.html | 6 +-- .../templates/dcim/device/poweroutlets.html | 6 +-- netbox/templates/dcim/device/powerports.html | 6 +-- netbox/templates/dcim/device/rearports.html | 6 +-- netbox/templates/generic/object_list.html | 22 +---------- netbox/templates/inc/table_controls.html | 37 +++++++++++++++++++ .../virtualmachine/interfaces.html | 9 +---- 12 files changed, 66 insertions(+), 82 deletions(-) create mode 100644 netbox/templates/inc/table_controls.html diff --git a/netbox/templates/dcim/device/consoleports.html b/netbox/templates/dcim/device/consoleports.html index 1fcc347b5..7422c878a 100644 --- a/netbox/templates/dcim/device/consoleports.html +++ b/netbox/templates/dcim/device/consoleports.html @@ -6,11 +6,7 @@ {% block content %}
{% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DeviceConsolePortTable_config" %} {% render_table consoleport_table 'inc/table.html' %}
{% if perms.dcim.change_consoleport %} diff --git a/netbox/templates/dcim/device/consoleserverports.html b/netbox/templates/dcim/device/consoleserverports.html index 17a2f897e..2e690e978 100644 --- a/netbox/templates/dcim/device/consoleserverports.html +++ b/netbox/templates/dcim/device/consoleserverports.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DeviceConsoleServerPortTable_config" %} {% render_table consoleserverport_table 'inc/table.html' %}
{% if perms.dcim.change_consoleserverport %} diff --git a/netbox/templates/dcim/device/devicebays.html b/netbox/templates/dcim/device/devicebays.html index ddcac4b06..1a06cb830 100644 --- a/netbox/templates/dcim/device/devicebays.html +++ b/netbox/templates/dcim/device/devicebays.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DeviceDeviceBayTable_config" %} {% render_table devicebay_table 'inc/table.html' %}
{% if perms.dcim.change_devicebay %} diff --git a/netbox/templates/dcim/device/frontports.html b/netbox/templates/dcim/device/frontports.html index 9b6f89800..cfbe03863 100644 --- a/netbox/templates/dcim/device/frontports.html +++ b/netbox/templates/dcim/device/frontports.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DeviceFrontPortTable_config" %} {% render_table frontport_table 'inc/table.html' %}
{% if perms.dcim.change_frontport %} diff --git a/netbox/templates/dcim/device/interfaces.html b/netbox/templates/dcim/device/interfaces.html index 8ab18436e..002d2cd63 100644 --- a/netbox/templates/dcim/device/interfaces.html +++ b/netbox/templates/dcim/device/interfaces.html @@ -6,26 +6,32 @@ {% block content %} {% csrf_token %} -
-
- - - + {% endif %} + + +
+
+
+
+ +
{% render_table interface_table 'inc/table.html' %} diff --git a/netbox/templates/dcim/device/inventory.html b/netbox/templates/dcim/device/inventory.html index b97131f17..fff2875d5 100644 --- a/netbox/templates/dcim/device/inventory.html +++ b/netbox/templates/dcim/device/inventory.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DeviceInventoryItemTable_config" %} {% render_table inventoryitem_table 'inc/table.html' %}
{% if perms.dcim.change_inventoryitem %} diff --git a/netbox/templates/dcim/device/poweroutlets.html b/netbox/templates/dcim/device/poweroutlets.html index 476c86b8e..b86b44f10 100644 --- a/netbox/templates/dcim/device/poweroutlets.html +++ b/netbox/templates/dcim/device/poweroutlets.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DevicePowerOutletTable_config" %} {% render_table poweroutlet_table 'inc/table.html' %}
{% if perms.dcim.change_powerport %} diff --git a/netbox/templates/dcim/device/powerports.html b/netbox/templates/dcim/device/powerports.html index 4d25ad306..7c0dae0fe 100644 --- a/netbox/templates/dcim/device/powerports.html +++ b/netbox/templates/dcim/device/powerports.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DevicePowerPortTable_config" %} {% render_table powerport_table 'inc/table.html' %}
{% if perms.dcim.change_powerport %} diff --git a/netbox/templates/dcim/device/rearports.html b/netbox/templates/dcim/device/rearports.html index 0e9260199..f76f7e66b 100644 --- a/netbox/templates/dcim/device/rearports.html +++ b/netbox/templates/dcim/device/rearports.html @@ -6,11 +6,7 @@ {% block content %} {% csrf_token %} -
- {% if request.user.is_authenticated %} - - {% endif %} -
+ {% include 'inc/table_controls.html' with table_modal="DeviceRearPortTable_config" %} {% render_table rearport_table 'inc/table.html' %}
{% if perms.dcim.change_rearport %} diff --git a/netbox/templates/generic/object_list.html b/netbox/templates/generic/object_list.html index 7b837dd23..72f79d764 100644 --- a/netbox/templates/generic/object_list.html +++ b/netbox/templates/generic/object_list.html @@ -58,27 +58,7 @@ {% endif %} {# Object list filter, table config #} -
-
-
- - {% if request.user.is_authenticated and table_config_form %} - - {% endif %} - {% if filter_form %} - - {% endif %} -
-
-
+{% include 'inc/table_controls.html' with table_modal="ObjectTable_config" %} {# Object table #}
diff --git a/netbox/templates/inc/table_controls.html b/netbox/templates/inc/table_controls.html new file mode 100644 index 000000000..39b8a6510 --- /dev/null +++ b/netbox/templates/inc/table_controls.html @@ -0,0 +1,37 @@ +
+
+ {% if request.user.is_authenticated %} +
+ +
+ {% endif %} +
+
+
+ + {% if filter_form %} + + {% endif %} +
+
+
diff --git a/netbox/templates/virtualization/virtualmachine/interfaces.html b/netbox/templates/virtualization/virtualmachine/interfaces.html index 0a793f8a6..496b0a8a6 100644 --- a/netbox/templates/virtualization/virtualmachine/interfaces.html +++ b/netbox/templates/virtualization/virtualmachine/interfaces.html @@ -6,14 +6,7 @@ {% block content %} {% csrf_token %} -
-
- - {% if request.user.is_authenticated %} - - {% endif %} -
-
+ {% include 'inc/table_controls.html' with table_modal="VirtualMachineVMInterfaceTable_config" %} {% render_table interface_table 'inc/table.html' %}
{% if perms.virtualization.change_vminterface %}