mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Queue notification instead of waiting for send
This commit is contained in:
parent
eda0e73eb6
commit
5b1ff402bc
3 changed files with 15 additions and 17 deletions
|
@ -540,7 +540,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendTestNewsletter() {
|
function sendTestNewsletter() {
|
||||||
showMsg('<i class="fa fa-refresh fa-spin"></i> Generating Newsletter', false);
|
showMsg('<i class="fa fa-refresh fa-spin"></i> Sending Newsletter', false);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'send_newsletter',
|
url: 'send_newsletter',
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -775,13 +775,11 @@
|
||||||
},
|
},
|
||||||
cache: false,
|
cache: false,
|
||||||
async: true,
|
async: true,
|
||||||
complete: function (xhr, status) {
|
success: function (data) {
|
||||||
if (xhr.responseText.indexOf('sent') > -1) {
|
if (data.result === 'success') {
|
||||||
var msg = '<i class="fa fa-check"></i> ' + xhr.responseText;
|
showMsg('<i class="fa fa-check"></i> ' + data.message, false, true, 5000);
|
||||||
showMsg(msg, false, true, 2000);
|
|
||||||
} else {
|
} else {
|
||||||
var msg = '<i class="fa fa-times"></i> ' + xhr.responseText;
|
showMsg('<i class="fa fa-exclamation-circle"></i> ' + data.message, false, true, 5000, true);
|
||||||
showMsg(msg, false, true, 2000, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -3222,6 +3222,7 @@ class WebInterface(object):
|
||||||
return parameters
|
return parameters
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
def send_notification(self, notifier_id=None, subject='Tautulli', body='Test notification', notify_action='', **kwargs):
|
def send_notification(self, notifier_id=None, subject='Tautulli', body='Test notification', notify_action='', **kwargs):
|
||||||
""" Send a notification using Tautulli.
|
""" Send a notification using Tautulli.
|
||||||
|
@ -3248,20 +3249,19 @@ class WebInterface(object):
|
||||||
|
|
||||||
if notifier:
|
if notifier:
|
||||||
logger.debug(u"Sending %s%s notification." % (test, notifier['agent_label']))
|
logger.debug(u"Sending %s%s notification." % (test, notifier['agent_label']))
|
||||||
if notification_handler.notify(notifier_id=notifier_id,
|
notification_handler.add_notifier_each(notifier_id=notifier_id,
|
||||||
notify_action=notify_action,
|
notify_action=notify_action,
|
||||||
subject=subject,
|
subject=subject,
|
||||||
body=body,
|
body=body,
|
||||||
**kwargs):
|
manual_trigger=True,
|
||||||
return "Notification sent."
|
**kwargs)
|
||||||
else:
|
return {'result': 'success', 'message': 'Notification queued.'}
|
||||||
return "Notification failed."
|
|
||||||
else:
|
else:
|
||||||
logger.debug(u"Unable to send %snotification, invalid notifier_id %s." % (test, notifier_id))
|
logger.debug(u"Unable to send %snotification, invalid notifier_id %s." % (test, notifier_id))
|
||||||
return "Invalid notifier id %s." % notifier_id
|
return {'result': 'success', 'message': 'Invalid notifier id %s.' % notifier_id}
|
||||||
else:
|
else:
|
||||||
logger.debug(u"Unable to send %snotification, no notifier_id received." % test)
|
logger.debug(u"Unable to send %snotification, no notifier_id received." % test)
|
||||||
return "No notifier id received."
|
return {'result': 'success', 'message': 'No notifier id received.'}
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue