From 6cd6b1b630f7f38b1b683e2b8ffae1d9593ed21e Mon Sep 17 00:00:00 2001 From: BenDroid Date: Thu, 16 Nov 2017 20:39:29 +0100 Subject: [PATCH] Fixed sorting by "client id" and "last status" --- index.html | 64 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index d272ce67..e4c09bf2 100644 --- a/index.html +++ b/index.html @@ -16,7 +16,7 @@ .offline { color: red} - + @@ -221,39 +221,47 @@ $(document).ready(function() { }); function laststatus( data, type, row ) { - var date = new Date(data*1000); + if (type !== 'sort') { + var date = new Date(data*1000); - return '' + jQuery.timeago(date) + ''; + return '' + jQuery.timeago(date) + ''; + } + + return data; } function clientInfo( data, type, row ) { - var tooltip = "CPU: " + row.client_status.cpu_brand + " [" + row.client_status.cpu_cores + " cores]"; - tooltip += '\n'; - tooltip += "CPU Flags: " + (row.client_status.cpu_has_aes ? "AES-NI " : ""); - tooltip += (row.client_status.cpu_is_x64 ? "x64" : ""); - tooltip += '\n'; - tooltip += "CPU Cache L2/L3: " + (row.client_status.cpu_l2 / 1024) + " MB/"+ (row.client_status.cpu_l3 / 1024) + " MB"; - tooltip += '\n'; - tooltip += "Huge Pages: " + (row.client_status.hugepages_available ? " available, " : " unavailable, "); - tooltip += (row.client_status.hugepages_enabled ? "enabled" : "disabled"); - tooltip += '\n'; - tooltip += "Used Threads: " + row.client_status.current_threads; - tooltip += (row.client_status.double_hash_mode ? " [double hash mode]" :""); - tooltip += '\n'; - tooltip += "Client IP: " + row.client_status.external_ip; - tooltip += '\n'; - tooltip += "Status: "; + if (type !== 'sort') { + var tooltip = "CPU: " + row.client_status.cpu_brand + " [" + row.client_status.cpu_cores + " cores]"; + tooltip += '\n'; + tooltip += "CPU Flags: " + (row.client_status.cpu_has_aes ? "AES-NI " : ""); + tooltip += (row.client_status.cpu_is_x64 ? "x64" : ""); + tooltip += '\n'; + tooltip += "CPU Cache L2/L3: " + (row.client_status.cpu_l2 / 1024) + " MB/"+ (row.client_status.cpu_l3 / 1024) + " MB"; + tooltip += '\n'; + tooltip += "Huge Pages: " + (row.client_status.hugepages_available ? " available, " : " unavailable, "); + tooltip += (row.client_status.hugepages_enabled ? "enabled" : "disabled"); + tooltip += '\n'; + tooltip += "Used Threads: " + row.client_status.current_threads; + tooltip += (row.client_status.double_hash_mode ? " [double hash mode]" :""); + tooltip += '\n'; + tooltip += "Client IP: " + row.client_status.external_ip; + tooltip += '\n'; + tooltip += "Status: "; - var lastStatus = row.client_status.last_status_update * 1000; - var threshold = new Date().getTime() - 60 * 1000; - if (lastStatus > threshold) { - tooltip += "Online"; - return '
' + data + '
'; - } - else { - tooltip += "Offline"; - return '
' + data + '
'; + var lastStatus = row.client_status.last_status_update * 1000; + var threshold = new Date().getTime() - 60 * 1000; + if (lastStatus > threshold) { + tooltip += "Online"; + return '
' + data + '
'; + } + else { + tooltip += "Offline"; + return '
' + data + '
'; + } } + + return data; } function round( data, type, row ) {