From adf25c61a207b0cef42c8a66efb5eb4b2d6a647f Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Mon, 3 Jun 2019 09:56:27 -0700 Subject: [PATCH 01/43] add custom notification message input fields --- .../src/notifications/add/add.controller.js | 8 +++ .../src/notifications/edit/edit.controller.js | 8 +++ .../notificationTemplates.form.js | 50 ++++++++++++++++++- awx/ui/client/src/shared/form-generator.js | 2 +- 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index 4f002cedbb19..a181e416d5d5 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -186,6 +186,14 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', "name": $scope.name, "description": $scope.description, "organization": $scope.organization, + "messages": $scope.customize_messages ? { + start_message: $scope.start_message, + start_body: $scope.start_body, + success_message: $scope.success_message, + success_body: $scope.success_body, + error_message: $scope.error_message, + error_body: $scope.error_body, + } : null, "notification_type": v, "notification_configuration": {} }; diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index b8470e3c2210..32c520ee4317 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -269,6 +269,14 @@ export default ['Rest', 'Wait', "name": $scope.name, "description": $scope.description, "organization": $scope.organization, + "messages": $scope.customize_messages ? { + start_message: $scope.start_message, + start_body: $scope.start_body, + success_message: $scope.success_message, + success_body: $scope.success_body, + error_message: $scope.error_message, + error_body: $scope.error_body, + } : null, "notification_type": v, "notification_configuration": {} }; diff --git a/awx/ui/client/src/notifications/notificationTemplates.form.js b/awx/ui/client/src/notifications/notificationTemplates.form.js index bc2a38ecde5f..d69e3ed04cdf 100644 --- a/awx/ui/client/src/notifications/notificationTemplates.form.js +++ b/awx/ui/client/src/notifications/notificationTemplates.form.js @@ -581,7 +581,55 @@ export default ['i18n', function(i18n) { ngShow: "notification_type.value == 'slack' ", ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)', awPopOver: i18n._('Specify a notification color. Acceptable colors are hex color code (example: #3af or #789abc) .') - } + }, + customize_messages: { + label: i18n._('Customize messages…'), + type: 'checkbox', + class: 'Form-formGroup--fullWidth', + default: false, + }, + start_message: { + label: i18n._('Start Message'), + class: 'Form-formGroup--fullWidth', + type: 'text', + default: '', + ngShow: "customize_messages", + }, + start_body: { + label: i18n._('Start Body'), + class: 'Form-formGroup--fullWidth', + type: 'textarea', + default: '', + ngShow: "customize_messages && notification_type.value == 'email'", + }, + success_message: { + label: i18n._('Success Message'), + class: 'Form-formGroup--fullWidth', + type: 'text', + default: '', + ngShow: "customize_messages", + }, + success_body: { + label: i18n._('Success Body'), + class: 'Form-formGroup--fullWidth', + type: 'textarea', + default: '', + ngShow: "customize_messages && notification_type.value == 'email'", + }, + error_message: { + label: i18n._('Error Message'), + class: 'Form-formGroup--fullWidth', + type: 'text', + default: '', + ngShow: "customize_messages", + }, + error_body: { + label: i18n._('Error Body'), + class: 'Form-formGroup--fullWidth', + type: 'textarea', + default: '', + ngShow: "customize_messages && notification_type.value == 'email'", + }, }, buttons: { //for now always generates