1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

add notification webhook fields

This commit is contained in:
Jake McDermott 2019-06-24 11:59:26 -04:00 committed by beeankha
parent 52b01feafe
commit cc0310ccd4
4 changed files with 38 additions and 2 deletions

View File

@ -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) {

View File

@ -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];
});

View File

@ -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',

View File

@ -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;