Skip to content

Commit 50839fc

Browse files
committed
Fixes #16756: Fix table pagination for custom script results
1 parent cac9235 commit 50839fc

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

netbox/extras/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,9 @@ def get(self, request, **kwargs):
12581258

12591259
# If this is an HTMX request, return only the result HTML
12601260
if htmx_partial(request):
1261+
if request.GET.get('log'):
1262+
# If log=True, render only the log table
1263+
return render(request, 'htmx/table.html', context)
12611264
response = render(request, 'extras/htmx/script_result.html', context)
12621265
if job.completed or not job.started:
12631266
response.status_code = 286

netbox/templates/extras/htmx/script_result.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ <h5 class="card-header">{% trans "Test Summary" %}</h5>
4141
<div class="card">
4242
<div class="table-responsive" id="object_list">
4343
<h5 class="card-header">{% trans "Log" %}</h5>
44-
{% include 'htmx/table.html' %}
44+
<div class="htmx-container table-responsive"
45+
hx-get="{% url 'extras:script_result' job_pk=job.pk %}?embedded=True&log=True"
46+
hx-target="this"
47+
hx-trigger="load" hx-select=".htmx-container" hx-swap="outerHTML"
48+
></div>
4549
</div>
4650
</div>
4751
{% endif %}

netbox/templates/extras/script_result.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,6 @@
9090
</div>
9191
{# /Object list tab #}
9292

93-
{# Filters tab #}
94-
{% if filter_form %}
95-
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
96-
{% include 'inc/filter_list.html' %}
97-
</div>
98-
{% endif %}
99-
{# /Filters tab #}
100-
10193
{% endblock content %}
10294

10395
{% block modals %}

0 commit comments

Comments
 (0)