Fix homepage server status when sections are disabled

This commit is contained in:
JonnyWong16 2021-01-06 17:24:42 -08:00
parent 249533ac51
commit defceed696
No known key found for this signature in database
GPG key ID: B1F1F9807184697A

View file

@ -280,22 +280,32 @@
var error_msg = 'There was an error communicating with your Plex Server.' + msg_settings; var error_msg = 'There was an error communicating with your Plex Server.' + msg_settings;
% if 'current_activity' in config['home_sections'] or 'recently_added' in config['home_sections']:
var server_status; var server_status;
server_status = setInterval(function() { server_status = setInterval(function() {
$.getJSON('server_status', function (data) { $.getJSON('server_status', function (data) {
if (data.connected === true) { if (data.connected === true) {
clearInterval(server_status); clearInterval(server_status);
% if 'current_activity' in config['home_sections']:
$('#currentActivity').html('<div id="dashboard-checking-activity" class="text-muted"><i class="fa fa-refresh fa-spin"></i>&nbsp; Checking for activity...</div>'); $('#currentActivity').html('<div id="dashboard-checking-activity" class="text-muted"><i class="fa fa-refresh fa-spin"></i>&nbsp; Checking for activity...</div>');
$('#recentlyAdded').html('<div id="dashboard-checking-recently-added" class="text-muted"><i class="fa fa-refresh fa-spin"></i>&nbsp; Looking for new items...</div>');
activityConnected(); activityConnected();
% endif
% if 'recently_added' in config['home_sections']:
$('#recentlyAdded').html('<div id="dashboard-checking-recently-added" class="text-muted"><i class="fa fa-refresh fa-spin"></i>&nbsp; Looking for new items...</div>');
recentlyAddedConnected(); recentlyAddedConnected();
% endif
} else if (data.connected === false) { } else if (data.connected === false) {
clearInterval(server_status); clearInterval(server_status);
% if 'current_activity' in config['home_sections']:
$('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">' + error_msg + '</div>'); $('#currentActivity').html('<div id="dashboard-no-activity" class="text-muted">' + error_msg + '</div>');
% endif
% if 'recently_added' in config['home_sections']:
$('#recentlyAdded').html('<div id="dashboard-no-recently-added" class="text-muted">' + error_msg + '</div>'); $('#recentlyAdded').html('<div id="dashboard-no-recently-added" class="text-muted">' + error_msg + '</div>');
% endif
} }
}); });
}, 1000); }, 1000);
% endif
</script> </script>
% if 'current_activity' in config['home_sections']: % if 'current_activity' in config['home_sections']:
<script> <script>