From 26b5eb8a8380a762d4c6f1a24295aa2d06e0b9ec Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 5 Aug 2026 17:10:38 -0400 Subject: [PATCH] Label the job detail panel attribute "Execution Time" Renaming the attribute to elapsed_time changed its auto-derived label to "Elapsed time", disagreeing with the list column, the filter form, the API field and the model docs. The derived label is also built at runtime before being passed to gettext, so it would never have been extracted into the message catalog. An explicit label addresses both. Co-Authored-By: Claude Opus 5 --- netbox/core/tests/test_views.py | 5 ++++- netbox/core/ui/panels.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/netbox/core/tests/test_views.py b/netbox/core/tests/test_views.py index fde439571..a6479c090 100644 --- a/netbox/core/tests/test_views.py +++ b/netbox/core/tests/test_views.py @@ -167,7 +167,10 @@ class JobTestCase( completed.save() response = self.client.get(completed.get_absolute_url()) self.assertHttpStatus(response, 200) - self.assertIn('1m 30s', str(response.content)) + content = str(response.content) + self.assertIn('1m 30s', content) + # The panel must use the same label as the list column, filter form, and API field + self.assertIn('Execution Time', content) running = Job.objects.get(name='Job 2') running.started = now - timedelta(hours=2) diff --git a/netbox/core/ui/panels.py b/netbox/core/ui/panels.py index c7edc4868..79d872b2a 100644 --- a/netbox/core/ui/panels.py +++ b/netbox/core/ui/panels.py @@ -62,7 +62,11 @@ class JobSchedulingPanel(panels.ObjectAttributesPanel): scheduled = attrs.TemplatedAttr('scheduled', template_name='core/job/attrs/scheduled.html') started = attrs.DateTimeAttr('started') completed = attrs.DateTimeAttr('completed') - elapsed_time = attrs.TemplatedAttr('elapsed_time', template_name='core/job/attrs/elapsed_time.html') + elapsed_time = attrs.TemplatedAttr( + 'elapsed_time', + label=_('Execution Time'), + template_name='core/job/attrs/elapsed_time.html', + ) queue = attrs.TextAttr('queue_name', label=_('Queue'))