Add option in settings to view PMS logs, shows last 1000 lines.

Table styling fix.
This commit is contained in:
Tim 2015-07-04 00:41:37 +02:00
parent 349a850451
commit 0810584b46
9 changed files with 212 additions and 24 deletions

View file

@ -145,11 +145,22 @@
<p class="help-block">Set your preferred time format. <a href="#dateTimeOptionsModal" data-toggle="modal">Click here</a> to see the parameter list.</p>
</div>
</fieldset>
<fieldset>
<div class="wellheader">
<h3>Plex Logs</h3>
</div>
<div class="form-group">
<label for="pms_logs_folder">Logs Folder</label>
<input type="text" id="pms_logs_folder" name="pms_logs_folder" value="${config['pms_logs_folder']}" size="30" data-parsley-trigger="change">
<p class="help-block">Set the folder where your Plex Server logs are. <br/><a href="https://support.plex.tv/hc/en-us/articles/200250417-Plex-Media-Server-Log-Files" target="_blank">Click here</a> for help.</p>
</div>
</fieldset>
<br/>
</div>
<div class="span4">
<fieldset>
<div class="wellheader">
<h3>PMS Settings</h3>
<h3>Plex Media Server</h3>
</div>
<div class="form-group">
<label for="pms_ip">PMS IP</label>
@ -171,7 +182,7 @@
</div>
<div class="span4">
<div class="wellheader">
<h3>PlexWatch Settings</h3>
<h3>PlexWatch</h3>
</div>
<fieldset>
<div class="form-group">

View file

@ -34,7 +34,6 @@
position: relative;
clear: both;
zoom: 1; /* Feeling sorry for IE */
margin-left: -20px;
}

View file

@ -8182,7 +8182,7 @@ ol.test >li {
}
.table-card-back {
padding: 20px 20px 20px 40px;
padding: 20px;
background-color: #282828;
margin-left: auto;
margin-right: auto;

View file

@ -1,16 +1,14 @@
$('#log_table').dataTable( {
var log_table_options = {
"destroy": true,
"responsive": {
details: false
},
"processing": false,
"serverSide": true,
"ajax": {
"url": "getLog"
},
"processing": false,
"sPaginationType": "bootstrap",
"order": [ 0, 'desc'],
"pageLength": 10,
"stateSave": true,
"stateSave": false,
"language": {
"search":"Search: ",
"lengthMenu":"Show _MENU_ lines per page",
@ -41,4 +39,4 @@ $('#log_table').dataTable( {
$('#ajaxMsg').html("<div class='msg'><i class='fa fa-refresh fa-spin'></i>&nbspFetching rows...</div>");
$('#ajaxMsg').addClass('success').fadeIn();
}
});
}

View file

@ -0,0 +1,33 @@
var plex_log_table_options = {
"destroy": true,
"responsive": {
details: false
},
"processing": false,
"serverSide": false,
"sPaginationType": "bootstrap",
"order": [ 0, 'desc'],
"pageLength": 10,
"stateSave": false,
"language": {
"search":"Search: ",
"lengthMenu":"Show _MENU_ lines per page",
"emptyTable": "No log information available. Have you set your logs folder in the <a href='config'>settings</a>?",
"info":"Showing _START_ to _END_ of _TOTAL_ lines",
"infoEmpty":"Showing 0 to 0 of 0 lines",
"infoFiltered":"(filtered from _MAX_ total lines)"},
"columnDefs": [
{
"targets": [0],
"width": "15%"
},
{
"targets": [1],
"width": "10%"
},
{
"targets": [2],
"width": "75%"
}
]
}

View file

@ -31,21 +31,46 @@ from plexpy import helpers
</div>
</div>
</div>
<div class='container-fluid'>
<div class='row-fluid'>
<div class='span12'>
<div class='table-card-back'>
<table class="display" id="log_table" width="100%">
<thead>
<tr>
<th align='left' id="timestamp">Timestamp</th>
<th align='left' id="level">Level</th>
<th align='left' id="message">Message</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div role="tabpanel">
<ul class="nav nav-pills" role="tablist">
<li role="presentation" class="active"><a id="plexpy-logs-btn" href="#tabs-1" aria-controls="tabs-1" role="tab" data-toggle="tab">PlexPy Logs</a></li>
<li role="presentation"><a id="plex-logs-btn" href="#tabs-2" aria-controls="tabs-2" role="tab" data-toggle="tab">Plex Media Server Logs</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="tabs-1">
<table class="display" id="log_table" width="100%">
<thead>
<tr>
<th align='left' id="timestamp">Timestamp</th>
<th align='left' id="level">Level</th>
<th align='left' id="message">Message</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div role="tabpanel" class="tab-pane" id="tabs-2">
<table class="display" id="plex_log_table" width="100%">
<thead>
<tr>
<th align='left' id="plex_timestamp">Timestamp</th>
<th align='left' id="plex_level">Level</th>
<th align='left' id="plex_message">Message</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@ -71,7 +96,36 @@ from plexpy import helpers
<script src="interfaces/default/js/dataTables.responsive.js"></script>
<script src="interfaces/default/js/jquery.dataTables.bootstrap.pagination.integration.js"></script>
<script src="interfaces/default/js/tables/logs.js"></script>
<script src="interfaces/default/js/tables/plex_logs.js"></script>
<script>
$(document).ready(function() {
LoadPlexPyLogs();
});
function LoadPlexPyLogs() {
log_table_options.ajax = {
"url": "getLog"
}
log_table = $('#log_table').DataTable(log_table_options);
}
function LoadPlexLogs() {
plex_log_table_options.ajax = {
"url": "get_plex_log"
}
plex_log_table = $('#plex_log_table').DataTable(plex_log_table_options);
}
$("#plexpy-logs-btn").click(function() {
LoadPlexPyLogs();
});
$("#plex-logs-btn").click(function() {
console.log('clicked da button');
LoadPlexLogs();
});
var timer;
function setRefresh()
{
@ -84,7 +138,13 @@ from plexpy import helpers
}
if(refreshrate.value != 0)
{
timer = setInterval("$('#log_table').dataTable().fnDraw()",1000*refreshrate.value);
timer = setInterval(function() {
if ($("#tabs-1").hasClass("active")) {
log_table.ajax.reload();
} else {
plex_log_table.ajax.reload();
}
}, 1000*refreshrate.value);
}
}
}