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, "destroy": true,
"language": { "language": {
"search": "Search: ", "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 tr = $(this).closest('tr');
var row = login_table.row(tr); var row = login_log_table.row(tr);
var rowData = row.data(); var rowData = row.data();
function getUserLocation(ip_address) { function getUserLocation(ip_address) {

View file

@ -176,7 +176,7 @@ DOCUMENTATION :: END
<div class='table-card-header'> <div class='table-card-header'>
<div class="header-bar"> <div class="header-bar">
<span> <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> <span class="set-username">${data['section_name']}</span>
</strong> </strong>
</span> </span>
@ -234,7 +234,7 @@ DOCUMENTATION :: END
<div class='table-card-header'> <div class='table-card-header'>
<div class="header-bar"> <div class="header-bar">
<span> <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> <span class="set-username">${data['section_name']}</span>
</strong> </strong>
</span> </span>

View file

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

View file

@ -143,7 +143,7 @@ DOCUMENTATION :: END
<div class='table-card-header'> <div class='table-card-header'>
<div class="header-bar"> <div class="header-bar">
<span> <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> <span class="set-username">${data['friendly_name']}</span>
</strong> </strong>
</span> </span>
@ -287,7 +287,7 @@ DOCUMENTATION :: END
</div> </div>
</div> </div>
<div class="table-card-back"> <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> <thead>
<tr> <tr>
<th align="left" id="timestamp">Timestamp</th> <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/history_table.js"></script>
<script src="${http_root}js/tables/user_ips.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/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> <script>
$(document).ready(function () { $(document).ready(function () {
@ -472,19 +472,19 @@ DOCUMENTATION :: END
$( "#login-tab-btn" ).one( "click", function() { $( "#login-tab-btn" ).one( "click", function() {
// Build user login table // Build user login table
login_table_options.ajax = { login_log_table_options.ajax = {
url: 'get_user_logins', url: 'get_user_logins',
data: function(d) { data: function(d) {
d.user_id = user_id; d.user_id = user_id;
} }
} }
login_table = $('#login_table-UID-${data["user_id"]}').DataTable(login_table_options); login_log_table = $('#login_log_table-UID-${data["user_id"]}').DataTable(login_log_table_options);
login_table.columns([1, 2]).visible(false); 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'); $( 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) { $('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: with open(os.path.join(plexpy.CONFIG.LOG_DIR, logger.FILENAME)) as f:
for l in f.readlines(): for l in f.readlines():
try: try:
temp_loglevel_and_time = l.split('- ') temp_loglevel_and_time = l.split(' - ', 1)
loglvl = temp_loglevel_and_time[1].split(' :')[0].strip() loglvl = temp_loglevel_and_time[1].split(' ::', 1)[0].strip()
msg = l.split(' : ')[1].replace('\n', '') msg = l.split(' : ', 1)[1].replace('\n', '')
fa([temp_loglevel_and_time[0], loglvl, msg]) fa([temp_loglevel_and_time[0], loglvl, msg])
except IndexError: except IndexError:
# Add traceback message to previous msg. # Add traceback message to previous msg.