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 = [ $scope.httpMethodChoices = [
{'id': 'post', 'name': i18n._('POST')}, {'id': 'POST', 'name': i18n._('POST')},
{'id': 'put', 'name': i18n._('PUT')}, {'id': 'POST', 'name': i18n._('PUT')},
]; ];
CreateSelect2({ CreateSelect2({
element: '#notification_template_http_method', element: '#notification_template_http_method',

View File

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

View File

@@ -68,8 +68,12 @@ angular.module('notifications', [
var url = getBasePath('notification_templates') + notificationTemplateId + '/'; var url = getBasePath('notification_templates') + notificationTemplateId + '/';
rest.setUrl(url); rest.setUrl(url);
return rest.get() return rest.get()
.then(function(data) { .then(function(res) {
return data.data; 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) { }).catch(function(response) {
ProcessErrors(null, response.data, response.status, null, { ProcessErrors(null, response.data, response.status, null, {
hdr: 'Error!', hdr: 'Error!',

View File

@@ -429,7 +429,7 @@ export default ['i18n', function(i18n) {
type: 'select', type: 'select',
ngOptions: 'choice.id as choice.name for choice in httpMethodChoices', ngOptions: 'choice.id as choice.name for choice in httpMethodChoices',
default: 'post', 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: { awRequiredWhen: {
reqExpression: "webhook_required", reqExpression: "webhook_required",
init: "false" init: "false"