From 37c9ed2fef1af0aa0123c6400c881350b583dc19 Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Thu, 12 Dec 2024 15:38:01 -0500 Subject: [PATCH 1/3] Use table_htmx.html for assigning ipaddresses --- netbox/templates/ipam/ipaddress_assign.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/templates/ipam/ipaddress_assign.html b/netbox/templates/ipam/ipaddress_assign.html index d96ad745297..4711b286af6 100644 --- a/netbox/templates/ipam/ipaddress_assign.html +++ b/netbox/templates/ipam/ipaddress_assign.html @@ -34,7 +34,7 @@

{% trans "Select IP Address" %}

{% trans "Search Results" %}

- {% render_table table 'inc/table.html' %} + {% render_table table 'inc/table_htmx.html' %}
From fa8f2ac3773780bdf9f2555843dae72ab1f185cc Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Mon, 16 Dec 2024 18:54:09 -0500 Subject: [PATCH 2/3] Add disable_htmx property on ObjectChildrenView to allow IP assignment flow to avoid htmx fragmentary rendering on object save --- netbox/dcim/views.py | 1 + netbox/netbox/views/generic/object_views.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index c8474b01dff..5665c41b0f0 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -1971,6 +1971,7 @@ class DeviceInterfacesView(DeviceComponentsView): filterset = filtersets.InterfaceFilterSet filterset_form = forms.InterfaceFilterForm template_name = 'dcim/device/interfaces.html' + disable_htmx = True tab = ViewTab( label=_('Interfaces'), badge=lambda obj: obj.vc_interfaces().count(), diff --git a/netbox/netbox/views/generic/object_views.py b/netbox/netbox/views/generic/object_views.py index 0686e52b7df..48dc6b83a71 100644 --- a/netbox/netbox/views/generic/object_views.py +++ b/netbox/netbox/views/generic/object_views.py @@ -96,6 +96,8 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin): filterset = None filterset_form = None template_name = 'generic/object_children.html' + # Currently used only to work around the singular behavior of the IP assignment flow in DeviceInterfacesView + disable_htmx = False def get_children(self, request, parent): """ @@ -142,7 +144,7 @@ def get(self, request, *args, **kwargs): table = self.get_table(table_data, request, has_bulk_actions) # If this is an HTMX request, return only the rendered table HTML - if htmx_partial(request): + if htmx_partial(request) and not self.disable_htmx: return render(request, 'htmx/table.html', { 'object': instance, 'table': table, From ccfda54b50479117da8caf4fe0d095489768927c Mon Sep 17 00:00:00 2001 From: Brian Tiemann Date: Tue, 17 Dec 2024 11:13:49 -0500 Subject: [PATCH 3/3] Revert "Add disable_htmx property on ObjectChildrenView to allow IP assignment flow to avoid htmx fragmentary rendering on object save" This reverts commit fa8f2ac3773780bdf9f2555843dae72ab1f185cc. --- netbox/dcim/views.py | 1 - netbox/netbox/views/generic/object_views.py | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/netbox/dcim/views.py b/netbox/dcim/views.py index 5665c41b0f0..c8474b01dff 100644 --- a/netbox/dcim/views.py +++ b/netbox/dcim/views.py @@ -1971,7 +1971,6 @@ class DeviceInterfacesView(DeviceComponentsView): filterset = filtersets.InterfaceFilterSet filterset_form = forms.InterfaceFilterForm template_name = 'dcim/device/interfaces.html' - disable_htmx = True tab = ViewTab( label=_('Interfaces'), badge=lambda obj: obj.vc_interfaces().count(), diff --git a/netbox/netbox/views/generic/object_views.py b/netbox/netbox/views/generic/object_views.py index 48dc6b83a71..0686e52b7df 100644 --- a/netbox/netbox/views/generic/object_views.py +++ b/netbox/netbox/views/generic/object_views.py @@ -96,8 +96,6 @@ class ObjectChildrenView(ObjectView, ActionsMixin, TableMixin): filterset = None filterset_form = None template_name = 'generic/object_children.html' - # Currently used only to work around the singular behavior of the IP assignment flow in DeviceInterfacesView - disable_htmx = False def get_children(self, request, parent): """ @@ -144,7 +142,7 @@ def get(self, request, *args, **kwargs): table = self.get_table(table_data, request, has_bulk_actions) # If this is an HTMX request, return only the rendered table HTML - if htmx_partial(request) and not self.disable_htmx: + if htmx_partial(request): return render(request, 'htmx/table.html', { 'object': instance, 'table': table,