Add IP address to current activity
This commit is contained in:
@@ -688,6 +688,14 @@ a:hover .dashboard-activity-poster {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
}
|
}
|
||||||
|
.dashboard-activity-poster-info-ip-address {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 5px;
|
||||||
|
left: 10px;
|
||||||
|
text-align: left;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
.dashboard-activity-poster-info-time {
|
.dashboard-activity-poster-info-time {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 5px;
|
bottom: 5px;
|
||||||
|
@@ -191,6 +191,9 @@ DOCUMENTATION :: END
|
|||||||
</div>
|
</div>
|
||||||
% if a['media_type'] != 'photo':
|
% if a['media_type'] != 'photo':
|
||||||
<div class="dashboard-activity-poster-info-bar">
|
<div class="dashboard-activity-poster-info-bar">
|
||||||
|
<div class="dashboard-activity-poster-info-ip-address">
|
||||||
|
<span>IP: ${a['ip_address']}</span>
|
||||||
|
</div>
|
||||||
<div class="dashboard-activity-poster-info-time">
|
<div class="dashboard-activity-poster-info-time">
|
||||||
<span class="progress_time">${a['view_offset']}</span>/<span class="progress_time">${a['duration']}</span>
|
<span class="progress_time">${a['view_offset']}</span>/<span class="progress_time">${a['duration']}</span>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -999,3 +999,20 @@ class DataFactory(object):
|
|||||||
return 'No updated rating key needed in database. No changes were made.'
|
return 'No updated rating key needed in database. No changes were made.'
|
||||||
# for debugging
|
# for debugging
|
||||||
#return mapping
|
#return mapping
|
||||||
|
|
||||||
|
def get_session_ip(self, session_key=''):
|
||||||
|
monitor_db = database.MonitorDatabase()
|
||||||
|
|
||||||
|
if session_key:
|
||||||
|
query = 'SELECT CASE WHEN ip_address IS NULL THEN "N/A" ELSE ip_address END ' \
|
||||||
|
'FROM sessions WHERE session_key = %d' % int(session_key)
|
||||||
|
result = monitor_db.select(query)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
ip_address = 'N/A'
|
||||||
|
|
||||||
|
for item in result:
|
||||||
|
ip_address = item[0]
|
||||||
|
|
||||||
|
return ip_address
|
||||||
|
@@ -715,6 +715,11 @@ class WebInterface(object):
|
|||||||
return serve_template(templatename="current_activity.html", data=None)
|
return serve_template(templatename="current_activity.html", data=None)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
data_factory = datafactory.DataFactory()
|
||||||
|
for session in result['sessions']:
|
||||||
|
ip_address = data_factory.get_session_ip(session['session_key'])
|
||||||
|
session['ip_address'] = ip_address
|
||||||
|
|
||||||
return serve_template(templatename="current_activity.html", data=result)
|
return serve_template(templatename="current_activity.html", data=result)
|
||||||
else:
|
else:
|
||||||
logger.warn('Unable to retrieve data.')
|
logger.warn('Unable to retrieve data.')
|
||||||
|
Reference in New Issue
Block a user