mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Add some test monitoring pages for debugging.
Update the new users table along with the old one.
This commit is contained in:
parent
671566a5b2
commit
65b3930baa
9 changed files with 896 additions and 5 deletions
80
data/interfaces/default/history_new.html
Normal file
80
data/interfaces/default/history_new.html
Normal file
|
@ -0,0 +1,80 @@
|
|||
<%inherit file="base.html"/>
|
||||
<%!
|
||||
from plexpy import helpers
|
||||
%>
|
||||
|
||||
<%def name="headIncludes()">
|
||||
<link rel="stylesheet" href="interfaces/default/css/plexwatch-tables.css">
|
||||
<link rel="stylesheet" href="interfaces/default/css/dataTables.responsive.css">
|
||||
</%def>
|
||||
|
||||
<%def name="body()">
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="wellheader-bg">
|
||||
<div class="dashboard-wellheader-no-chevron">
|
||||
<h2><i class="fa fa-history"></i> History</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='container-fluid'>
|
||||
<div class='row-fluid'>
|
||||
<div class='span12'>
|
||||
<div class='table-card-back'>
|
||||
<table class="display" id="history_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="never" align='left' id="id">ID</th>
|
||||
<th class="all" align='left' id="time">Time</th>
|
||||
<th class="all" align='left' id="friendly_name">User</th>
|
||||
<th class="desktop" align='left' id="platform">Platform</th>
|
||||
<th class="desktop" align='left' id="ip_address">IP Address</th>
|
||||
<th class="min-tablet" align='left' id="title">Title</th>
|
||||
<th class="min-tablet" align='left' id="started">Started</th>
|
||||
<th class="desktop" align='left' id="paused_counter">Paused</th>
|
||||
<th class="desktop" align='left' id="stopped">Stopped</th>
|
||||
<th class="desktop" align='left' id="duration">Duration</th>
|
||||
<th class="desktop" align='left' id="percent_complete">Completed</th>
|
||||
<th class="never" align='left' id="grandparent_rating_key">grandparentRatingKey</th>
|
||||
<th class="never" align='left' id="rating_key">RatingKey</th>
|
||||
<th class="never" align='left' id="user"></th>
|
||||
<th class="never" align='left' id="media_type"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<div id="info-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="info-modal"
|
||||
aria-hidden="true">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
|
||||
<%def name="javascriptIncludes()">
|
||||
|
||||
<script src="interfaces/default/js/jquery.dataTables.min.js"></script>
|
||||
<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/moment-with-locale.js"></script>
|
||||
<script src="interfaces/default/js/tables/history_table_new.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
history_table_options.ajax = {
|
||||
"url": "get_history_new"
|
||||
}
|
||||
|
||||
history_table = $('#history_table').DataTable(history_table_options);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</%def>
|
217
data/interfaces/default/js/tables/history_table_new.js
Normal file
217
data/interfaces/default/js/tables/history_table_new.js
Normal file
|
@ -0,0 +1,217 @@
|
|||
var date_format = 'YYYY-MM-DD hh:mm';
|
||||
var time_format = 'hh:mm a';
|
||||
|
||||
$.ajax({
|
||||
url: 'get_date_formats',
|
||||
type: 'GET',
|
||||
success: function(data) {
|
||||
date_format = data.date_format;
|
||||
time_format = data.time_format;
|
||||
}
|
||||
});
|
||||
|
||||
history_table_options = {
|
||||
"destroy": true,
|
||||
"responsive": {
|
||||
details: false
|
||||
},
|
||||
"language": {
|
||||
"search": "Search: ",
|
||||
"lengthMenu":"Show _MENU_ entries per page",
|
||||
"info":"Showing _START_ to _END_ of _TOTAL_ history items",
|
||||
"infoEmpty":"Showing 0 to 0 of 0 entries",
|
||||
"infoFiltered":"(filtered from _MAX_ total entries)",
|
||||
"emptyTable": "No data in table",
|
||||
},
|
||||
"stateSave": false,
|
||||
"sPaginationType": "bootstrap",
|
||||
"processing": false,
|
||||
"serverSide": true,
|
||||
"pageLength": 25,
|
||||
"order": [ 1, 'desc'],
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": [0],
|
||||
"data":"id",
|
||||
"visible": false,
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [1],
|
||||
"data":"date",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (rowData['stopped'] === null) {
|
||||
$(td).addClass('currentlyWatching');
|
||||
$(td).html('Currently watching...');
|
||||
} else {
|
||||
$(td).html(moment(cellData,"X").format(date_format));
|
||||
}
|
||||
},
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [2],
|
||||
"data":"friendly_name",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html('<a href="user?user=' + rowData['user'] + '">' + cellData + '</a>');
|
||||
} else {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [3],
|
||||
"data":"platform",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html('<a href="#info-modal" data-toggle="modal"><span data-toggle="tooltip" data-placement="left" title="Stream Info" id="stream-info"><i class="fa fa-lg fa-info-circle"></i></span></a> '+cellData);
|
||||
}
|
||||
},
|
||||
"className": "modal-control no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [4],
|
||||
"data":"ip_address",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if ((cellData == '') || (cellData == '0')) {
|
||||
$(td).html('n/a');
|
||||
}
|
||||
},
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [5],
|
||||
"data":"title",
|
||||
"name":"title",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
if (rowData['media_type'] === 'movie' || rowData['media_type'] === 'episode') {
|
||||
$(td).html('<div><div style="float: left;"><a href="info?rating_key=' + rowData['rating_key'] + '">' + cellData + '</a></div><div style="float: right; text-align: right; padding-right: 5px;"><i class="fa fa-video-camera"></i></div></div>');
|
||||
} else if (rowData['media_type'] === 'track') {
|
||||
$(td).html('<div><div style="float: left;">' + cellData + '</div><div style="float: right; text-align: right; padding-right: 5px;"><i class="fa fa-music"></i></div></div>');
|
||||
} else {
|
||||
$(td).html('<a href="info?rating_key=' + rowData['rating_key'] + '">' + cellData + '</a>');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [6],
|
||||
"data":"started",
|
||||
"render": function ( data, type, full ) {
|
||||
return moment(data, "X").format(time_format);
|
||||
},
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [7],
|
||||
"data":"paused_counter",
|
||||
"render": function ( data, type, full ) {
|
||||
return Math.round(moment.duration(data, 'seconds').as('minutes')) + ' mins';
|
||||
},
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [8],
|
||||
"data":"stopped",
|
||||
"render": function ( data, type, full ) {
|
||||
if (data !== null) {
|
||||
return moment(data, "X").format(time_format);
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [9],
|
||||
"data":"duration",
|
||||
"render": function ( data, type, full ) {
|
||||
if (data !== null) {
|
||||
return Math.round(moment.duration(data, 'seconds').as('minutes')) + ' mins';
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
},
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [10],
|
||||
"data":"percent_complete",
|
||||
"render": function ( data, type, full ) {
|
||||
if (data < 85) {
|
||||
return '<span class="badge">'+Math.round(data)+'%</span>';
|
||||
} else {
|
||||
return '<span class="badge">100%</span>';
|
||||
}
|
||||
},
|
||||
"searchable": false,
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [11],
|
||||
"data":"grandparent_rating_key",
|
||||
"visible": false,
|
||||
"searchable": false
|
||||
},
|
||||
{
|
||||
"targets": [12],
|
||||
"data":"rating_key",
|
||||
"visible": false,
|
||||
"searchable": false
|
||||
},
|
||||
{
|
||||
"targets": [13],
|
||||
"data":"media_type",
|
||||
"searchable":false,
|
||||
"visible":false
|
||||
},
|
||||
{
|
||||
"targets": [14],
|
||||
"data":"user",
|
||||
"searchable":false,
|
||||
"visible":false
|
||||
}
|
||||
|
||||
],
|
||||
"drawCallback": function (settings) {
|
||||
// Jump to top of page
|
||||
// $('html,body').scrollTop(0);
|
||||
$('#ajaxMsg').addClass('success').fadeOut();
|
||||
},
|
||||
"preDrawCallback": function(settings) {
|
||||
$('#ajaxMsg').html("<div class='msg'><i class='fa fa-refresh fa-spin'></i> Fetching rows...</div>");
|
||||
$('#ajaxMsg').addClass('success').fadeIn();
|
||||
}
|
||||
}
|
||||
|
||||
$('#history_table').on('mouseenter', 'td.modal-control span', function () {
|
||||
$(this).tooltip();
|
||||
});
|
||||
|
||||
$('#history_table').on('click', 'td.modal-control', function () {
|
||||
var tr = $(this).parents('tr');
|
||||
var row = history_table.row( tr );
|
||||
var rowData = row.data();
|
||||
|
||||
function showStreamDetails() {
|
||||
$.ajax({
|
||||
url: 'get_stream_data',
|
||||
data: {row_id: rowData['id'], user: rowData['friendly_name']},
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function(xhr, status) {
|
||||
$("#info-modal").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
showStreamDetails();
|
||||
});
|
|
@ -15,9 +15,6 @@ users_list_table_options = {
|
|||
"serverSide": true,
|
||||
"pageLength": 10,
|
||||
"order": [ 1, 'asc'],
|
||||
"ajax": {
|
||||
"url": "get_user_list"
|
||||
},
|
||||
"autoWidth": true,
|
||||
"stateSave": true,
|
||||
"sPaginationType": "bootstrap",
|
||||
|
|
|
@ -58,6 +58,10 @@ from plexpy import helpers
|
|||
<script src="interfaces/default/js/moment-with-locale.js"></script>
|
||||
<script src="interfaces/default/js/tables/users.js"></script>
|
||||
<script>
|
||||
users_list_table_options.ajax = {
|
||||
"url": "get_user_list"
|
||||
}
|
||||
|
||||
var users_list_table = $('#users_list_table').DataTable(users_list_table_options);
|
||||
|
||||
|
||||
|
|
69
data/interfaces/default/users_new.html
Normal file
69
data/interfaces/default/users_new.html
Normal file
|
@ -0,0 +1,69 @@
|
|||
<%inherit file="base.html"/>
|
||||
<%!
|
||||
from plexpy import helpers
|
||||
%>
|
||||
|
||||
<%def name="headIncludes()">
|
||||
<link rel="stylesheet" href="interfaces/default/css/plexwatch-tables.css">
|
||||
<link rel="stylesheet" href="interfaces/default/css/dataTables.responsive.css">
|
||||
</%def>
|
||||
|
||||
<%def name="body()">
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="wellheader-bg">
|
||||
<div class="dashboard-wellheader-no-chevron">
|
||||
<div class="span9"><h2><i class="fa fa-group"></i> Active Users</h2></div>
|
||||
<div class="span3">
|
||||
<div class="pull-right">
|
||||
<h5><a href="refresh_users_list"><i class="fa fa-refresh"></i> Refresh users</a></h5>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='container-fluid'>
|
||||
<div class='row-fluid'>
|
||||
<div class='span12'>
|
||||
<div class='table-card-back'>
|
||||
<table id="users_list_table" class="display" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="all" align="right" id="avatar"></th>
|
||||
<th class="all" align="left" id="friendly_name">User</th>
|
||||
<th class="min-tablet" align="left" id="last_seen">Last Seen</th>
|
||||
<th class="min-tablet" align="left" id="last_known_ip">Last Known IP</th>
|
||||
<th class="min-tablet" align="left" id="total_plays">Total Plays</th>
|
||||
<th class="never" align="left" id="user"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<footer></footer>
|
||||
</div>
|
||||
|
||||
</%def>
|
||||
|
||||
<%def name="javascriptIncludes()">
|
||||
<script src="interfaces/default/js/jquery.dataTables.min.js"></script>
|
||||
<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/moment-with-locale.js"></script>
|
||||
<script src="interfaces/default/js/tables/users.js"></script>
|
||||
<script>
|
||||
users_list_table_options.ajax = {
|
||||
"url": "get_user_list_new"
|
||||
}
|
||||
|
||||
var users_list_table = $('#users_list_table').DataTable(users_list_table_options);
|
||||
|
||||
|
||||
</script>
|
||||
</%def>
|
Loading…
Add table
Add a link
Reference in a new issue