mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Fix manual refreshing the libraries/users list
This commit is contained in:
parent
dc4e6edc9a
commit
b4a4f60b04
3 changed files with 34 additions and 22 deletions
|
@ -180,18 +180,19 @@
|
|||
|
||||
% if _session['user_group'] == 'admin':
|
||||
$("#refresh-libraries-list").click(function () {
|
||||
showMsg('Refreshing libraries list...', true, false);
|
||||
$.ajax({
|
||||
url: 'refresh_libraries_list',
|
||||
cache: false,
|
||||
async: true,
|
||||
success: function (data) {
|
||||
showMsg('<i class="fa fa-refresh"></i> Libraries list refresh started...', false, true, 2000, false);
|
||||
},
|
||||
complete: function (data) {
|
||||
showMsg('<i class="fa fa-check"></i> Libraries list refreshed.', false, true, 2000, false);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
showMsg('<i class="fa fa-exclamation-circle"></i> Unable to refresh libraries list.', false, true, 2000, true);
|
||||
complete: function (xhr, status) {
|
||||
var result = $.parseJSON(xhr.responseText);
|
||||
var msg = result.message;
|
||||
if (result.result == 'success') {
|
||||
showMsg('<i class="fa fa-check"></i> ' + msg, false, true, 2000, false);
|
||||
} else {
|
||||
showMsg('<i class="fa fa-times"></i> ' + msg, false, true, 2000, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -184,18 +184,19 @@
|
|||
|
||||
% if _session['user_group'] == 'admin':
|
||||
$("#refresh-users-list").click(function() {
|
||||
showMsg('Refreshing users list...', true, false);
|
||||
$.ajax({
|
||||
url: 'refresh_users_list',
|
||||
cache: false,
|
||||
async: true,
|
||||
success: function(data) {
|
||||
showMsg('<i class="fa fa-check"></i> Users list refresh started...', false, true, 2000, false);
|
||||
},
|
||||
complete: function (data) {
|
||||
showMsg('<i class="fa fa-check"></i> Users list refreshed.', false, true, 2000, false);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
showMsg('<i class="fa fa-exclamation-circle"></i> Unable to refresh users list.', false, true, 2000, true);
|
||||
complete: function (xhr, status) {
|
||||
var result = $.parseJSON(xhr.responseText);
|
||||
var msg = result.message;
|
||||
if (result.result == 'success') {
|
||||
showMsg('<i class="fa fa-check"></i> ' + msg, false, true, 2000, false);
|
||||
} else {
|
||||
showMsg('<i class="fa fa-times"></i> ' + msg, false, true, 2000, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -458,12 +458,17 @@ class WebInterface(object):
|
|||
logger.warn(u"Unable to retrieve data for get_library_sections.")
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def refresh_libraries_list(self, **kwargs):
|
||||
""" Refresh the libraries list on it's own thread. """
|
||||
threading.Thread(target=libraries.refresh_libraries).start()
|
||||
""" Manually refresh the libraries list. """
|
||||
logger.info(u"Manual libraries list refresh requested.")
|
||||
return True
|
||||
result = libraries.refresh_libraries()
|
||||
|
||||
if result:
|
||||
return {'result': 'success', 'message': 'Libraries list refreshed.'}
|
||||
else:
|
||||
return {'result': 'error', 'message': 'Unable to refresh libraries list.'}
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
|
@ -1079,12 +1084,17 @@ class WebInterface(object):
|
|||
return user_list
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
def refresh_users_list(self, **kwargs):
|
||||
""" Refresh the users list on it's own thread. """
|
||||
threading.Thread(target=users.refresh_users).start()
|
||||
""" Manually refresh the users list. """
|
||||
logger.info(u"Manual users list refresh requested.")
|
||||
return True
|
||||
result = users.refresh_users()
|
||||
|
||||
if result:
|
||||
return {'result': 'success', 'message': 'Users list refreshed.'}
|
||||
else:
|
||||
return {'result': 'error', 'message': 'Unable to refresh users list.'}
|
||||
|
||||
@cherrypy.expose
|
||||
@requireAuth()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue