mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 16:58:46 -03:30
Enable timeout feature to remain functional after upgrade
Have the UI spinner fill with a default upon notification type change or upgrade.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
# Copyright (c) 2016 Ansible, Inc.
|
# Copyright (c) 2016 Ansible, Inc.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
||||||
|
from copy import deepcopy
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -122,7 +123,12 @@ class NotificationTemplate(CommonModelNameNotUnique):
|
|||||||
if not isinstance(recipients, list):
|
if not isinstance(recipients, list):
|
||||||
recipients = [recipients]
|
recipients = [recipients]
|
||||||
sender = self.notification_configuration.pop(self.notification_class.sender_parameter, None)
|
sender = self.notification_configuration.pop(self.notification_class.sender_parameter, None)
|
||||||
backend_obj = self.notification_class(**self.notification_configuration)
|
notification_configuration = deepcopy(self.notification_configuration)
|
||||||
|
for field, params in self.notification_class.init_parameters.items():
|
||||||
|
if field not in notification_configuration:
|
||||||
|
if 'default' in params:
|
||||||
|
notification_configuration[field] = params['default']
|
||||||
|
backend_obj = self.notification_class(**notification_configuration)
|
||||||
notification_obj = EmailMessage(subject, backend_obj.format_body(body), sender, recipients)
|
notification_obj = EmailMessage(subject, backend_obj.format_body(body), sender, recipients)
|
||||||
with set_environ(**settings.AWX_TASK_ENV):
|
with set_environ(**settings.AWX_TASK_ENV):
|
||||||
return backend_obj.send_messages([notification_obj])
|
return backend_obj.send_messages([notification_obj])
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ export default ['Rest', 'Wait',
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (data.notification_configuration.timeout === null ||
|
||||||
|
!data.notification_configuration.timeout){
|
||||||
|
$scope.timeout = 30;
|
||||||
|
}
|
||||||
if (data.notification_configuration[fld]) {
|
if (data.notification_configuration[fld]) {
|
||||||
$scope[fld] = data.notification_configuration[fld];
|
$scope[fld] = data.notification_configuration[fld];
|
||||||
master[fld] = data.notification_configuration[fld];
|
master[fld] = data.notification_configuration[fld];
|
||||||
@@ -193,7 +197,11 @@ export default ['Rest', 'Wait',
|
|||||||
$scope[subFldName] = null;
|
$scope[subFldName] = null;
|
||||||
$scope.notification_template_form[subFldName].$setPristine();
|
$scope.notification_template_form[subFldName].$setPristine();
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
if ($scope.timeout === null || !$scope.timeout) {
|
||||||
|
$scope.timeout = 30;
|
||||||
|
}
|
||||||
|
else {
|
||||||
$scope[fld] = null;
|
$scope[fld] = null;
|
||||||
$scope.notification_template_form[fld].$setPristine();
|
$scope.notification_template_form[fld].$setPristine();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user