diff --git a/awx/main/notifications/email_backend.py b/awx/main/notifications/email_backend.py index 074e1f5142..6339519115 100644 --- a/awx/main/notifications/email_backend.py +++ b/awx/main/notifications/email_backend.py @@ -17,7 +17,8 @@ class CustomEmailBackend(EmailBackend): "use_tls": {"label": "Use TLS", "type": "bool"}, "use_ssl": {"label": "Use SSL", "type": "bool"}, "sender": {"label": "Sender Email", "type": "string"}, - "recipients": {"label": "Recipient List", "type": "list"}} + "recipients": {"label": "Recipient List", "type": "list"}, + "timeout": {"label": "Timeout", "type": "int"}} recipient_parameter = "recipients" sender_parameter = "sender" diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index 8bb236eb06..7093a80680 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -122,7 +122,6 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', $scope.notification_template_form[subFldName].$setPristine(); } } else { - $scope[fld] = null; $scope.notification_template_form[fld].$setPristine(); } } @@ -200,10 +199,12 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', if (field.type === 'number') { $scope[i] = Number($scope[i]); } - if (i === "username" && $scope.notification_type.value === "email" && value === null) { + if (i === "username" && $scope.notification_type.value === "email" && (value === null || !value + )) { $scope[i] = ""; } - if (field.type === 'sensitive' && value === null) { + if (field.type === 'sensitive' && (value === null || !value + )) { $scope[i] = ""; } return $scope[i]; diff --git a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js index 2fd571a740..8e5e4f1c2a 100644 --- a/awx/ui/client/src/notifications/notification-templates-list/list.controller.js +++ b/awx/ui/client/src/notifications/notification-templates-list/list.controller.js @@ -117,7 +117,7 @@ $scope.testNotification = function() { var name = $filter('sanitize')(this.notification_template.name), - pending_retries = 10; + pending_retries = 25; Rest.setUrl(defaultUrl + this.notification_template.id + '/test/'); Rest.post({}) @@ -131,7 +131,7 @@ } else { ProcessErrors($scope, data, status, null, { hdr: 'Error!', - msg: 'Call to notifcatin templates failed. Notification returned status: ' + status + msg: 'Call to notification templates failed. Notification returned status: ' + status }); } }) @@ -152,9 +152,14 @@ content: ` ${name}: Notification sent.` }); $state.reload(); + } else if (res && res.data && res.data.status && res.data.status === "failed" && res.data.error === "timed out") { + ngToast.danger({ + content: `
" + i18n._("The amount of time (in seconds) before the email notification stops trying to reach the host and times out. Ranges from 1 to 120 seconds.") + "
", + ngShow: "notification_type.value == 'email' ", + subForm: 'typeSubForm', + ngDisabled: '!(notification_template.summary_fields.user_capabilities.edit || canAdd)' + }, channels: { label: i18n._('Destination Channels'), type: 'textarea',