mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Add trigger time to notification and newsletter tables
This commit is contained in:
parent
62be48df9c
commit
fdc1dd3525
5 changed files with 60 additions and 15 deletions
|
@ -20,13 +20,28 @@ DOCUMENTATION :: END
|
||||||
% else:
|
% else:
|
||||||
${newsletter['agent_label']} <span class="friendly_name">(${newsletter['id']})</span>
|
${newsletter['agent_label']} <span class="friendly_name">(${newsletter['id']})</span>
|
||||||
% endif
|
% endif
|
||||||
<span class="toggle-right"><i class="fa fa-lg fa-fw fa-cog"></i></span>
|
<span class="toggle-right friendly_name">
|
||||||
<span class="toggle-right friendly_name" id="newsletter-next_run-${newsletter['id']}">
|
|
||||||
% if newsletter_handler.NEWSLETTER_SCHED.get_job('newsletter-{}'.format(newsletter['id'])):
|
% if newsletter_handler.NEWSLETTER_SCHED.get_job('newsletter-{}'.format(newsletter['id'])):
|
||||||
<% job = newsletter_handler.NEWSLETTER_SCHED.get_job('newsletter-{}'.format(newsletter['id'])) %>
|
<% job = newsletter_handler.NEWSLETTER_SCHED.get_job('newsletter-{}'.format(newsletter['id'])) %>
|
||||||
<script>
|
<span id="newsletter-next_run-${newsletter['id']}">
|
||||||
$("#newsletter-next_run-${newsletter['id']}").text(moment("${job.next_run_time}", "YYYY-MM-DD HH:mm:ssZ").fromNow())
|
<script>
|
||||||
</script>
|
$("#newsletter-next_run-${newsletter['id']}").text(
|
||||||
|
"Next: " + moment("${job.next_run_time}", "YYYY-MM-DD HH:mm:ssZ").fromNow() + " | ")
|
||||||
|
</script>
|
||||||
|
</span>
|
||||||
|
% endif
|
||||||
|
% if newsletter['last_triggered']:
|
||||||
|
<% icon, icon_tooltip = ('fa-check', 'Success') if newsletter['last_success'] else ('fa-times', 'Failed') %>
|
||||||
|
<span id="newsletter-last_triggered-${newsletter['id']}">
|
||||||
|
<script>
|
||||||
|
$("#newsletter-last_triggered-${newsletter['id']}").html(
|
||||||
|
"Last: " + moment("${newsletter['last_triggered']}", "X").fromNow() + ' <i class="fa fa-lg fa-fw ${icon}" data-toggle="tooltip" data-placement="top" title="${icon_tooltip}"></i>'
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
</span>
|
||||||
|
% else:
|
||||||
|
Last: never
|
||||||
|
<i class="fa fa-lg fa-fw fa-minus"></i>
|
||||||
% endif
|
% endif
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -19,7 +19,20 @@ DOCUMENTATION :: END
|
||||||
% else:
|
% else:
|
||||||
${notifier['agent_label']} <span class="friendly_name">(${notifier['id']})</span>
|
${notifier['agent_label']} <span class="friendly_name">(${notifier['id']})</span>
|
||||||
% endif
|
% endif
|
||||||
<span class="toggle-right"><i class="fa fa-lg fa-fw fa-cog"></i></span>
|
<span class="toggle-right friendly_name">
|
||||||
|
% if notifier['last_triggered']:
|
||||||
|
<% icon, icon_tooltip = ('fa-check', 'Success') if notifier['last_success'] else ('fa-times', 'Failed') %>
|
||||||
|
<span id="notifier-last_triggered-${notifier['id']}">
|
||||||
|
<script>
|
||||||
|
$("#notifier-last_triggered-${notifier['id']}").html(
|
||||||
|
moment("${notifier['last_triggered']}", "X").fromNow() + ' <i class="fa fa-lg fa-fw ${icon}" data-toggle="tooltip" data-placement="top" title="${icon_tooltip}"></i>'
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
</span>
|
||||||
|
% else:
|
||||||
|
never
|
||||||
|
<i class="fa fa-lg fa-fw fa-minus"></i>
|
||||||
|
% endif
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
% endfor
|
% endfor
|
||||||
|
|
|
@ -1278,7 +1278,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
Add a new notification agent, or configure an existing notification agent by clicking the settings icon on the right.
|
Add a new notification agent, or configure an existing notification agent by clicking on the item below.
|
||||||
</p>
|
</p>
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
Please see the <a href="${anon_url('https://github.com/%s/%s/wiki/Notification-Agents-Guide' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO))}" target="_blank" rel="noreferrer">Notification Agents Guide</a> for instructions on setting up each notification agent.
|
Please see the <a href="${anon_url('https://github.com/%s/%s/wiki/Notification-Agents-Guide' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO))}" target="_blank" rel="noreferrer">Notification Agents Guide</a> for instructions on setting up each notification agent.
|
||||||
|
@ -1298,7 +1298,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
Add a new newsletter agent, or configure an existing newsletter agent by clicking the settings icon on the right.
|
Add a new newsletter agent, or configure an existing newsletter agent by clicking on the item below.
|
||||||
</p>
|
</p>
|
||||||
<p class="help-block settings-warning" id="newsletter_upload_warning">
|
<p class="help-block settings-warning" id="newsletter_upload_warning">
|
||||||
Warning: The <a data-tab-destination="3rd_party_apis" data-target="notify_upload_posters">Image Hosting</a> setting must be enabled for images to display on the newsletter.</span>
|
Warning: The <a data-tab-destination="3rd_party_apis" data-target="notify_upload_posters">Image Hosting</a> setting must be enabled for images to display on the newsletter.</span>
|
||||||
|
@ -1630,7 +1630,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Registered Devices</label>
|
<label>Registered Devices</label>
|
||||||
<p class="help-block">Register a new device using a QR code, or configure an existing device by clicking the settings icon on the right.</p>
|
<p class="help-block">Register a new device using a QR code, or configure an existing device by clicking on the item below.</p>
|
||||||
<p id="app_api_msg" style="color: #eb8600;">Warning: The API must be enabled under <a data-tab-destination="web_interface" data-target="api_enabled">Web Interface</a> to use the app.</p>
|
<p id="app_api_msg" style="color: #eb8600;">Warning: The API must be enabled under <a data-tab-destination="web_interface" data-target="api_enabled">Web Interface</a> to use the app.</p>
|
||||||
<br />
|
<br />
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -119,13 +119,22 @@ def get_newsletters(newsletter_id=None):
|
||||||
if newsletter_id:
|
if newsletter_id:
|
||||||
where = "WHERE "
|
where = "WHERE "
|
||||||
if newsletter_id:
|
if newsletter_id:
|
||||||
where_id += "id = ?"
|
where_id += "newsletters.id = ?"
|
||||||
args.append(newsletter_id)
|
args.append(newsletter_id)
|
||||||
where += " AND ".join([w for w in [where_id] if w])
|
where += " AND ".join([w for w in [where_id] if w])
|
||||||
|
|
||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
result = db.select("SELECT id, agent_id, agent_name, agent_label, "
|
result = db.select(
|
||||||
"friendly_name, cron, active FROM newsletters %s" % where, args=args)
|
(
|
||||||
|
"SELECT newsletters.id, newsletters.agent_id, newsletters.agent_name, newsletters.agent_label, "
|
||||||
|
"newsletters.friendly_name, newsletters.cron, newsletters.active, "
|
||||||
|
"MAX(newsletter_log.timestamp) AS last_triggered, newsletter_log.success AS last_success "
|
||||||
|
"FROM newsletters "
|
||||||
|
"LEFT OUTER JOIN newsletter_log ON newsletters.id = newsletter_log.newsletter_id "
|
||||||
|
"%s "
|
||||||
|
"GROUP BY newsletters.id"
|
||||||
|
) % where, args=args
|
||||||
|
)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -499,7 +499,7 @@ def get_notifiers(notifier_id=None, notify_action=None):
|
||||||
if notifier_id or notify_action:
|
if notifier_id or notify_action:
|
||||||
where = 'WHERE '
|
where = 'WHERE '
|
||||||
if notifier_id:
|
if notifier_id:
|
||||||
where_id += 'id = ?'
|
where_id += 'notifiers.id = ?'
|
||||||
args.append(notifier_id)
|
args.append(notifier_id)
|
||||||
if notify_action and notify_action in notify_actions:
|
if notify_action and notify_action in notify_actions:
|
||||||
where_action = '%s = ?' % notify_action
|
where_action = '%s = ?' % notify_action
|
||||||
|
@ -507,8 +507,16 @@ def get_notifiers(notifier_id=None, notify_action=None):
|
||||||
where += ' AND '.join([w for w in [where_id, where_action] if w])
|
where += ' AND '.join([w for w in [where_id, where_action] if w])
|
||||||
|
|
||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
result = db.select("SELECT id, agent_id, agent_name, agent_label, friendly_name, %s FROM notifiers %s"
|
result = db.select(
|
||||||
% (', '.join(notify_actions), where), args=args)
|
(
|
||||||
|
"SELECT notifiers.id, notifiers.agent_id, notifiers.agent_name, notifiers.agent_label, notifiers.friendly_name, %s, "
|
||||||
|
"MAX(notify_log.timestamp) AS last_triggered, notify_log.success AS last_success "
|
||||||
|
"FROM notifiers "
|
||||||
|
"LEFT OUTER JOIN notify_log ON notifiers.id = notify_log.notifier_id "
|
||||||
|
"%s "
|
||||||
|
"GROUP BY notifiers.id"
|
||||||
|
) % (', '.join(notify_actions), where), args=args
|
||||||
|
)
|
||||||
|
|
||||||
for item in result:
|
for item in result:
|
||||||
item['active'] = int(any([item.pop(k) for k in list(item.keys()) if k in notify_actions]))
|
item['active'] = int(any([item.pop(k) for k in list(item.keys()) if k in notify_actions]))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue