mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Show all users in Users table even if they don't have any history.
This commit is contained in:
parent
e8e5a0b5ff
commit
ad12a85c6c
3 changed files with 29 additions and 20 deletions
|
@ -27,6 +27,7 @@ users_list_table_options = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"orderable": false,
|
"orderable": false,
|
||||||
|
"searchable": false,
|
||||||
"className": "users-poster-face",
|
"className": "users-poster-face",
|
||||||
"width": "40px"
|
"width": "40px"
|
||||||
},
|
},
|
||||||
|
@ -47,21 +48,33 @@ users_list_table_options = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [2],
|
"targets": [2],
|
||||||
"data": "started",
|
"data": "last_seen",
|
||||||
"render": function ( data, type, full ) {
|
"render": function ( data, type, full ) {
|
||||||
|
if (data) {
|
||||||
return moment(data, "X").fromNow();
|
return moment(data, "X").fromNow();
|
||||||
|
} else {
|
||||||
|
return "never";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
"searchable": false,
|
||||||
"className": "hidden-xs",
|
"className": "hidden-xs",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [3],
|
"targets": [3],
|
||||||
"data": "ip_address",
|
"data": "ip_address",
|
||||||
"searchable": false,
|
"render": function ( data, type, full ) {
|
||||||
|
if (data) {
|
||||||
|
return data;
|
||||||
|
} else {
|
||||||
|
return "n/a";
|
||||||
|
}
|
||||||
|
},
|
||||||
"className": "hidden-xs",
|
"className": "hidden-xs",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [4],
|
"targets": [4],
|
||||||
"data": "plays"
|
"data": "plays",
|
||||||
|
"searchable": false
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<div class='container-fluid'>
|
<div class='container-fluid'>
|
||||||
<div class='table-card-header'>
|
<div class='table-card-header'>
|
||||||
<div class="header-bar">
|
<div class="header-bar">
|
||||||
<span><i class="fa fa-group"></i> Active Users</span>
|
<span><i class="fa fa-group"></i> All Users</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-bar">
|
<div class="button-bar">
|
||||||
<button class="btn btn-dark" id="refresh-users-list"><i class="fa fa-refresh"></i> Refresh users</button>
|
<button class="btn btn-dark" id="refresh-users-list"><i class="fa fa-refresh"></i> Refresh users</button>
|
||||||
|
|
|
@ -29,26 +29,23 @@ class DataFactory(object):
|
||||||
def get_user_list(self, kwargs=None):
|
def get_user_list(self, kwargs=None):
|
||||||
data_tables = datatables.DataTables()
|
data_tables = datatables.DataTables()
|
||||||
|
|
||||||
columns = ['session_history.id',
|
columns = ['users.user_id as user_id',
|
||||||
'users.thumb as thumb',
|
'users.thumb as thumb',
|
||||||
'(case when users.friendly_name is null then session_history.user 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',
|
||||||
'session_history.started',
|
'MAX(session_history.started) as last_seen',
|
||||||
'session_history.ip_address',
|
'session_history.ip_address as ip_address',
|
||||||
'COUNT(session_history.id) as plays',
|
'COUNT(session_history.id) as plays',
|
||||||
'session_history.user',
|
'users.username as user'
|
||||||
'session_history.user_id',
|
|
||||||
'(case when typeof(session_history.user_id) = "integer" \
|
|
||||||
then session_history.user_id else -1 end) as grp_id',
|
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
query = data_tables.ssp_query(table_name='session_history',
|
query = data_tables.ssp_query(table_name='users',
|
||||||
columns=columns,
|
columns=columns,
|
||||||
custom_where=[],
|
custom_where=[],
|
||||||
group_by=['grp_id'],
|
group_by=['users.user_id'],
|
||||||
join_types=['LEFT OUTER JOIN'],
|
join_types=['LEFT OUTER JOIN'],
|
||||||
join_tables=['users'],
|
join_tables=['session_history'],
|
||||||
join_evals=[['grp_id', 'users.user_id']],
|
join_evals=[['session_history.user_id', 'users.user_id']],
|
||||||
kwargs=kwargs)
|
kwargs=kwargs)
|
||||||
except:
|
except:
|
||||||
logger.warn("Unable to execute database query.")
|
logger.warn("Unable to execute database query.")
|
||||||
|
@ -67,9 +64,8 @@ class DataFactory(object):
|
||||||
else:
|
else:
|
||||||
user_thumb = item['thumb']
|
user_thumb = item['thumb']
|
||||||
|
|
||||||
row = {"id": item['id'],
|
row = {"plays": item['plays'],
|
||||||
"plays": item['plays'],
|
"last_seen": item['last_seen'],
|
||||||
"started": item['started'],
|
|
||||||
"friendly_name": item["friendly_name"],
|
"friendly_name": item["friendly_name"],
|
||||||
"ip_address": item["ip_address"],
|
"ip_address": item["ip_address"],
|
||||||
"thumb": user_thumb,
|
"thumb": user_thumb,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue