From 694a7d243a98a7d26f74c2a978060191dcb10b84 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 30 Jan 2024 20:55:28 -0500 Subject: [PATCH] Relocate "add" buttons for embedded object tables --- netbox/templates/dcim/device.html | 50 +++++++++++-------- .../dcim/devicetype/component_templates.html | 1 - .../dcim/inc/panels/inventory_items.html | 18 ++++--- netbox/templates/dcim/interface.html | 19 ++++--- netbox/templates/dcim/location.html | 36 +++++++------ .../dcim/moduletype/component_templates.html | 1 - netbox/templates/dcim/region.html | 18 ++++--- netbox/templates/dcim/site.html | 36 +++++++------ netbox/templates/dcim/sitegroup.html | 18 ++++--- netbox/templates/dcim/virtualchassis.html | 18 ++++--- .../inc/panels/image_attachments.html | 18 ++++--- netbox/templates/ipam/fhrpgroup.html | 18 ++++--- .../ipam/inc/panels/fhrp_groups.html | 28 ++++++----- netbox/templates/ipam/prefix.html | 18 ++++--- netbox/templates/ipam/vlan.html | 18 ++++--- netbox/templates/tenancy/contactgroup.html | 18 ++++--- netbox/templates/tenancy/tenantgroup.html | 18 ++++--- .../virtualization/virtualmachine.html | 36 +++++++------ .../templates/virtualization/vminterface.html | 18 ++++--- netbox/templates/vpn/l2vpn.html | 18 ++++--- netbox/templates/vpn/tunnel.html | 18 ++++--- .../templates/wireless/wirelesslangroup.html | 18 ++++--- 22 files changed, 254 insertions(+), 205 deletions(-) diff --git a/netbox/templates/dcim/device.html b/netbox/templates/dcim/device.html index b138d6d68..bf53ef002 100644 --- a/netbox/templates/dcim/device.html +++ b/netbox/templates/dcim/device.html @@ -115,7 +115,14 @@ {% if vc_members %}
-
{% trans "Virtual Chassis" %}
+
+ {% trans "Virtual Chassis" %} + +
@@ -140,26 +147,23 @@ {% endfor %}
{% trans "Device" %}
-
{% endif %} {% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/tags.html' %} {% include 'inc/panels/comments.html' %}
-
{% trans "Virtual Device Contexts" %}
+
+ {% trans "Virtual Device Contexts" %} + {% if perms.dcim.add_virtualdevicecontext %} + + {% endif %} +
{% htmx_table 'dcim:virtualdevicecontext_list' device_id=object.pk %} - {% if perms.dcim.add_virtualdevicecontext %} - - {% endif %}
{% plugin_left_page object %} @@ -286,15 +290,17 @@ {% endif %}
-
{% trans "Services" %}
+
+ {% trans "Services" %} + {% if perms.ipam.add_service %} + + {% endif %} +
{% htmx_table 'ipam:service_list' device_id=object.pk %} - {% if perms.ipam.add_service %} - - {% endif %}
{% include 'inc/panels/image_attachments.html' %}
diff --git a/netbox/templates/dcim/devicetype/component_templates.html b/netbox/templates/dcim/devicetype/component_templates.html index a96973b40..3500b3cb9 100644 --- a/netbox/templates/dcim/devicetype/component_templates.html +++ b/netbox/templates/dcim/devicetype/component_templates.html @@ -8,7 +8,6 @@
{% csrf_token %}
-
{{ title }}
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/inc/panels/inventory_items.html b/netbox/templates/dcim/inc/panels/inventory_items.html index b5cf908a7..124d4221d 100644 --- a/netbox/templates/dcim/inc/panels/inventory_items.html +++ b/netbox/templates/dcim/inc/panels/inventory_items.html @@ -2,7 +2,16 @@ {% load i18n %}
-
{% trans "Inventory Items" %}
+
+ {% trans "Inventory Items" %} + {% if perms.dcim.add_inventoryitem %} + + {% endif %} +
@@ -38,11 +47,4 @@ {% endfor %}
-
diff --git a/netbox/templates/dcim/interface.html b/netbox/templates/dcim/interface.html index 7b9f69355..0c9b639f8 100644 --- a/netbox/templates/dcim/interface.html +++ b/netbox/templates/dcim/interface.html @@ -335,15 +335,18 @@
-
{% trans "IP Addresses" %}
+
+ {% trans "IP Addresses" %} + {% if perms.ipam.add_ipaddress %} + + {% endif %} +
{% htmx_table 'ipam:ipaddress_list' interface_id=object.pk %} - {% if perms.ipam.add_ipaddress %} - - {% endif %} +
diff --git a/netbox/templates/dcim/location.html b/netbox/templates/dcim/location.html index e5dfb1d2a..db387b164 100644 --- a/netbox/templates/dcim/location.html +++ b/netbox/templates/dcim/location.html @@ -69,26 +69,30 @@
-
{% trans "Child Locations" %}
+
+ {% trans "Child Locations" %} + {% if perms.dcim.add_location %} + + {% endif %} +
{% htmx_table 'dcim:location_list' parent_id=object.pk %} - {% if perms.dcim.add_location %} - - {% endif %}
-
Non-Racked Devices
+
+ {% trans "Non-Racked Devices" %} + {% if perms.dcim.add_device %} + + {% endif %} +
{% htmx_table 'dcim:device_list' location_id=object.pk rack_id='null' parent_bay_id='null' %} - {% if perms.dcim.add_device %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/moduletype/component_templates.html b/netbox/templates/dcim/moduletype/component_templates.html index 5ed6a8cc5..cf862b2c6 100644 --- a/netbox/templates/dcim/moduletype/component_templates.html +++ b/netbox/templates/dcim/moduletype/component_templates.html @@ -8,7 +8,6 @@ {% csrf_token %}
-
{{ title }}
{% include 'htmx/table.html' %}
diff --git a/netbox/templates/dcim/region.html b/netbox/templates/dcim/region.html index 1adec44d8..fd37cc026 100644 --- a/netbox/templates/dcim/region.html +++ b/netbox/templates/dcim/region.html @@ -51,15 +51,17 @@
-
{% trans "Child Regions" %}
+
+ {% trans "Child Regions" %} + {% if perms.dcim.add_region %} + + {% endif %} +
{% htmx_table 'dcim:region_list' parent_id=object.pk %} - {% if perms.dcim.add_region %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/site.html b/netbox/templates/dcim/site.html index 60182e939..0c5db3747 100644 --- a/netbox/templates/dcim/site.html +++ b/netbox/templates/dcim/site.html @@ -122,26 +122,30 @@
-
Locations
+
+ {% trans "Locations" %} + {% if perms.dcim.add_location %} + + {% endif %} +
{% htmx_table 'dcim:location_list' site_id=object.pk %} - {% if perms.dcim.add_location %} - - {% endif %}
-
Non-Racked Devices
+
+ {% trans "Non-Racked Devices" %} + {% if perms.dcim.add_device %} + + {% endif %} +
{% htmx_table 'dcim:device_list' site_id=object.pk rack_id='null' parent_bay_id='null' %} - {% if perms.dcim.add_device %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/sitegroup.html b/netbox/templates/dcim/sitegroup.html index 9b6e9d5f8..e8b25cdea 100644 --- a/netbox/templates/dcim/sitegroup.html +++ b/netbox/templates/dcim/sitegroup.html @@ -51,15 +51,17 @@
-
{% trans "Child Groups" %}
+
+ {% trans "Child Groups" %} + {% if perms.dcim.add_sitegroup %} + + {% endif %} +
{% htmx_table 'dcim:sitegroup_list' parent_id=object.pk %} - {% if perms.dcim.add_sitegroup %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/dcim/virtualchassis.html b/netbox/templates/dcim/virtualchassis.html index ab4a448f7..8defd5370 100644 --- a/netbox/templates/dcim/virtualchassis.html +++ b/netbox/templates/dcim/virtualchassis.html @@ -49,7 +49,16 @@
-
{% trans "Members" %}
+
+ {% trans "Members" %} + {% if perms.dcim.change_virtualchassis %} + + {% endif %} +
@@ -78,13 +87,6 @@ {% endfor %}
- {% if perms.dcim.change_virtualchassis %} - - {% endif %}
{% include 'inc/panels/comments.html' %} {% plugin_right_page object %} diff --git a/netbox/templates/inc/panels/image_attachments.html b/netbox/templates/inc/panels/image_attachments.html index f3ef7994a..a5f2ac18f 100644 --- a/netbox/templates/inc/panels/image_attachments.html +++ b/netbox/templates/inc/panels/image_attachments.html @@ -2,13 +2,15 @@ {% load i18n %}
-
{% trans "Images" %}
+
+ {% trans "Images" %} + {% if perms.extras.add_imageattachment %} + + {% endif %} +
{% htmx_table 'extras:imageattachment_list' content_type_id=object|content_type_id object_id=object.pk %} - {% if perms.extras.add_imageattachment %} - - {% endif %}
diff --git a/netbox/templates/ipam/fhrpgroup.html b/netbox/templates/ipam/fhrpgroup.html index 3781d1745..cdc7a172d 100644 --- a/netbox/templates/ipam/fhrpgroup.html +++ b/netbox/templates/ipam/fhrpgroup.html @@ -65,15 +65,17 @@
-
{% trans "Virtual IP Addresses" %}
+
+ {% trans "Virtual IP Addresses" %} + {% if perms.ipam.add_ipaddress %} + + {% endif %} +
{% htmx_table 'ipam:ipaddress_list' fhrpgroup_id=object.pk %} - {% if perms.ipam.add_ipaddress %} - - {% endif %}
{% include 'inc/panel_table.html' with table=members_table heading='Members' %} {% plugin_full_width_page object %} diff --git a/netbox/templates/ipam/inc/panels/fhrp_groups.html b/netbox/templates/ipam/inc/panels/fhrp_groups.html index 9a3689e3d..845e8fbf8 100644 --- a/netbox/templates/ipam/inc/panels/fhrp_groups.html +++ b/netbox/templates/ipam/inc/panels/fhrp_groups.html @@ -2,7 +2,21 @@ {% load i18n %}
-
{% trans "FHRP Groups" %}
+
+ {% trans "FHRP Groups" %} +
+ {% if perms.ipam.add_fhrpgroup %} + + {% trans "Create Group" %} + + {% endif %} + {% if perms.ipam.add_fhrpgroupassignment %} + + {% trans "Assign Group" %} + + {% endif %} +
+
@@ -44,16 +58,4 @@ {% endfor %}
-
diff --git a/netbox/templates/ipam/prefix.html b/netbox/templates/ipam/prefix.html index f4f066157..280a40dc4 100644 --- a/netbox/templates/ipam/prefix.html +++ b/netbox/templates/ipam/prefix.html @@ -91,7 +91,16 @@
-
{% trans "Addressing" %}
+
+ {% trans "Addressing" %} + {% if object.prefix.version == 4 %} + + {% endif %} +
@@ -142,13 +151,6 @@
{% trans "Utilization" %}
- {% if object.prefix.version == 4 %} - - {% endif %}
{% include 'inc/panels/custom_fields.html' %} {% include 'inc/panels/tags.html' %} diff --git a/netbox/templates/ipam/vlan.html b/netbox/templates/ipam/vlan.html index 0ff22a600..5553be7f4 100644 --- a/netbox/templates/ipam/vlan.html +++ b/netbox/templates/ipam/vlan.html @@ -80,15 +80,17 @@
-
{% trans "Prefixes" %}
+
+ {% trans "Prefixes" %} + {% if perms.ipam.add_prefix %} + + {% endif %} +
{% htmx_table 'ipam:prefix_list' vlan_id=object.pk %} - {% if perms.ipam.add_prefix %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/tenancy/contactgroup.html b/netbox/templates/tenancy/contactgroup.html index 7738885f2..7254bf8df 100644 --- a/netbox/templates/tenancy/contactgroup.html +++ b/netbox/templates/tenancy/contactgroup.html @@ -42,15 +42,17 @@
-
{% trans "Child Groups" %}
+
+ {% trans "Child Groups" %} + {% if perms.tenancy.add_contactgroup %} + + {% endif %} +
{% htmx_table 'tenancy:contactgroup_list' parent_id=object.pk %} - {% if perms.tenancy.add_contactgroup %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/tenancy/tenantgroup.html b/netbox/templates/tenancy/tenantgroup.html index 166d57efe..ecd8581ec 100644 --- a/netbox/templates/tenancy/tenantgroup.html +++ b/netbox/templates/tenancy/tenantgroup.html @@ -51,15 +51,17 @@
-
{% trans "Child Groups" %}
+
+ {% trans "Child Groups" %} + {% if perms.tenancy.add_tenantgroup %} + + {% endif %} +
{% htmx_table 'tenancy:tenantgroup_list' parent_id=object.pk %} - {% if perms.tenancy.add_tenantgroup %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/virtualization/virtualmachine.html b/netbox/templates/virtualization/virtualmachine.html index fa573899d..79ea4e1ee 100644 --- a/netbox/templates/virtualization/virtualmachine.html +++ b/netbox/templates/virtualization/virtualmachine.html @@ -146,15 +146,17 @@
-
{% trans "Services" %}
+
+ {% trans "Services" %} + {% if perms.ipam.add_service %} + + {% endif %} +
{% htmx_table 'ipam:service_list' virtual_machine_id=object.pk %} - {% if perms.ipam.add_service %} - - {% endif %}
{% plugin_right_page object %}
@@ -163,15 +165,17 @@
-
{% trans "Virtual Disks" %}
+
+ {% trans "Virtual Disks" %} + {% if perms.virtualization.add_virtualdisk %} + + {% endif %} +
{% htmx_table 'virtualization:virtualdisk_list' virtual_machine_id=object.pk %} - {% if perms.virtualization.add_virtualdisk %} - - {% endif %}
diff --git a/netbox/templates/virtualization/vminterface.html b/netbox/templates/virtualization/vminterface.html index 482e91d2c..988d52d9e 100644 --- a/netbox/templates/virtualization/vminterface.html +++ b/netbox/templates/virtualization/vminterface.html @@ -81,15 +81,17 @@
-
{% trans "IP Addresses" %}
- {% htmx_table 'ipam:ipaddress_list' vminterface_id=object.pk %} - {% if perms.ipam.add_ipaddress %} -
diff --git a/netbox/templates/vpn/l2vpn.html b/netbox/templates/vpn/l2vpn.html index 4d04f74ed..f253b64b5 100644 --- a/netbox/templates/vpn/l2vpn.html +++ b/netbox/templates/vpn/l2vpn.html @@ -52,15 +52,17 @@
-
{% trans "Terminations" %}
+
+ {% trans "Terminations" %} + {% if perms.vpn.add_l2vpntermination %} + + {% endif %} +
{% htmx_table 'vpn:l2vpntermination_list' l2vpn_id=object.pk %} - {% if perms.vpn.add_l2vpntermination %} - - {% endif %}
diff --git a/netbox/templates/vpn/tunnel.html b/netbox/templates/vpn/tunnel.html index f1856c03d..09b11305a 100644 --- a/netbox/templates/vpn/tunnel.html +++ b/netbox/templates/vpn/tunnel.html @@ -68,15 +68,17 @@
-
{% trans "Terminations" %}
+
+ {% trans "Terminations" %} + {% if perms.vpn.add_tunneltermination %} + + {% endif %} +
{% htmx_table 'vpn:tunneltermination_list' tunnel_id=object.pk %} - {% if perms.vpn.add_tunneltermination %} - - {% endif %}
{% plugin_full_width_page object %}
diff --git a/netbox/templates/wireless/wirelesslangroup.html b/netbox/templates/wireless/wirelesslangroup.html index 3071364e7..8c72311e0 100644 --- a/netbox/templates/wireless/wirelesslangroup.html +++ b/netbox/templates/wireless/wirelesslangroup.html @@ -51,15 +51,17 @@
-
{% trans "Child Groups" %}
+
+ {% trans "Child Groups" %} + {% if perms.wireless.add_wirelesslangroup %} + + {% endif %} +
{% htmx_table 'wireless:wirelesslangroup_list' parent_id=object.pk %} - {% if perms.wireless.add_wirelesslangroup %} - - {% endif %}
{% plugin_full_width_page object %}