Show library active status on Libraries table

This commit is contained in:
JonnyWong16 2020-04-10 00:17:52 -07:00
parent 198e7767dc
commit 23de9616f1
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
4 changed files with 35 additions and 15 deletions

View file

@ -41,14 +41,16 @@ libraries_list_table_options = {
"targets": [1], "targets": [1],
"data": "library_thumb", "data": "library_thumb",
"createdCell": function (td, cellData, rowData, row, col) { "createdCell": function (td, cellData, rowData, row, col) {
var inactive = '';
if (!rowData['is_active']) { inactive = '<span class="inactive-library-tooltip" data-toggle="tooltip" title="Library not on Plex server"><i class="fa fa-exclamation-triangle"></i></span>'; }
if (cellData !== null && cellData !== '') { if (cellData !== null && cellData !== '') {
if (rowData['library_thumb'].substring(0, 4) == "http") { if (rowData['library_thumb'].substring(0, 4) == "http") {
$(td).html('<a href="library?section_id=' + rowData['section_id'] + '"><div class="libraries-poster-face" style="background-image: url(' + rowData['library_thumb'] + ');"></div></a>'); $(td).html('<a href="library?section_id=' + rowData['section_id'] + '"><div class="libraries-poster-face" style="background-image: url(' + rowData['library_thumb'] + ');">' + inactive + '</div></a>');
} else { } else {
$(td).html('<a href="library?section_id=' + rowData['section_id'] + '"><div class="libraries-poster-face svg-icon library-' + rowData['section_type'] + '"></div></a>'); $(td).html('<a href="library?section_id=' + rowData['section_id'] + '"><div class="libraries-poster-face svg-icon library-' + rowData['section_type'] + '">' + inactive + '</div></a>');
} }
} else { } else {
$(td).html('<a href="library?section_id=' + rowData['section_id'] + '"><div class="libraries-poster-face" style="background-image: url(../../images/cover.png);"></div></a>'); $(td).html('<a href="library?section_id=' + rowData['section_id'] + '"><div class="libraries-poster-face" style="background-image: url(../../images/cover.png);">' + inactive + '</div></a>');
} }
}, },
"orderable": false, "orderable": false,

View file

@ -62,9 +62,21 @@ DOCUMENTATION :: END
<div class="table-card-back"> <div class="table-card-back">
<div class="user-info-wrapper"> <div class="user-info-wrapper">
% if data['library_thumb'].startswith('http'): % if data['library_thumb'].startswith('http'):
<div class="library-info-poster-face" style="background-image: url(${page('pms_image_proxy', data['library_thumb'], None, 80, 80)});"></div> <div class="library-info-poster-face" style="background-image: url(${page('pms_image_proxy', data['library_thumb'], None, 80, 80)});">
% if not data['is_active']:
<span class="inactive-library-tooltip" data-toggle="tooltip" title="Library not on Plex server">
<i class="fa fa-lg fa-exclamation-triangle"></i>
</span>
% endif
</div>
% else: % else:
<div class="library-info-poster-face svg-icon library-${data['section_type']}"></div> <div class="library-info-poster-face svg-icon library-${data['section_type']}">
% if not data['is_active']:
<span class="inactive-library-tooltip" data-toggle="tooltip" title="Library not on Plex server">
<i class="fa fa-lg fa-exclamation-triangle"></i>
</span>
% endif
</div>
% endif % endif
<div class="user-info-username"> <div class="user-info-username">
<span class="set-username">${data['section_name']}</span> <span class="set-username">${data['section_name']}</span>
@ -411,6 +423,8 @@ DOCUMENTATION :: END
history_table.draw(); history_table.draw();
}); });
$(".inactive-library-tooltip").tooltip();
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':
function loadMediaInfoTable() { function loadMediaInfoTable() {
// Build media info table // Build media info table

View file

@ -51,13 +51,13 @@ DOCUMENTATION :: END
<div class="col-md-12"> <div class="col-md-12">
<div class="table-card-back"> <div class="table-card-back">
<div class="user-info-wrapper"> <div class="user-info-wrapper">
<div class="user-info-poster-face" style="background-image: url(${data['user_thumb']});"> <div class="user-info-poster-face" style="background-image: url(${data['user_thumb']});">
% if not data['is_active']: % if not data['is_active']:
<span class="inactive-user-tooltip" data-toggle="tooltip" title="User not on Plex server"> <span class="inactive-user-tooltip" data-toggle="tooltip" title="User not on Plex server">
<i class="fa fa-lg fa-exclamation-triangle"></i> <i class="fa fa-lg fa-exclamation-triangle"></i>
</span> </span>
% endif % endif
</div> </div>
<div class="user-info-username"> <div class="user-info-username">
<span class="set-username">${data['friendly_name']}</span> <span class="set-username">${data['friendly_name']}</span>
% if _session['user_group'] == 'admin': % if _session['user_group'] == 'admin':

View file

@ -331,7 +331,8 @@ class Libraries(object):
'session_history_metadata.guid', 'session_history_metadata.guid',
'library_sections.do_notify', 'library_sections.do_notify',
'library_sections.do_notify_created', 'library_sections.do_notify_created',
'library_sections.keep_history' 'library_sections.keep_history',
'library_sections.is_active'
] ]
try: try:
query = data_tables.ssp_query(table_name='library_sections', query = data_tables.ssp_query(table_name='library_sections',
@ -397,7 +398,8 @@ class Libraries(object):
'guid': item['guid'], 'guid': item['guid'],
'do_notify': helpers.checked(item['do_notify']), 'do_notify': helpers.checked(item['do_notify']),
'do_notify_created': helpers.checked(item['do_notify_created']), 'do_notify_created': helpers.checked(item['do_notify_created']),
'keep_history': helpers.checked(item['keep_history']) 'keep_history': helpers.checked(item['keep_history']),
'is_active': item['is_active']
} }
rows.append(row) rows.append(row)
@ -742,6 +744,7 @@ class Libraries(object):
'count': 0, 'count': 0,
'parent_count': 0, 'parent_count': 0,
'child_count': 0, 'child_count': 0,
'is_active': 1,
'do_notify': 0, 'do_notify': 0,
'do_notify_created': 0, 'do_notify_created': 0,
'keep_history': 1, 'keep_history': 1,
@ -758,7 +761,7 @@ class Libraries(object):
if str(section_id).isdigit(): if str(section_id).isdigit():
query = 'SELECT section_id, section_name, section_type, count, parent_count, child_count, ' \ query = 'SELECT section_id, section_name, section_type, count, parent_count, child_count, ' \
'thumb AS library_thumb, custom_thumb_url AS custom_thumb, art AS library_art, ' \ 'thumb AS library_thumb, custom_thumb_url AS custom_thumb, art AS library_art, ' \
'custom_art_url AS custom_art, ' \ 'custom_art_url AS custom_art, is_active, ' \
'do_notify, do_notify_created, keep_history, deleted_section ' \ 'do_notify, do_notify_created, keep_history, deleted_section ' \
'FROM library_sections ' \ 'FROM library_sections ' \
'WHERE section_id = ? ' 'WHERE section_id = ? '
@ -792,6 +795,7 @@ class Libraries(object):
'count': item['count'], 'count': item['count'],
'parent_count': item['parent_count'], 'parent_count': item['parent_count'],
'child_count': item['child_count'], 'child_count': item['child_count'],
'is_active': item['is_active'],
'do_notify': item['do_notify'], 'do_notify': item['do_notify'],
'do_notify_created': item['do_notify_created'], 'do_notify_created': item['do_notify_created'],
'keep_history': item['keep_history'], 'keep_history': item['keep_history'],