diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index 7093a80680..aff4ff0275 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -87,6 +87,15 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', element: '#notification_template_color', multiple: false }); + + $scope.httpMethodChoices = [ + {'id': 'post', 'name': i18n._('POST')}, + {'id': 'put', 'name': i18n._('PUT')}, + ]; + CreateSelect2({ + element: '#notification_template_http_method', + multiple: false, + }); }); $scope.$watch('headers', function validate_headers(str) { diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index a90d025953..56ff081961 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -138,6 +138,16 @@ export default ['Rest', 'Wait', element: '#notification_template_color', multiple: false }); + + $scope.httpMethodChoices = [ + {'id': 'post', 'name': i18n._('POST')}, + {'id': 'put', 'name': i18n._('PUT')}, + ]; + CreateSelect2({ + element: '#notification_template_http_method', + multiple: false, + }); + NotificationsTypeChange.getDetailFields($scope.notification_type.value).forEach(function(field) { $scope[field[0]] = field[1]; }); diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index fa291d7654..704d7d8464 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -63,7 +63,7 @@ export default ['i18n', function(i18n) { username: { label: i18n._('Username'), type: 'text', - ngShow: "notification_type.value == 'email' ", + ngShow: "notification_type.value == 'email' || notification_type.value == 'webhook' ", subForm: 'typeSubForm', ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)' }, @@ -75,7 +75,7 @@ export default ['i18n', function(i18n) { reqExpression: "password_required" , init: "false" }, - ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' ", + ngShow: "notification_type.value == 'email' || notification_type.value == 'irc' || notification_type.value == 'webhook' ", subForm: 'typeSubForm', ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)' }, @@ -423,6 +423,21 @@ export default ['i18n', function(i18n) { subForm: 'typeSubForm', ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)' }, + http_method: { + label: i18n._('HTTP Method'), + dataTitle: i18n._('HTTP Method'), + type: 'select', + ngOptions: 'choice.id as choice.name for choice in httpMethodChoices', + default: 'post', + awPopOver: i18n._('Specify an HTTP method for the webhook. Acceptable choices are: POST or PATCH'), + awRequiredWhen: { + reqExpression: "webhook_required", + init: "false" + }, + ngShow: "notification_type.value == 'webhook' ", + subForm: 'typeSubForm', + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)' + }, mattermost_url: { label: i18n._('Target URL'), type: 'text', diff --git a/awx/ui/client/src/notifications/shared/type-change.service.js b/awx/ui/client/src/notifications/shared/type-change.service.js index 5695a4ca10..86e2baa35b 100644 --- a/awx/ui/client/src/notifications/shared/type-change.service.js +++ b/awx/ui/client/src/notifications/shared/type-change.service.js @@ -53,6 +53,8 @@ function (i18n) { break; case 'webhook': obj.webhook_required = true; + obj.passwordLabel = ' ' + i18n._('Basic Auth Password'); + obj.password_required = false; break; case 'mattermost': obj.mattermost_required = true;