mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Separate out scheduler table to allow reloading
This commit is contained in:
parent
5d738e58eb
commit
25c2f95e48
5 changed files with 93 additions and 51 deletions
|
@ -54,7 +54,7 @@ function showMsg(msg,loader,timeout,ms,error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function doAjaxCall(url,elem,reload,form) {
|
function doAjaxCall(url, elem, reload, form, callback) {
|
||||||
// Set Message
|
// Set Message
|
||||||
feedback = $("#ajaxMsg");
|
feedback = $("#ajaxMsg");
|
||||||
update = $("#updatebar");
|
update = $("#updatebar");
|
||||||
|
@ -157,6 +157,9 @@ function doAjaxCall(url,elem,reload,form) {
|
||||||
complete: function(jqXHR, textStatus) {
|
complete: function(jqXHR, textStatus) {
|
||||||
// Remove loaders and stuff, ajax request is complete!
|
// Remove loaders and stuff, ajax request is complete!
|
||||||
loader.remove();
|
loader.remove();
|
||||||
|
if (typeof callback === "function") {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,9 +147,8 @@ from plexpy import helpers
|
||||||
})
|
})
|
||||||
|
|
||||||
$('#save-notification-item').click(function () {
|
$('#save-notification-item').click(function () {
|
||||||
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
|
||||||
// Reload modal to update certain fields
|
// Reload modal to update certain fields
|
||||||
reloadModal();
|
doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -211,8 +210,8 @@ from plexpy import helpers
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#pushbullet_apikey, #pushover_apitoken, #scripts_folder').on('change', function () {
|
$('#pushbullet_apikey, #pushover_apitoken, #scripts_folder').on('change', function () {
|
||||||
doAjaxCall('set_notification_config', $(this), 'tabs', true);
|
// Reload modal to update certain fields
|
||||||
reloadModal();
|
doAjaxCall('set_notification_config', $(this), 'tabs', true, reloadModal);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
64
data/interfaces/default/scheduler_table.html
Normal file
64
data/interfaces/default/scheduler_table.html
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
<%doc>
|
||||||
|
USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE
|
||||||
|
|
||||||
|
For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/
|
||||||
|
|
||||||
|
Filename: scheduler_table.html
|
||||||
|
Version: 0.1
|
||||||
|
|
||||||
|
DOCUMENTATION :: END
|
||||||
|
</%doc>
|
||||||
|
|
||||||
|
<%!
|
||||||
|
import arrow
|
||||||
|
import plexpy
|
||||||
|
from plexpy import common
|
||||||
|
|
||||||
|
scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
|
||||||
|
%>
|
||||||
|
|
||||||
|
<table class="config-scheduler-table small-muted">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Scheduled Task</th>
|
||||||
|
<th>State</th>
|
||||||
|
<th>Interval</th>
|
||||||
|
<th>Next Run In</th>
|
||||||
|
<th>Next Run Time</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
% for job in common.SCHEDULER_LIST:
|
||||||
|
% if job in scheduled_jobs:
|
||||||
|
<%
|
||||||
|
sched_job = plexpy.SCHED.get_job(job)
|
||||||
|
run_interval = arrow.get(str(sched_job.trigger.interval), ['H:mm:ss', 'HH:mm:ss'])
|
||||||
|
next_run_interval = arrow.get(sched_job.next_run_time).timestamp - arrow.now().timestamp
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<td>${sched_job.id}</td>
|
||||||
|
<td>Active</td>
|
||||||
|
<td>${arrow.get(run_interval).format('HH:mm:ss')}</td>
|
||||||
|
<td>${arrow.get(next_run_interval).format('HH:mm:ss')}</td>
|
||||||
|
<td>${arrow.get(sched_job.next_run_time).format('YYYY-MM-DD HH:mm:ss')}</td>
|
||||||
|
</tr>
|
||||||
|
% elif job == 'Check for active sessions' and plexpy.CONFIG.MONITORING_USE_WEBSOCKET:
|
||||||
|
<tr>
|
||||||
|
<td>${job}</td>
|
||||||
|
<td>Using Websockets</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
</tr>
|
||||||
|
% else:
|
||||||
|
<tr>
|
||||||
|
<td>${job}</td>
|
||||||
|
<td>Inactive</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
</tr>
|
||||||
|
% endif
|
||||||
|
% endfor
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -130,51 +130,10 @@ scheduled_jobs = [j.id for j in plexpy.SCHED.get_jobs()]
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
<h3>PlexPy Scheduler</h3>
|
<h3>PlexPy Scheduler</h3>
|
||||||
</div>
|
</div>
|
||||||
<table class="config-scheduler-table small-muted">
|
<div id="plexpy-scheduler-table">
|
||||||
<thead>
|
<div class='text-muted'><i class="fa fa-refresh fa-spin"></i> Loading scheduler table...</div>
|
||||||
<tr>
|
<br>
|
||||||
<th>Scheduled Task</th>
|
</div>
|
||||||
<th>State</th>
|
|
||||||
<th>Interval</th>
|
|
||||||
<th>Next Run In</th>
|
|
||||||
<th>Next Run Time</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
% for job in plexpy.common.SCHEDULER_LIST:
|
|
||||||
% if job in scheduled_jobs:
|
|
||||||
<%
|
|
||||||
sched_job = plexpy.SCHED.get_job(job)
|
|
||||||
run_interval = arrow.get(str(sched_job.trigger.interval), ['H:mm:ss', 'HH:mm:ss'])
|
|
||||||
next_run_interval = arrow.get(sched_job.next_run_time).timestamp - arrow.now().timestamp
|
|
||||||
%>
|
|
||||||
<tr>
|
|
||||||
<td>${sched_job.id}</td>
|
|
||||||
<td>Active</td>
|
|
||||||
<td>${arrow.get(run_interval).format('HH:mm:ss')}</td>
|
|
||||||
<td>${arrow.get(next_run_interval).format('HH:mm:ss')}</td>
|
|
||||||
<td>${arrow.get(sched_job.next_run_time).format('YYYY-MM-DD HH:mm:ss')}</td>
|
|
||||||
</tr>
|
|
||||||
% elif job == 'Check for active sessions' and plexpy.CONFIG.MONITORING_USE_WEBSOCKET:
|
|
||||||
<tr>
|
|
||||||
<td>${job}</td>
|
|
||||||
<td>Using Websockets</td>
|
|
||||||
<td>N/A</td>
|
|
||||||
<td>N/A</td>
|
|
||||||
<td>N/A</td>
|
|
||||||
</tr>
|
|
||||||
% else:
|
|
||||||
<tr>
|
|
||||||
<td>${job}</td>
|
|
||||||
<td>Inactive</td>
|
|
||||||
<td>N/A</td>
|
|
||||||
<td>N/A</td>
|
|
||||||
<td>N/A</td>
|
|
||||||
</tr>
|
|
||||||
% endif
|
|
||||||
% endfor
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
<div role="tabpanel" class="tab-pane" id="tabs-1">
|
<div role="tabpanel" class="tab-pane" id="tabs-1">
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
|
@ -1661,7 +1620,7 @@ $(document).ready(function() {
|
||||||
var configForm = $("#configUpdate");
|
var configForm = $("#configUpdate");
|
||||||
function saveSettings() {
|
function saveSettings() {
|
||||||
if (configForm.parsley().validate()) {
|
if (configForm.parsley().validate()) {
|
||||||
doAjaxCall('configUpdate', $(this), 'tabs', true);
|
doAjaxCall('configUpdate', $(this), 'tabs', true, getSchedulerTable);
|
||||||
postSaveChecks();
|
postSaveChecks();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -2000,6 +1959,19 @@ $(document).ready(function() {
|
||||||
};
|
};
|
||||||
$(this).on('focus keyup input', function() { resizeTextarea(this); }).removeAttr('data-autoresize');
|
$(this).on('focus keyup input', function() { resizeTextarea(this); }).removeAttr('data-autoresize');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getSchedulerTable() {
|
||||||
|
$.ajax({
|
||||||
|
url: 'get_scheduler_table',
|
||||||
|
cache: false,
|
||||||
|
async: true,
|
||||||
|
complete: function(xhr, status) {
|
||||||
|
$("#plexpy-scheduler-table").html(xhr.responseText);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getSchedulerTable();
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</%def>
|
</%def>
|
|
@ -1321,6 +1321,10 @@ class WebInterface(object):
|
||||||
|
|
||||||
raise cherrypy.HTTPRedirect("settings")
|
raise cherrypy.HTTPRedirect("settings")
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
def get_scheduler_table(self, **kwargs):
|
||||||
|
return serve_template(templatename="scheduler_table.html")
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def get_notification_agent_config(self, agent_id, **kwargs):
|
def get_notification_agent_config(self, agent_id, **kwargs):
|
||||||
if agent_id.isdigit():
|
if agent_id.isdigit():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue