Add feature for notifications to trigger on job start

This commit is contained in:
beeankha
2019-05-31 13:46:45 -04:00
parent 049b3a2e87
commit 8ec97235e3
18 changed files with 117 additions and 9 deletions

View File

@@ -116,6 +116,7 @@ from awx.api.views.organization import ( # noqa
OrganizationNotificationTemplatesList,
OrganizationNotificationTemplatesAnyList,
OrganizationNotificationTemplatesErrorList,
OrganizationNotificationTemplatesStartedList,
OrganizationNotificationTemplatesSuccessList,
OrganizationInstanceGroupsList,
OrganizationAccessList,
@@ -750,6 +751,14 @@ class ProjectNotificationTemplatesAnyList(SubListCreateAttachDetachAPIView):
relationship = 'notification_templates_any'
class ProjectNotificationTemplatesStartedList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
serializer_class = serializers.NotificationTemplateSerializer
parent_model = models.Project
relationship = 'notification_templates_started'
class ProjectNotificationTemplatesErrorList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
@@ -2113,6 +2122,11 @@ class InventorySourceNotificationTemplatesAnyList(SubListCreateAttachDetachAPIVi
return super(InventorySourceNotificationTemplatesAnyList, self).post(request, *args, **kwargs)
class InventorySourceNotificationTemplatesStartedList(InventorySourceNotificationTemplatesAnyList):
relationship = 'notification_templates_started'
class InventorySourceNotificationTemplatesErrorList(InventorySourceNotificationTemplatesAnyList):
relationship = 'notification_templates_error'
@@ -2629,6 +2643,14 @@ class JobTemplateNotificationTemplatesAnyList(SubListCreateAttachDetachAPIView):
relationship = 'notification_templates_any'
class JobTemplateNotificationTemplatesStartedList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
serializer_class = serializers.NotificationTemplateSerializer
parent_model = models.JobTemplate
relationship = 'notification_templates_started'
class JobTemplateNotificationTemplatesErrorList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
@@ -3237,6 +3259,14 @@ class WorkflowJobTemplateNotificationTemplatesAnyList(SubListCreateAttachDetachA
relationship = 'notification_templates_any'
class WorkflowJobTemplateNotificationTemplatesStartedList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
serializer_class = serializers.NotificationTemplateSerializer
parent_model = models.WorkflowJobTemplate
relationship = 'notification_templates_started'
class WorkflowJobTemplateNotificationTemplatesErrorList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
@@ -3414,6 +3444,14 @@ class SystemJobTemplateNotificationTemplatesAnyList(SubListCreateAttachDetachAPI
relationship = 'notification_templates_any'
class SystemJobTemplateNotificationTemplatesStartedList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate
serializer_class = serializers.NotificationTemplateSerializer
parent_model = models.SystemJobTemplate
relationship = 'notification_templates_started'
class SystemJobTemplateNotificationTemplatesErrorList(SubListCreateAttachDetachAPIView):
model = models.NotificationTemplate