mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-14 09:12:58 -07:00
Add Product column to history tables
This commit is contained in:
parent
589fbd3158
commit
a9b10c4560
7 changed files with 44 additions and 24 deletions
|
@ -60,7 +60,8 @@
|
||||||
<th align="left" id="friendly_name">User</th>
|
<th align="left" id="friendly_name">User</th>
|
||||||
<th align="left" id="ip_address">IP Address</th>
|
<th align="left" id="ip_address">IP Address</th>
|
||||||
<th align="left" id="platform">Platform</th>
|
<th align="left" id="platform">Platform</th>
|
||||||
<th align="left" id="device">Player</th>
|
<th align="left" id="product">Product</th>
|
||||||
|
<th align="left" id="player">Player</th>
|
||||||
<th align="left" id="title">Title</th>
|
<th align="left" id="title">Title</th>
|
||||||
<th align="left" id="started">Started</th>
|
<th align="left" id="started">Started</th>
|
||||||
<th align="left" id="paused_counter">Paused</th>
|
<th align="left" id="paused_counter">Paused</th>
|
||||||
|
@ -143,7 +144,7 @@
|
||||||
var colvis = new $.fn.dataTable.ColVis(history_table, {
|
var colvis = new $.fn.dataTable.ColVis(history_table, {
|
||||||
buttonText: '<i class="fa fa-columns"></i> Select columns',
|
buttonText: '<i class="fa fa-columns"></i> Select columns',
|
||||||
buttonClass: 'btn btn-dark',
|
buttonClass: 'btn btn-dark',
|
||||||
exclude: [0, 11]
|
exclude: [0, 12]
|
||||||
});
|
});
|
||||||
$(colvis.button()).appendTo('div.colvis-button-bar');
|
$(colvis.button()).appendTo('div.colvis-button-bar');
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
<th align="left" id="friendly_name">User</th>
|
<th align="left" id="friendly_name">User</th>
|
||||||
<th align="left" id="ip_address">IP Address</th>
|
<th align="left" id="ip_address">IP Address</th>
|
||||||
<th align="left" id="platform">Platform</th>
|
<th align="left" id="platform">Platform</th>
|
||||||
|
<th align="left" id="product">Product</th>
|
||||||
<th align="left" id="device">Player</th>
|
<th align="left" id="device">Player</th>
|
||||||
<th align="left" id="title">Title</th>
|
<th align="left" id="title">Title</th>
|
||||||
<th align="left" id="started">Started</th>
|
<th align="left" id="started">Started</th>
|
||||||
|
@ -61,7 +62,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
history_table = $('#history_table_modal').DataTable(history_table_options);
|
history_table = $('#history_table_modal').DataTable(history_table_options);
|
||||||
history_table.columns([0, 3, 4, 8, 10, 11]).visible(false);
|
history_table.columns([0, 3, 4, 5, 9, 11, 12]).visible(false);
|
||||||
|
|
||||||
clearSearchButton('history_table_modal', history_table);
|
clearSearchButton('history_table_modal', history_table);
|
||||||
|
|
||||||
|
|
|
@ -451,6 +451,7 @@ DOCUMENTATION :: END
|
||||||
<th align="left" id="friendly_name">User</th>
|
<th align="left" id="friendly_name">User</th>
|
||||||
<th align="left" id="ip_address">IP Address</th>
|
<th align="left" id="ip_address">IP Address</th>
|
||||||
<th align="left" id="platform">Platform</th>
|
<th align="left" id="platform">Platform</th>
|
||||||
|
<th align="left" id="product">Product</th>
|
||||||
<th align="left" id="player">Player</th>
|
<th align="left" id="player">Player</th>
|
||||||
<th align="left" id="title">Title</th>
|
<th align="left" id="title">Title</th>
|
||||||
<th align="left" id="started">Started</th>
|
<th align="left" id="started">Started</th>
|
||||||
|
@ -613,7 +614,7 @@ DOCUMENTATION :: END
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
get_history();
|
get_history();
|
||||||
history_table = $('#history_table-RK-${data["rating_key"]}').DataTable(history_table_options);
|
history_table = $('#history_table-RK-${data["rating_key"]}').DataTable(history_table_options);
|
||||||
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
|
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 12] });
|
||||||
$(colvis.button()).appendTo('div.colvis-button-bar');
|
$(colvis.button()).appendTo('div.colvis-button-bar');
|
||||||
|
|
||||||
clearSearchButton('history_table-RK-${data["rating_key"]}', history_table);
|
clearSearchButton('history_table-RK-${data["rating_key"]}', history_table);
|
||||||
|
|
|
@ -49,7 +49,7 @@ history_table_options = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [1],
|
"targets": [1],
|
||||||
"data":"date",
|
"data": "date",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
var date = moment(cellData, "X").format(date_format);
|
var date = moment(cellData, "X").format(date_format);
|
||||||
if (rowData['state'] !== null) {
|
if (rowData['state'] !== null) {
|
||||||
|
@ -77,7 +77,7 @@ history_table_options = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [2],
|
"targets": [2],
|
||||||
"data":"friendly_name",
|
"data": "friendly_name",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData !== '') {
|
if (cellData !== '') {
|
||||||
if (rowData['user_id']) {
|
if (rowData['user_id']) {
|
||||||
|
@ -112,7 +112,18 @@ history_table_options = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [4],
|
"targets": [4],
|
||||||
"data":"platform",
|
"data": "platform",
|
||||||
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
|
if (cellData !== '') {
|
||||||
|
$(td).html(capitalizeFirstLetter(cellData));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"width": "10%",
|
||||||
|
"className": "no-wrap"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"targets": [5],
|
||||||
|
"data": "product",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData !== '') {
|
if (cellData !== '') {
|
||||||
$(td).html(cellData);
|
$(td).html(cellData);
|
||||||
|
@ -122,7 +133,7 @@ history_table_options = {
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [5],
|
"targets": [6],
|
||||||
"data": "player",
|
"data": "player",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData !== '') {
|
if (cellData !== '') {
|
||||||
|
@ -137,12 +148,12 @@ history_table_options = {
|
||||||
$(td).html('<div><a href="#" data-target="#info-modal" data-toggle="modal"><div style="float: left;">' + transcode_dec + ' ' + cellData + '</div></a></div>');
|
$(td).html('<div><a href="#" data-target="#info-modal" data-toggle="modal"><div style="float: left;">' + transcode_dec + ' ' + cellData + '</div></a></div>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "12%",
|
"width": "10%",
|
||||||
"className": "no-wrap modal-control"
|
"className": "no-wrap modal-control"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [6],
|
"targets": [7],
|
||||||
"data":"full_title",
|
"data": "full_title",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData !== '') {
|
if (cellData !== '') {
|
||||||
var parent_info = '';
|
var parent_info = '';
|
||||||
|
@ -171,12 +182,12 @@ history_table_options = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "33%",
|
"width": "25%",
|
||||||
"className": "datatable-wrap"
|
"className": "datatable-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [7],
|
"targets": [8],
|
||||||
"data":"started",
|
"data": "started",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData === null) {
|
if (cellData === null) {
|
||||||
$(td).html('n/a');
|
$(td).html('n/a');
|
||||||
|
@ -189,8 +200,8 @@ history_table_options = {
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [8],
|
"targets": [9],
|
||||||
"data":"paused_counter",
|
"data": "paused_counter",
|
||||||
"render": function (data, type, full) {
|
"render": function (data, type, full) {
|
||||||
if (data !== null) {
|
if (data !== null) {
|
||||||
return Math.round(moment.duration(data, 'seconds').as('minutes')) + ' mins';
|
return Math.round(moment.duration(data, 'seconds').as('minutes')) + ' mins';
|
||||||
|
@ -203,8 +214,8 @@ history_table_options = {
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [9],
|
"targets": [10],
|
||||||
"data":"stopped",
|
"data": "stopped",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData === null || (rowData['state'] != null && rowData['state'] != "stopped")) {
|
if (cellData === null || (rowData['state'] != null && rowData['state'] != "stopped")) {
|
||||||
$(td).html('n/a');
|
$(td).html('n/a');
|
||||||
|
@ -217,8 +228,8 @@ history_table_options = {
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [10],
|
"targets": [11],
|
||||||
"data":"duration",
|
"data": "duration",
|
||||||
"render": function (data, type, full) {
|
"render": function (data, type, full) {
|
||||||
if (data !== null) {
|
if (data !== null) {
|
||||||
return Math.round(moment.duration(data, 'seconds').as('minutes')) + ' mins';
|
return Math.round(moment.duration(data, 'seconds').as('minutes')) + ' mins';
|
||||||
|
@ -231,7 +242,7 @@ history_table_options = {
|
||||||
"className": "no-wrap"
|
"className": "no-wrap"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [11],
|
"targets": [12],
|
||||||
"data": "watched_status",
|
"data": "watched_status",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData == 1) {
|
if (cellData == 1) {
|
||||||
|
@ -489,7 +500,8 @@ function childTableFormat(rowData) {
|
||||||
'<th align="left" id="friendly_name">User</th>' +
|
'<th align="left" id="friendly_name">User</th>' +
|
||||||
'<th align="left" id="ip_address">IP Address</th>' +
|
'<th align="left" id="ip_address">IP Address</th>' +
|
||||||
'<th align="left" id="platform">Platform</th>' +
|
'<th align="left" id="platform">Platform</th>' +
|
||||||
'<th align="left" id="platform">Player</th>' +
|
'<th align="left" id="product">Product</th>' +
|
||||||
|
'<th align="left" id="player">Player</th>' +
|
||||||
'<th align="left" id="title">Title</th>' +
|
'<th align="left" id="title">Title</th>' +
|
||||||
'<th align="left" id="started">Started</th>' +
|
'<th align="left" id="started">Started</th>' +
|
||||||
'<th align="left" id="paused_counter">Paused</th>' +
|
'<th align="left" id="paused_counter">Paused</th>' +
|
||||||
|
|
|
@ -205,6 +205,7 @@ DOCUMENTATION :: END
|
||||||
<th align="left" id="friendly_name">User</th>
|
<th align="left" id="friendly_name">User</th>
|
||||||
<th align="left" id="ip_address">IP Address</th>
|
<th align="left" id="ip_address">IP Address</th>
|
||||||
<th align="left" id="platform">Platform</th>
|
<th align="left" id="platform">Platform</th>
|
||||||
|
<th align="left" id="product">Product</th>
|
||||||
<th align="left" id="player">Player</th>
|
<th align="left" id="player">Player</th>
|
||||||
<th align="left" id="title">Title</th>
|
<th align="left" id="title">Title</th>
|
||||||
<th align="left" id="started">Started</th>
|
<th align="left" id="started">Started</th>
|
||||||
|
@ -385,7 +386,7 @@ DOCUMENTATION :: END
|
||||||
};
|
};
|
||||||
history_table = $('#history_table-SID-${data["section_id"]}').DataTable(history_table_options);
|
history_table = $('#history_table-SID-${data["section_id"]}').DataTable(history_table_options);
|
||||||
|
|
||||||
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
|
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 12] });
|
||||||
$(colvis.button()).appendTo('#button-bar-history');
|
$(colvis.button()).appendTo('#button-bar-history');
|
||||||
|
|
||||||
clearSearchButton('history_table-SID-${data["section_id"]}', history_table);
|
clearSearchButton('history_table-SID-${data["section_id"]}', history_table);
|
||||||
|
|
|
@ -184,6 +184,7 @@ DOCUMENTATION :: END
|
||||||
<th align="left" id="friendly_name">User</th>
|
<th align="left" id="friendly_name">User</th>
|
||||||
<th align="left" id="ip_address">IP Address</th>
|
<th align="left" id="ip_address">IP Address</th>
|
||||||
<th align="left" id="platform">Platform</th>
|
<th align="left" id="platform">Platform</th>
|
||||||
|
<th align="left" id="product">Product</th>
|
||||||
<th align="left" id="player">Player</th>
|
<th align="left" id="player">Player</th>
|
||||||
<th align="left" id="title">Title</th>
|
<th align="left" id="title">Title</th>
|
||||||
<th align="left" id="started">Started</th>
|
<th align="left" id="started">Started</th>
|
||||||
|
@ -425,7 +426,7 @@ DOCUMENTATION :: END
|
||||||
history_table = $('#history_table-UID-${data["user_id"]}').DataTable(history_table_options);
|
history_table = $('#history_table-UID-${data["user_id"]}').DataTable(history_table_options);
|
||||||
history_table.column(2).visible(false);
|
history_table.column(2).visible(false);
|
||||||
|
|
||||||
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
|
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 12] });
|
||||||
$(colvis.button()).appendTo('#button-bar-history');
|
$(colvis.button()).appendTo('#button-bar-history');
|
||||||
|
|
||||||
clearSearchButton('history_table-UID-${data["user_id"]}', history_table);
|
clearSearchButton('history_table-UID-${data["user_id"]}', history_table);
|
||||||
|
|
|
@ -76,6 +76,7 @@ class DataFactory(object):
|
||||||
'(CASE WHEN users.friendly_name IS NULL OR TRIM(users.friendly_name) = "" \
|
'(CASE WHEN users.friendly_name IS NULL OR TRIM(users.friendly_name) = "" \
|
||||||
THEN users.username ELSE users.friendly_name END) AS friendly_name',
|
THEN users.username ELSE users.friendly_name END) AS friendly_name',
|
||||||
'platform',
|
'platform',
|
||||||
|
'product',
|
||||||
'player',
|
'player',
|
||||||
'ip_address',
|
'ip_address',
|
||||||
'session_history.media_type',
|
'session_history.media_type',
|
||||||
|
@ -123,6 +124,7 @@ class DataFactory(object):
|
||||||
'(CASE WHEN friendly_name IS NULL OR TRIM(friendly_name) = "" \
|
'(CASE WHEN friendly_name IS NULL OR TRIM(friendly_name) = "" \
|
||||||
THEN user ELSE friendly_name END) AS friendly_name',
|
THEN user ELSE friendly_name END) AS friendly_name',
|
||||||
'platform',
|
'platform',
|
||||||
|
'product',
|
||||||
'player',
|
'player',
|
||||||
'ip_address',
|
'ip_address',
|
||||||
'media_type',
|
'media_type',
|
||||||
|
@ -225,6 +227,7 @@ class DataFactory(object):
|
||||||
'user': item['user'],
|
'user': item['user'],
|
||||||
'friendly_name': item['friendly_name'],
|
'friendly_name': item['friendly_name'],
|
||||||
'platform': platform,
|
'platform': platform,
|
||||||
|
'product': item['product'],
|
||||||
'player': item['player'],
|
'player': item['player'],
|
||||||
'ip_address': item['ip_address'],
|
'ip_address': item['ip_address'],
|
||||||
'media_type': item['media_type'],
|
'media_type': item['media_type'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue