From 5e700c992dfe182122373781f16261d253c64322 Mon Sep 17 00:00:00 2001 From: nixocio Date: Wed, 18 May 2022 10:58:37 -0400 Subject: [PATCH] Add controller_node to job details page Add controller_node to job details page. Modify serializers to make controller_node available to the UI. See: https://github.com/ansible/awx/issues/11196 Also: https://github.com/ansible/awx/issues/12132 --- awx/api/serializers.py | 2 -- awx/main/tests/functional/api/test_job.py | 2 +- awx/ui/src/screens/Job/JobDetail/JobDetail.js | 9 +++++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index 08503db45e..8842f7b98d 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -2236,7 +2236,6 @@ class InventoryUpdateSerializer(UnifiedJobSerializer, InventorySourceOptionsSeri 'source_project_update', 'custom_virtualenv', 'instance_group', - '-controller_node', ) def get_related(self, obj): @@ -2311,7 +2310,6 @@ class InventoryUpdateDetailSerializer(InventoryUpdateSerializer): class InventoryUpdateListSerializer(InventoryUpdateSerializer, UnifiedJobListSerializer): class Meta: model = InventoryUpdate - fields = ('*', '-controller_node') # field removal undone by UJ serializer class InventoryUpdateCancelSerializer(InventoryUpdateSerializer): diff --git a/awx/main/tests/functional/api/test_job.py b/awx/main/tests/functional/api/test_job.py index f7fa087372..8c405c4e0e 100644 --- a/awx/main/tests/functional/api/test_job.py +++ b/awx/main/tests/functional/api/test_job.py @@ -220,7 +220,7 @@ class TestControllerNode: assert 'controller_node' not in r.data r = get(reverse('api:inventory_update_detail', kwargs={'pk': inventory_update.pk}), admin_user, expect=200) - assert 'controller_node' not in r.data + assert 'controller_node' in r.data r = get(reverse('api:system_job_detail', kwargs={'pk': system_job.pk}), admin_user, expect=200) assert 'controller_node' not in r.data diff --git a/awx/ui/src/screens/Job/JobDetail/JobDetail.js b/awx/ui/src/screens/Job/JobDetail/JobDetail.js index 620b276111..6e97554a6e 100644 --- a/awx/ui/src/screens/Job/JobDetail/JobDetail.js +++ b/awx/ui/src/screens/Job/JobDetail/JobDetail.js @@ -186,7 +186,6 @@ function JobDetail({ job, inventorySourceLabels }) { } return null; }; - return ( @@ -349,6 +348,13 @@ function JobDetail({ job, inventorySourceLabels }) { label={t`Execution Node`} value={job.execution_node} /> + {job?.controller_node ? ( + + ) : null} {instanceGroup && !instanceGroup?.is_container_group && ( )} - {credential && (