From 1fe18dc5885316a3921d959b3db1d003684dde80 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Tue, 23 Jul 2019 19:24:00 -0400 Subject: [PATCH] normalize http method choice values --- awx/ui/client/src/notifications/add/add.controller.js | 4 ++-- awx/ui/client/src/notifications/edit/edit.controller.js | 4 ++-- awx/ui/client/src/notifications/main.js | 8 ++++++-- .../src/notifications/notificationTemplates.form.js | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index aff4ff0275..bd7fc04e5f 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -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', diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index 56ff081961..b8470e3c22 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -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', diff --git a/awx/ui/client/src/notifications/main.js b/awx/ui/client/src/notifications/main.js index c1a2a559be..138862bbef 100644 --- a/awx/ui/client/src/notifications/main.js +++ b/awx/ui/client/src/notifications/main.js @@ -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!', diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index 704d7d8464..15b8629f1d 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -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"