normalize http method choice values

This commit is contained in:
Jake McDermott 2019-07-23 19:24:00 -04:00
parent 7580491f1a
commit 1fe18dc588
4 changed files with 11 additions and 7 deletions

View File

@ -89,8 +89,8 @@ export default ['Rest', 'Wait', 'NotificationsFormObject',
});
$scope.httpMethodChoices = [
{'id': 'post', 'name': i18n._('POST')},
{'id': 'put', 'name': i18n._('PUT')},
{'id': 'POST', 'name': i18n._('POST')},
{'id': 'POST', 'name': i18n._('PUT')},
];
CreateSelect2({
element: '#notification_template_http_method',

View File

@ -140,8 +140,8 @@ export default ['Rest', 'Wait',
});
$scope.httpMethodChoices = [
{'id': 'post', 'name': i18n._('POST')},
{'id': 'put', 'name': i18n._('PUT')},
{'id': 'POST', 'name': i18n._('POST')},
{'id': 'PUT', 'name': i18n._('PUT')},
];
CreateSelect2({
element: '#notification_template_http_method',

View File

@ -68,8 +68,12 @@ angular.module('notifications', [
var url = getBasePath('notification_templates') + notificationTemplateId + '/';
rest.setUrl(url);
return rest.get()
.then(function(data) {
return data.data;
.then(function(res) {
if (_.get(res, ['data', 'notification_type'] === 'webhook') &&
_.get(res, ['data', 'notification_configuration', 'http_method'])) {
res.data.notification_configuration.http_method = res.data.notification_configuration.http_method.toUpperCase();
}
return res.data;
}).catch(function(response) {
ProcessErrors(null, response.data, response.status, null, {
hdr: 'Error!',

View File

@ -429,7 +429,7 @@ export default ['i18n', function(i18n) {
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'),
awPopOver: i18n._('Specify an HTTP method for the webhook. Acceptable choices are: POST or PUT'),
awRequiredWhen: {
reqExpression: "webhook_required",
init: "false"