From e672e68a02d03090db7868fd7ca60613950f9b7e Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Thu, 10 Oct 2019 16:21:53 -0400 Subject: [PATCH] Allow the job event list views to take a no_truncate GET param --- awx/api/filters.py | 2 +- awx/api/views/__init__.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/awx/api/filters.py b/awx/api/filters.py index 327303dd2e..ea9d011562 100644 --- a/awx/api/filters.py +++ b/awx/api/filters.py @@ -126,7 +126,7 @@ class FieldLookupBackend(BaseFilterBackend): ''' RESERVED_NAMES = ('page', 'page_size', 'format', 'order', 'order_by', - 'search', 'type', 'host_filter', 'count_disabled',) + 'search', 'type', 'host_filter', 'count_disabled', 'no_truncate') SUPPORTED_LOOKUPS = ('exact', 'iexact', 'contains', 'icontains', 'startswith', 'istartswith', 'endswith', 'iendswith', diff --git a/awx/api/views/__init__.py b/awx/api/views/__init__.py index 646ff2c746..f337345df9 100644 --- a/awx/api/views/__init__.py +++ b/awx/api/views/__init__.py @@ -3768,6 +3768,12 @@ class JobEventList(ListAPIView): serializer_class = serializers.JobEventSerializer search_fields = ('stdout',) + def get_serializer_context(self): + context = super().get_serializer_context() + if self.request.query_params.get('no_truncate'): + context.update(no_truncate=True) + return context + class JobEventDetail(RetrieveAPIView): @@ -4007,6 +4013,12 @@ class AdHocCommandEventList(ListAPIView): serializer_class = serializers.AdHocCommandEventSerializer search_fields = ('stdout',) + def get_serializer_context(self): + context = super().get_serializer_context() + if self.request.query_params.get('no_truncate'): + context.update(no_truncate=True) + return context + class AdHocCommandEventDetail(RetrieveAPIView):