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

Merge pull request #3226 from jangsutsr/3048_add_notifications_to_ad_hoc_cmd_list

Add notifications link to ad_hoc command details.
This commit is contained in:
Aaron Tan 2016-08-09 15:12:38 -04:00 committed by GitHub
commit 65ac7f8470
3 changed files with 10 additions and 0 deletions

View File

@ -2081,6 +2081,7 @@ class AdHocCommandSerializer(UnifiedJobSerializer):
res.update(dict(
events = reverse('api:ad_hoc_command_ad_hoc_command_events_list', args=(obj.pk,)),
activity_stream = reverse('api:ad_hoc_command_activity_stream_list', args=(obj.pk,)),
notifications = reverse('api:ad_hoc_command_notifications_list', args=(obj.pk,)),
))
res['cancel'] = reverse('api:ad_hoc_command_cancel', args=(obj.pk,))
res['relaunch'] = reverse('api:ad_hoc_command_relaunch', args=(obj.pk,))

View File

@ -228,6 +228,7 @@ ad_hoc_command_urls = patterns('awx.api.views',
url(r'^(?P<pk>[0-9]+)/relaunch/$', 'ad_hoc_command_relaunch'),
url(r'^(?P<pk>[0-9]+)/events/$', 'ad_hoc_command_ad_hoc_command_events_list'),
url(r'^(?P<pk>[0-9]+)/activity_stream/$', 'ad_hoc_command_activity_stream_list'),
url(r'^(?P<pk>[0-9]+)/notifications/$', 'ad_hoc_command_notifications_list'),
url(r'^(?P<pk>[0-9]+)/stdout/$', 'ad_hoc_command_stdout'),
)

View File

@ -3300,6 +3300,14 @@ class AdHocCommandActivityStreamList(SubListAPIView):
return super(AdHocCommandActivityStreamList, self).get(request, *args, **kwargs)
class AdHocCommandNotificationsList(SubListAPIView):
model = Notification
serializer_class = NotificationSerializer
parent_model = AdHocCommand
relationship = 'notifications'
class SystemJobList(ListCreateAPIView):
model = SystemJob