mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
Add a sublist api view for the UJTs that use a given execution environment
This commit is contained in:
committed by
Shane McDonald
parent
f9741b619c
commit
45a0084f78
@@ -1368,7 +1368,8 @@ class ExecutionEnvironmentSerializer(BaseSerializer):
|
|||||||
def get_related(self, obj):
|
def get_related(self, obj):
|
||||||
res = super(ExecutionEnvironmentSerializer, self).get_related(obj)
|
res = super(ExecutionEnvironmentSerializer, self).get_related(obj)
|
||||||
res.update(
|
res.update(
|
||||||
activity_stream = self.reverse('api:execution_environment_activity_stream_list', kwargs={'pk': obj.pk}),
|
activity_stream=self.reverse('api:execution_environment_activity_stream_list', kwargs={'pk': obj.pk}),
|
||||||
|
unified_job_templates=self.reverse('api:execution_environment_job_template_list', kwargs={'pk': obj.pk}),
|
||||||
)
|
)
|
||||||
if obj.organization:
|
if obj.organization:
|
||||||
res['organization'] = self.reverse('api:organization_detail', kwargs={'pk': obj.organization.pk})
|
res['organization'] = self.reverse('api:organization_detail', kwargs={'pk': obj.organization.pk})
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ from django.conf.urls import url
|
|||||||
from awx.api.views import (
|
from awx.api.views import (
|
||||||
ExecutionEnvironmentList,
|
ExecutionEnvironmentList,
|
||||||
ExecutionEnvironmentDetail,
|
ExecutionEnvironmentDetail,
|
||||||
|
ExecutionEnvironmentJobTemplateList,
|
||||||
ExecutionEnvironmentActivityStreamList,
|
ExecutionEnvironmentActivityStreamList,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ from awx.api.views import (
|
|||||||
urls = [
|
urls = [
|
||||||
url(r'^$', ExecutionEnvironmentList.as_view(), name='execution_environment_list'),
|
url(r'^$', ExecutionEnvironmentList.as_view(), name='execution_environment_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/$', ExecutionEnvironmentDetail.as_view(), name='execution_environment_detail'),
|
url(r'^(?P<pk>[0-9]+)/$', ExecutionEnvironmentDetail.as_view(), name='execution_environment_detail'),
|
||||||
|
url(r'^(?P<pk>[0-9]+)/unified_job_templates/$', ExecutionEnvironmentJobTemplateList.as_view(), name='execution_environment_job_template_list'),
|
||||||
url(r'^(?P<pk>[0-9]+)/activity_stream/$', ExecutionEnvironmentActivityStreamList.as_view(), name='execution_environment_activity_stream_list'),
|
url(r'^(?P<pk>[0-9]+)/activity_stream/$', ExecutionEnvironmentActivityStreamList.as_view(), name='execution_environment_activity_stream_list'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -700,6 +700,14 @@ class ExecutionEnvironmentDetail(RetrieveUpdateDestroyAPIView):
|
|||||||
swagger_topic = "Execution Environments"
|
swagger_topic = "Execution Environments"
|
||||||
|
|
||||||
|
|
||||||
|
class ExecutionEnvironmentJobTemplateList(SubListAPIView):
|
||||||
|
|
||||||
|
model = models.UnifiedJobTemplate
|
||||||
|
serializer_class = serializers.UnifiedJobTemplateSerializer
|
||||||
|
parent_model = models.ExecutionEnvironment
|
||||||
|
relationship = 'unifiedjobtemplates'
|
||||||
|
|
||||||
|
|
||||||
class ExecutionEnvironmentActivityStreamList(SubListAPIView):
|
class ExecutionEnvironmentActivityStreamList(SubListAPIView):
|
||||||
|
|
||||||
model = models.ActivityStream
|
model = models.ActivityStream
|
||||||
|
|||||||
Reference in New Issue
Block a user