Clean up users page to match libraries page

This commit is contained in:
Jonathan Wong 2015-12-07 23:42:25 -08:00
parent a5b0837cf5
commit 979d68957e
2 changed files with 29 additions and 28 deletions

View file

@ -177,10 +177,13 @@
cache: false, cache: false,
async: true, async: true,
success: function(data) { success: function(data) {
showMsg('<i class="fa fa-check"></i>&nbspUser list refresh started...',false,true,2000,false) showMsg('<i class="fa fa-check"></i>&nbspUsers list refresh started...',false,true,2000,false)
},
complete: function (data) {
showMsg('<i class="fa fa-check"></i>&nbspUsers list refreshed.', false, true, 2000, false)
}, },
error: function (jqXHR, textStatus, errorThrown) { error: function (jqXHR, textStatus, errorThrown) {
showMsg('<i class="fa fa-exclamation-circle"></i>&nbspUnable to refresh user list.',false,true,2000,true) showMsg('<i class="fa fa-exclamation-circle"></i>&nbspUnable to refresh users list.',false,true,2000,true)
} }
}); });
}); });

View file

@ -26,8 +26,7 @@ class Users(object):
custom_where = ['users.deleted_user', 0] custom_where = ['users.deleted_user', 0]
columns = ['session_history.id', columns = ['users.user_id as user_id',
'users.user_id as user_id',
'users.custom_avatar_url as user_thumb', 'users.custom_avatar_url as user_thumb',
'(case when users.friendly_name is null then users.username else \ '(case when users.friendly_name is null then users.username else \
users.friendly_name end) as friendly_name', users.friendly_name end) as friendly_name',
@ -74,12 +73,12 @@ class Users(object):
rows = [] rows = []
for item in users: for item in users:
if item["media_type"] == 'episode' and item["parent_thumb"]: if item['media_type'] == 'episode' and item['parent_thumb']:
thumb = item["parent_thumb"] thumb = item['parent_thumb']
elif item["media_type"] == 'episode': elif item['media_type'] == 'episode':
thumb = item["grandparent_thumb"] thumb = item['grandparent_thumb']
else: else:
thumb = item["thumb"] thumb = item['thumb']
if not item['user_thumb'] or item['user_thumb'] == '': if not item['user_thumb'] or item['user_thumb'] == '':
user_thumb = common.DEFAULT_USER_THUMB user_thumb = common.DEFAULT_USER_THUMB
@ -87,25 +86,24 @@ class Users(object):
user_thumb = item['user_thumb'] user_thumb = item['user_thumb']
# Rename Mystery platform names # Rename Mystery platform names
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"]) platform = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
row = {"id": item['id'], row = {'plays': item['plays'],
"plays": item['plays'], 'last_seen': item['last_seen'],
"last_seen": item['last_seen'], 'friendly_name': item['friendly_name'],
"friendly_name": item['friendly_name'], 'ip_address': item['ip_address'],
"ip_address": item['ip_address'], 'platform': platform,
"platform": platform, 'player': item['player'],
"player": item["player"], 'last_watched': item['last_watched'],
"last_watched": item['last_watched'], 'thumb': thumb,
"thumb": thumb, 'media_type': item['media_type'],
"media_type": item['media_type'], 'rating_key': item['rating_key'],
"rating_key": item['rating_key'], 'video_decision': item['video_decision'],
"video_decision": item['video_decision'], 'user_thumb': user_thumb,
"user_thumb": user_thumb, 'user': item['user'],
"user": item["user"], 'user_id': item['user_id'],
"user_id": item['user_id'], 'do_notify': helpers.checked(item['do_notify']),
"do_notify": helpers.checked(item['do_notify']), 'keep_history': helpers.checked(item['keep_history'])
"keep_history": helpers.checked(item['keep_history'])
} }
rows.append(row) rows.append(row)