mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-21 05:43:22 -07:00
Some work on sync lists.
This commit is contained in:
parent
4830cc7d68
commit
69ffaf5292
7 changed files with 333 additions and 26 deletions
|
@ -237,4 +237,8 @@ function humanTime(seconds) {
|
|||
text = '<h1> / </h1><h3>' + Math.floor(moment.duration(((seconds % 86400) % 3600), 'seconds').asMinutes()) + '</h3><p> mins</p>';
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String.prototype.toProperCase = function () {
|
||||
return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
|
||||
};
|
117
data/interfaces/default/js/tables/sync_table.js
Normal file
117
data/interfaces/default/js/tables/sync_table.js
Normal file
|
@ -0,0 +1,117 @@
|
|||
$('#sync_table').dataTable( {
|
||||
"responsive": {
|
||||
details: false
|
||||
},
|
||||
"processing": false,
|
||||
"serverSide": false,
|
||||
"ajax": {
|
||||
"url": "get_sync"
|
||||
},
|
||||
"sPaginationType": "bootstrap",
|
||||
"order": [ 0, 'desc'],
|
||||
"pageLength": 25,
|
||||
"stateSave": true,
|
||||
"language": {
|
||||
"search":"Search: ",
|
||||
"lengthMenu":"Show _MENU_ lines per page",
|
||||
"emptyTable": "No synced items",
|
||||
"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],
|
||||
"data": "state",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData === 'pending') {
|
||||
$(td).addClass('currentlyWatching');
|
||||
$(td).html('Pending...');
|
||||
} else {
|
||||
$(td).html(cellData.toProperCase());
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [1],
|
||||
"data": "friendly_name",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html('<a href="user?user=' + rowData['username'] + '">' + cellData + '</a>');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [2],
|
||||
"data": "title",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
if (rowData['metadata_type'] !== 'track') {
|
||||
$(td).html('<a href="info?rating_key=' + rowData['rating_key'] + '">' + cellData + '</a>');
|
||||
} else {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [3],
|
||||
"data": "metadata_type",
|
||||
"render": function ( data, type, full ) {
|
||||
return data.toProperCase();
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [4],
|
||||
"data": "device_name"
|
||||
},
|
||||
{
|
||||
"targets": [5],
|
||||
"data": "platform"
|
||||
},
|
||||
{
|
||||
"targets": [6],
|
||||
"data": "total_size",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData > 0 ) {
|
||||
megabytes = Math.round((cellData/1024)/1024, 0)
|
||||
$(td).html(megabytes + 'MB');
|
||||
} else {
|
||||
$(td).html(megabytes + '0MB');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"targets": [7],
|
||||
"data": "item_count"
|
||||
},
|
||||
{
|
||||
"targets": [8],
|
||||
"data": "item_complete_count"
|
||||
},
|
||||
{
|
||||
"targets": [9],
|
||||
"data": "item_downloaded_count"
|
||||
},
|
||||
{
|
||||
"targets": [10],
|
||||
"data": null,
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (rowData['item_count'] > 0 ) {
|
||||
percent_complete = Math.round((rowData['item_downloaded_count']/rowData['item_count']*100),0);
|
||||
$(td).html('<span class="badge">' + percent_complete + '%</span>');
|
||||
} else {
|
||||
$(td).html('<span class="badge">0%</span>');
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"drawCallback": function (settings) {
|
||||
// Jump to top of page
|
||||
$('html,body').scrollTop(0);
|
||||
$('#ajaxMsg').addClass('success').fadeOut();
|
||||
},
|
||||
"preDrawCallback": function(settings) {
|
||||
$('#ajaxMsg').html("<div class='msg'><span class='ui-icon ui-icon-check'></span>Fetching rows...</div>");
|
||||
$('#ajaxMsg').addClass('success').fadeIn();
|
||||
}
|
||||
});
|
66
data/interfaces/default/sync.html
Normal file
66
data/interfaces/default/sync.html
Normal file
|
@ -0,0 +1,66 @@
|
|||
<%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">
|
||||
<style>
|
||||
td {word-wrap: break-word}
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="headerIncludes()">
|
||||
</%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-book"></i> Synced Items</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="sync_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='left' id="state">State</th>
|
||||
<th align='left' id="username">Username</th>
|
||||
<th align='left' id="title">Title</th>
|
||||
<th align='left' id="type">Type</th>
|
||||
<th align='left' id="device">Device</th>
|
||||
<th align='left' id="platform">Platform</th>
|
||||
<th align='left' id="size">Total Size</th>
|
||||
<th align='left' id="items">Total Items</th>
|
||||
<th align='left' id="converted">Converted</th>
|
||||
<th align='left' id="downloaded">Downloaded</th>
|
||||
<th align='left' id="percent_complete">Complete</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
</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/tables/sync_table.js"></script>
|
||||
|
||||
</%def>
|
Loading…
Add table
Add a link
Reference in a new issue