mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 05:31:15 -07:00
Rename row_id to exporr_id
This commit is contained in:
parent
40fbc55ab3
commit
e82ad09a8d
3 changed files with 22 additions and 20 deletions
|
@ -102,13 +102,13 @@ export_table_options = {
|
||||||
"data": "complete",
|
"data": "complete",
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (cellData === 1 && rowData['exists']) {
|
if (cellData === 1 && rowData['exists']) {
|
||||||
$(td).html('<button class="btn btn-xs btn-success pull-left" data-id="' + rowData['row_id'] + '"><i class="fa fa-file-download fa-fw"></i> Download</button>');
|
$(td).html('<button class="btn btn-xs btn-success pull-left" data-id="' + rowData['export_id'] + '"><i class="fa fa-file-download fa-fw"></i> Download</button>');
|
||||||
} else if (cellData === 0) {
|
} else if (cellData === 0) {
|
||||||
$(td).html('<span class="btn btn-xs btn-dark pull-left export-processing" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-spinner fa-spin fa-fw"></i> Processing</span>');
|
$(td).html('<span class="btn btn-xs btn-dark pull-left export-processing" data-id="' + rowData['export_id'] + '" disabled><i class="fa fa-spinner fa-spin fa-fw"></i> Processing</span>');
|
||||||
} else if (cellData === -1) {
|
} else if (cellData === -1) {
|
||||||
$(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-exclamation-circle fa-fw"></i> Failed</span>');
|
$(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['export_id'] + '" disabled><i class="fa fa-exclamation-circle fa-fw"></i> Failed</span>');
|
||||||
} else {
|
} else {
|
||||||
$(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-question-circle fa-fw"></i> Not Found</span>');
|
$(td).html('<span class="btn btn-xs btn-dark pull-left" data-id="' + rowData['export_id'] + '" disabled><i class="fa fa-question-circle fa-fw"></i> Not Found</span>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "7%",
|
"width": "7%",
|
||||||
|
@ -119,9 +119,9 @@ export_table_options = {
|
||||||
"data": null,
|
"data": null,
|
||||||
"createdCell": function (td, cellData, rowData, row, col) {
|
"createdCell": function (td, cellData, rowData, row, col) {
|
||||||
if (rowData['complete'] !== 0) {
|
if (rowData['complete'] !== 0) {
|
||||||
$(td).html('<button class="btn btn-xs btn-danger pull-left" data-id="' + rowData['row_id'] + '"><i class="fa fa-trash-o fa-fw"></i> Delete</button>');
|
$(td).html('<button class="btn btn-xs btn-danger pull-left" data-id="' + rowData['export_id'] + '"><i class="fa fa-trash-o fa-fw"></i> Delete</button>');
|
||||||
} else {
|
} else {
|
||||||
$(td).html('<span class="btn btn-xs btn-danger pull-left" data-id="' + rowData['row_id'] + '" disabled><i class="fa fa-trash-o fa-fw"></i> Delete</span>');
|
$(td).html('<span class="btn btn-xs btn-danger pull-left" data-id="' + rowData['export_id'] + '" disabled><i class="fa fa-trash-o fa-fw"></i> Delete</span>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "7%",
|
"width": "7%",
|
||||||
|
@ -157,7 +157,7 @@ $('.export_table').on('click', '> tbody > tr > td.export_download > button', fun
|
||||||
var rowData = row.data();
|
var rowData = row.data();
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.location.href = 'download_export?row_id=' + rowData['row_id'];
|
window.location.href = 'download_export?export_id=' + rowData['export_id'];
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.export_table').on('click', '> tbody > tr > td.export_delete > button', function (e) {
|
$('.export_table').on('click', '> tbody > tr > td.export_delete > button', function (e) {
|
||||||
|
@ -166,7 +166,7 @@ $('.export_table').on('click', '> tbody > tr > td.export_delete > button', funct
|
||||||
var rowData = row.data();
|
var rowData = row.data();
|
||||||
|
|
||||||
var msg = 'Are you sure you want to delete the following export?<br /><br /><strong>' + rowData['filename'] + '</strong>';
|
var msg = 'Are you sure you want to delete the following export?<br /><br /><strong>' + rowData['filename'] + '</strong>';
|
||||||
var url = 'delete_export?row_id=' + rowData['row_id'];
|
var url = 'delete_export?export_id=' + rowData['export_id'];
|
||||||
confirmAjaxCall(url, msg, null, null, redrawExportTable);
|
confirmAjaxCall(url, msg, null, null, redrawExportTable);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1031,12 +1031,12 @@ def delete_export(export_id):
|
||||||
if str(export_id).isdigit():
|
if str(export_id).isdigit():
|
||||||
export_data = get_export(export_id=export_id)
|
export_data = get_export(export_id=export_id)
|
||||||
|
|
||||||
logger.debug("Tautulli Exporter :: Deleting export_id %s from the database.", export_id)
|
logger.info("Tautulli Exporter :: Deleting export_id %s from the database.", export_id)
|
||||||
result = db.action('DELETE FROM exports WHERE id = ?', args=[export_id])
|
result = db.action('DELETE FROM exports WHERE id = ?', args=[export_id])
|
||||||
|
|
||||||
if export_data and export_data['exists']:
|
if export_data and export_data['exists']:
|
||||||
filepath = get_export_filepath(export_data['filename'])
|
filepath = get_export_filepath(export_data['filename'])
|
||||||
logger.debug("Tautulli Exporter :: Deleting exported file from '%s'.", filepath)
|
logger.info("Tautulli Exporter :: Deleting exported file from '%s'.", filepath)
|
||||||
try:
|
try:
|
||||||
os.remove(filepath)
|
os.remove(filepath)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
|
@ -1050,6 +1050,8 @@ def delete_all_exports():
|
||||||
db = database.MonitorDatabase()
|
db = database.MonitorDatabase()
|
||||||
result = db.select('SELECT filename FROM exports')
|
result = db.select('SELECT filename FROM exports')
|
||||||
|
|
||||||
|
logger.info("Tautulli Exporter :: Deleting all exports from the database.")
|
||||||
|
|
||||||
deleted_files = True
|
deleted_files = True
|
||||||
for row in result:
|
for row in result:
|
||||||
if check_export_exists(row['filename']):
|
if check_export_exists(row['filename']):
|
||||||
|
@ -1081,7 +1083,7 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
|
||||||
if rating_key:
|
if rating_key:
|
||||||
custom_where.append(['exports.rating_key', rating_key])
|
custom_where.append(['exports.rating_key', rating_key])
|
||||||
|
|
||||||
columns = ['exports.id AS row_id',
|
columns = ['exports.id AS export_id',
|
||||||
'exports.timestamp',
|
'exports.timestamp',
|
||||||
'exports.section_id',
|
'exports.section_id',
|
||||||
'exports.rating_key',
|
'exports.rating_key',
|
||||||
|
@ -1111,7 +1113,7 @@ def get_export_datatable(section_id=None, rating_key=None, kwargs=None):
|
||||||
media_type_title = item['media_type'].title()
|
media_type_title = item['media_type'].title()
|
||||||
exists = helpers.cast_to_int(check_export_exists(item['filename']))
|
exists = helpers.cast_to_int(check_export_exists(item['filename']))
|
||||||
|
|
||||||
row = {'row_id': item['row_id'],
|
row = {'export_id': item['export_id'],
|
||||||
'timestamp': item['timestamp'],
|
'timestamp': item['timestamp'],
|
||||||
'section_id': item['section_id'],
|
'section_id': item['section_id'],
|
||||||
'rating_key': item['rating_key'],
|
'rating_key': item['rating_key'],
|
||||||
|
|
|
@ -6517,12 +6517,12 @@ class WebInterface(object):
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def download_export(self, row_id=None, **kwargs):
|
def download_export(self, export_id=None, **kwargs):
|
||||||
""" Download an exported metadata file
|
""" Download an exported metadata file
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
row_id (int): The row id of the exported file to download
|
export_id (int): The row id of the exported file to download
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
None
|
None
|
||||||
|
@ -6531,7 +6531,7 @@ class WebInterface(object):
|
||||||
download
|
download
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
result = exporter.get_export(export_id=row_id)
|
result = exporter.get_export(export_id=export_id)
|
||||||
|
|
||||||
if result and result['complete'] == 1 and result['exists']:
|
if result and result['complete'] == 1 and result['exists']:
|
||||||
return serve_download(exporter.get_export_filepath(result['filename']), name=result['filename'])
|
return serve_download(exporter.get_export_filepath(result['filename']), name=result['filename'])
|
||||||
|
@ -6543,7 +6543,7 @@ class WebInterface(object):
|
||||||
elif result and not result.get('exists'):
|
elif result and not result.get('exists'):
|
||||||
msg = 'Export file does not exist.'
|
msg = 'Export file does not exist.'
|
||||||
else:
|
else:
|
||||||
msg = 'Invalid row_id provided.'
|
msg = 'Invalid export_id provided.'
|
||||||
cherrypy.response.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
cherrypy.response.headers['Content-Type'] = 'application/json;charset=UTF-8'
|
||||||
return json.dumps({'result': 'error', 'message': msg}).encode('utf-8')
|
return json.dumps({'result': 'error', 'message': msg}).encode('utf-8')
|
||||||
|
|
||||||
|
@ -6551,15 +6551,15 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def delete_export(self, row_id=None, delete_all=False, **kwargs):
|
def delete_export(self, export_id=None, delete_all=False, **kwargs):
|
||||||
""" Delete exports from Tautulli.
|
""" Delete exports from Tautulli.
|
||||||
|
|
||||||
```
|
```
|
||||||
Required parameters:
|
Required parameters:
|
||||||
row_id (int): The row id of the exported file to delete
|
export_id (int): The row id of the exported file to delete
|
||||||
|
|
||||||
Optional parameters:
|
Optional parameters:
|
||||||
delete_all (bool): 'true' to delete all exported files
|
delete_all (bool): 'true' to delete all exported files
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
None
|
None
|
||||||
|
@ -6573,7 +6573,7 @@ class WebInterface(object):
|
||||||
return {'result': 'error', 'message': 'Failed to delete all exports.'}
|
return {'result': 'error', 'message': 'Failed to delete all exports.'}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
result = exporter.delete_export(export_id=row_id)
|
result = exporter.delete_export(export_id=export_id)
|
||||||
if result:
|
if result:
|
||||||
return {'result': 'success', 'message': 'Export deleted successfully.'}
|
return {'result': 'success', 'message': 'Export deleted successfully.'}
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue