mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 21:51:14 -07:00
Add export table to info page
This commit is contained in:
parent
acebf96d2f
commit
be82c8f6d9
4 changed files with 77 additions and 22 deletions
|
@ -24,8 +24,8 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form method="post" class="form" id="export_metadata_form">
|
<form method="post" class="form" id="export_metadata_form">
|
||||||
<input type="hidden" id="section_id" name="section_id" value="${section_id or ''}" />
|
<input type="hidden" id="export_section_id" name="export_section_id" value="${section_id or ''}" />
|
||||||
<input type="hidden" id="rating_key" name="rating_key" value="${rating_key or ''}" />
|
<input type="hidden" id="export_rating_key" name="export_rating_key" value="${rating_key or ''}" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="metadata_export_level_select">Metadata Export Level</label>
|
<label for="metadata_export_level_select">Metadata Export Level</label>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -88,8 +88,8 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$("#export_metadata").click(function() {
|
$("#export_metadata").click(function() {
|
||||||
var section_id = $('#section_id').val();
|
var section_id = $('#export_section_id').val();
|
||||||
var rating_key = $('#rating_key').val();
|
var rating_key = $('#export_rating_key').val();
|
||||||
var metadata_export_level = $('#metadata_export_level_select option:selected').val();
|
var metadata_export_level = $('#metadata_export_level_select option:selected').val();
|
||||||
var media_info_export_level = $('#media_info_export_level_select option:selected').val();
|
var media_info_export_level = $('#media_info_export_level_select option:selected').val();
|
||||||
var file_format = $('#file_format_select option:selected').val();
|
var file_format = $('#file_format_select option:selected').val();
|
||||||
|
@ -108,13 +108,8 @@ DOCUMENTATION :: END
|
||||||
async: true,
|
async: true,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.result === 'success') {
|
if (data.result === 'success') {
|
||||||
var msg = '';
|
redrawExportTable();
|
||||||
if (typeof export_table !== 'undefined') {
|
showMsg('<i class="fa fa-check"></i> ' + data.message, false, true, 5000);
|
||||||
redrawExportTable();
|
|
||||||
} else {
|
|
||||||
msg = '<br>View the export from the <a href="library?section_id=' + section_id +'#tab_tabs-export">library page</a>.'
|
|
||||||
}
|
|
||||||
showMsg('<i class="fa fa-check"></i> ' + data.message + msg, false, true, 5000);
|
|
||||||
} else {
|
} else {
|
||||||
showMsg('<i class="fa fa-exclamation-circle"></i> ' + data.message, false, true, 5000, true);
|
showMsg('<i class="fa fa-exclamation-circle"></i> ' + data.message, false, true, 5000, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,17 +518,11 @@ DOCUMENTATION :: END
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
% endif
|
% endif
|
||||||
<div class="btn-group">
|
|
||||||
<button class="btn btn-dark export-button" id="toggle-export-modal" data-toggle="modal" data-target="#export-modal"
|
|
||||||
data-section_id="${data['section_id']}" data-rating_key="${data['rating_key']}">
|
|
||||||
<i class="fa fa-file-export"></i> Export Metadata
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
% endif
|
% endif
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button class="btn btn-dark refresh-history-button" id="refresh-history-list"><i class="fa fa-refresh"></i> Refresh history</button>
|
<button class="btn btn-dark refresh-history-button" id="refresh-history-list"><i class="fa fa-refresh"></i> Refresh history</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-group colvis-button-bar"></div>
|
<div class="btn-group colvis-button-bar" id="button-bar-history"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-card-back">
|
<div class="table-card-back">
|
||||||
|
@ -555,6 +549,48 @@ DOCUMENTATION :: END
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
% endif
|
% endif
|
||||||
|
% if _session['user_group'] == 'admin':
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="table-card-header">
|
||||||
|
<div class="header-bar">
|
||||||
|
<span>Metadata Exports for <strong>${data['title']}</strong></span>
|
||||||
|
</div>
|
||||||
|
<div class="button-bar">
|
||||||
|
% if _session['user_group'] == 'admin':
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-dark export-button" id="toggle-export-modal" data-toggle="modal" data-target="#export-modal"
|
||||||
|
data-section_id="${data['section_id']}" data-rating_key="${data['rating_key']}">
|
||||||
|
<i class="fa fa-file-export"></i> Export Metadata
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="btn-group">
|
||||||
|
<button class="btn btn-dark refresh-export-table-button" id="refresh-export-table">
|
||||||
|
<i class="fa fa-refresh"></i> Refresh exports
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
|
<div class="btn-group colvis-button-bar" id="button-bar-export"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="table-card-back">
|
||||||
|
<table class="display export_table" id="export_table-RK-${data['rating_key']}" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th align="left" id="timestamp">Exported At</th>
|
||||||
|
<th align="left" id="media_type_title">Media Type</th>
|
||||||
|
<th align="left" id="rating_key">Rating Key</th>
|
||||||
|
<th align="left" id="filename">Filename</th>
|
||||||
|
<th align="left" id="file_format">File Format</th>
|
||||||
|
<th align="left" id="file_size">File Size</th>
|
||||||
|
<th align="left" id="complete">Download</th>
|
||||||
|
<th align="left" id="delete">Delete</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
% endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -659,6 +695,7 @@ DOCUMENTATION :: END
|
||||||
data = defaultdict(None, **metadata)
|
data = defaultdict(None, **metadata)
|
||||||
%>
|
%>
|
||||||
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
|
<script src="${http_root}js/tables/history_table.js${cache_param}"></script>
|
||||||
|
<script src="${http_root}js/tables/export_table.js${cache_param}"></script>
|
||||||
% if data['live']:
|
% if data['live']:
|
||||||
<script>
|
<script>
|
||||||
function get_history() {
|
function get_history() {
|
||||||
|
@ -730,7 +767,7 @@ DOCUMENTATION :: END
|
||||||
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, 12] });
|
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('#button-bar-history');
|
||||||
|
|
||||||
clearSearchButton('history_table-RK-${data["rating_key"]}', history_table);
|
clearSearchButton('history_table-RK-${data["rating_key"]}', history_table);
|
||||||
|
|
||||||
|
@ -864,6 +901,29 @@ DOCUMENTATION :: END
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function loadExportTable() {
|
||||||
|
// Build export table
|
||||||
|
export_table_options.ajax = {
|
||||||
|
url: 'get_library_export',
|
||||||
|
type: 'POST',
|
||||||
|
data: function ( d ) {
|
||||||
|
return {
|
||||||
|
json_data: JSON.stringify( d ),
|
||||||
|
rating_key: "${data['rating_key']}"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
export_table = $('#export_table-RK-${data["rating_key"]}').DataTable(export_table_options);
|
||||||
|
|
||||||
|
var colvis = new $.fn.dataTable.ColVis(export_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' });
|
||||||
|
$(colvis.button()).appendTo('#button-bar-export');
|
||||||
|
|
||||||
|
clearSearchButton('export_table-RK-${data["rating_key"]}', export_table);
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
loadExportTable();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
% if data.get('poster_url'):
|
% if data.get('poster_url'):
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -144,8 +144,8 @@ export_table_options = {
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
}
|
}
|
||||||
if ($('.export-processing').length && $("#tabs-export").hasClass("active")) {
|
if ($('.export-processing').length) {
|
||||||
timer = setTimeout(redrawExportTable.bind(null, false), 5000);
|
timer = setTimeout(redrawExportTable.bind(null, false), 2000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"preDrawCallback": function(settings) {
|
"preDrawCallback": function(settings) {
|
||||||
|
|
|
@ -313,7 +313,7 @@ DOCUMENTATION :: END
|
||||||
<div class='table-card-header'>
|
<div class='table-card-header'>
|
||||||
<div class="header-bar">
|
<div class="header-bar">
|
||||||
<span>
|
<span>
|
||||||
<i class="fa fa-file-export"></i> Exports for <strong>
|
<i class="fa fa-file-export"></i> Metadata Exports for <strong>
|
||||||
<span class="set-username">${data['section_name']}</span>
|
<span class="set-username">${data['section_name']}</span>
|
||||||
</strong>
|
</strong>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue