1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

AC-1040 Update view properties to indicate version when they were added.

This commit is contained in:
Chris Church 2014-03-25 14:57:11 -04:00
parent c677503d8d
commit 8e841d8c16
3 changed files with 36 additions and 5 deletions

View File

@ -106,6 +106,8 @@ class APIView(views.APIView):
'docstring': type(self).__doc__ or '',
'new_in_13': getattr(self, 'new_in_13', False),
'new_in_14': getattr(self, 'new_in_14', False),
'new_in_145': getattr(self, 'new_in_145', False),
'new_in_148': getattr(self, 'new_in_148', False),
'new_in_15': getattr(self, 'new_in_15', False),
}
@ -117,6 +119,20 @@ class APIView(views.APIView):
context = self.get_description_context()
return render_to_string(template_list, context)
def metadata(self, request):
'''
Add version number where view was added to Tower.
'''
ret = super(APIView, self).metadata(request)
added_in_version = '1.2'
for version in ('1.5', '1.4.8', '1.4.5', '1.4', '1.3'):
if getattr(self, 'new_in_%s' % version.replace('.', ''), False):
added_in_version = version
break
ret['added_in_version'] = added_in_version
return ret
class GenericAPIView(generics.GenericAPIView, APIView):
# Base class for all model-based views.

View File

@ -1,4 +1,5 @@
{% if new_in_13 %}> _New since AWX 1.3_{% endif %}
{% if new_in_14 %}> _New since AWX 1.4_{% endif %}
{% if new_in_145 %}> _New in Ansible Tower 1.4.5_{% endif %}
{% if new_in_13 %}> _Added in AWX 1.3_{% endif %}
{% if new_in_14 %}> _Added in AWX 1.4_{% endif %}
{% if new_in_145 %}> _Added in Ansible Tower 1.4.5_{% endif %}
{% if new_in_148 %}> _New in Ansible Tower 1.4.8_{% endif %}
{% if new_in_15 %}> _New in Ansible Tower 1.5_{% endif %}

View File

@ -135,6 +135,7 @@ class ApiV1ConfigView(APIView):
class DashboardView(APIView):
view_name = "Dashboard"
new_in_14 = True
def get(self, request, format=None):
''' Show Dashboard Details '''
@ -239,6 +240,7 @@ class DashboardView(APIView):
class SchedulesList(APIView):
view_name = "Schedules"
new_in_148 = True
def get(self, request, format=None):
data = {
@ -296,6 +298,7 @@ class SchedulesList(APIView):
class UnifiedJobsList(APIView):
view_name = "Unified Job Templates"
new_in_148 = True
def get(self, request, format=None):
data = {
@ -564,6 +567,7 @@ class OrganizationActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Organization
relationship = 'activitystream_set'
new_in_145 = True
class TeamList(ListCreateAPIView):
@ -622,6 +626,7 @@ class TeamActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Team
relationship = 'activitystream_set'
new_in_145 = True
def get_queryset(self):
parent = self.get_parent_object()
@ -677,6 +682,7 @@ class ProjectActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Project
relationship = 'activitystream_set'
new_in_145 = True
def get_queryset(self):
parent = self.get_parent_object()
@ -814,6 +820,7 @@ class UserActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = User
relationship = 'activitystream_set'
new_in_145 = True
def get_queryset(self):
parent = self.get_parent_object()
@ -860,6 +867,7 @@ class CredentialActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Credential
relationship = 'activitystream_set'
new_in_145 = True
class PermissionDetail(RetrieveUpdateDestroyAPIView):
@ -887,6 +895,7 @@ class InventoryActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Inventory
relationship = 'activitystream_set'
new_in_145 = True
def get_queryset(self):
parent = self.get_parent_object()
@ -942,6 +951,7 @@ class HostActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Host
relationship = 'activitystream_set'
new_in_145 = True
def get_queryset(self):
parent = self.get_parent_object()
@ -1034,6 +1044,7 @@ class GroupActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Group
relationship = 'activitystream_set'
new_in_145 = True
def get_queryset(self):
parent = self.get_parent_object()
@ -1198,7 +1209,7 @@ class InventorySourceActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = InventorySource
relationship = 'activitystream_set'
new_in_145 = True
class InventorySourceUpdatesList(SubListAPIView):
@ -1276,7 +1287,7 @@ class JobTemplateActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = JobTemplate
relationship = 'activitystream_set'
new_in_145 = True
class JobTemplateCallback(GenericAPIView):
@ -1416,6 +1427,7 @@ class JobActivityStreamList(SubListAPIView):
serializer_class = ActivityStreamSerializer
parent_model = Job
relationship = 'activitystream_set'
new_in_145 = True
class JobStart(GenericAPIView):
@ -1556,11 +1568,13 @@ class ActivityStreamList(SimpleListAPIView):
model = ActivityStream
serializer_class = ActivityStreamSerializer
new_in_145 = True
class ActivityStreamDetail(RetrieveAPIView):
model = ActivityStream
serializer_class = ActivityStreamSerializer
new_in_145 = True
# Create view functions for all of the class-based views to simplify inclusion
# in URL patterns and reverse URL lookups, converting CamelCase names to