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