Need IP address modal on logs page

This commit is contained in:
JonnyWong16 2016-05-15 01:26:31 -07:00
parent f598d5046e
commit 663b9a610a
5 changed files with 23 additions and 21 deletions

View file

@ -1,4 +1,4 @@
login_table_options = {
login_log_table_options = {
"destroy": true,
"language": {
"search": "Search: ",
@ -101,9 +101,9 @@ login_table_options = {
}
}
$('.login_table').on('click', '> tbody > tr > td.modal-control-ip', function () {
$('.login_log_table').on('click', '> tbody > tr > td.modal-control-ip', function () {
var tr = $(this).closest('tr');
var row = login_table.row(tr);
var row = login_log_table.row(tr);
var rowData = row.data();
function getUserLocation(ip_address) {

View file

@ -176,7 +176,7 @@ DOCUMENTATION :: END
<div class='table-card-header'>
<div class="header-bar">
<span>
<i class="fa fa-history"></i> Play History for <strong>
<i class="fa fa-history"></i> History for <strong>
<span class="set-username">${data['section_name']}</span>
</strong>
</span>
@ -234,7 +234,7 @@ DOCUMENTATION :: END
<div class='table-card-header'>
<div class="header-bar">
<span>
<i class="fa fa-history"></i> All Media Info for <strong>
<i class="fa fa-history"></i> Media Info for <strong>
<span class="set-username">${data['section_name']}</span>
</strong>
</span>

View file

@ -91,7 +91,7 @@
</table>
</div>
<div role="tabpanel" class="tab-pane" id="tabs-5">
<table class="display" id="login_log_table" width="100%">
<table class="display login_log_table" id="login_log_table" width="100%">
<thead>
<tr>
<th align="left" id="timestamp">Timestamp</th>
@ -106,6 +106,8 @@
<tbody></tbody>
</table>
</div>
<div class="modal fade" id="ip-info-modal" tabindex="-1" role="dialog" aria-labelledby="ip-info-modal">
</div>
</div>
</div>
</div>
@ -133,7 +135,7 @@
<script src="${http_root}js/tables/logs.js"></script>
<script src="${http_root}js/tables/plex_logs.js"></script>
<script src="${http_root}js/tables/notification_logs.js"></script>
<script src="${http_root}js/tables/login_table.js"></script>
<script src="${http_root}js/tables/login_logs.js"></script>
<script>
$(document).ready(function() {
@ -175,8 +177,8 @@
}
function loadLoginLogs() {
login_table_options.pageLength = 50;
login_table_options.ajax = {
login_log_table_options.pageLength = 50;
login_log_table_options.ajax = {
url: "get_user_logins",
data: function (d) {
return {
@ -184,7 +186,7 @@
};
}
}
login_log_table = $('#login_log_table').DataTable(login_table_options);
login_log_table = $('#login_log_table').DataTable(login_log_table_options);
}
$("#plexpy-logs-btn").click(function () {

View file

@ -143,7 +143,7 @@ DOCUMENTATION :: END
<div class='table-card-header'>
<div class="header-bar">
<span>
<i class="fa fa-history"></i> Play History for <strong>
<i class="fa fa-history"></i> History for <strong>
<span class="set-username">${data['friendly_name']}</span>
</strong>
</span>
@ -287,7 +287,7 @@ DOCUMENTATION :: END
</div>
</div>
<div class="table-card-back">
<table class="display login_table" id="login_table-UID-${data['user_id']}" width="100%">
<table class="display login_log_table" id="login_log_table-UID-${data['user_id']}" width="100%">
<thead>
<tr>
<th align="left" id="timestamp">Timestamp</th>
@ -367,7 +367,7 @@ DOCUMENTATION :: END
<script src="${http_root}js/tables/history_table.js"></script>
<script src="${http_root}js/tables/user_ips.js"></script>
<script src="${http_root}js/tables/sync_table.js"></script>
<script src="${http_root}js/tables/login_table.js"></script>
<script src="${http_root}js/tables/login_logs.js"></script>
<script>
$(document).ready(function () {
@ -472,19 +472,19 @@ DOCUMENTATION :: END
$( "#login-tab-btn" ).one( "click", function() {
// Build user login table
login_table_options.ajax = {
login_log_table_options.ajax = {
url: 'get_user_logins',
data: function(d) {
d.user_id = user_id;
}
}
login_table = $('#login_table-UID-${data["user_id"]}').DataTable(login_table_options);
login_table.columns([1, 2]).visible(false);
login_log_table = $('#login_log_table-UID-${data["user_id"]}').DataTable(login_log_table_options);
login_log_table.columns([1, 2]).visible(false);
var colvis_login = new $.fn.dataTable.ColVis( login_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' } );
var colvis_login = new $.fn.dataTable.ColVis( login_log_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' } );
$( colvis_login.button() ).appendTo('#button-bar-login');
clearSearchButton('login_table-UID-${data["user_id"]}', login_table);
clearSearchButton('login_log_table-UID-${data["user_id"]}', login_log_table);
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {

View file

@ -2009,9 +2009,9 @@ class WebInterface(object):
with open(os.path.join(plexpy.CONFIG.LOG_DIR, logger.FILENAME)) as f:
for l in f.readlines():
try:
temp_loglevel_and_time = l.split('- ')
loglvl = temp_loglevel_and_time[1].split(' :')[0].strip()
msg = l.split(' : ')[1].replace('\n', '')
temp_loglevel_and_time = l.split(' - ', 1)
loglvl = temp_loglevel_and_time[1].split(' ::', 1)[0].strip()
msg = l.split(' : ', 1)[1].replace('\n', '')
fa([temp_loglevel_and_time[0], loglvl, msg])
except IndexError:
# Add traceback message to previous msg.