Added last seen column

Noah Zalev committed Jul 25, 2021 at 01:23 UTC c4f8426da35ef3c0d061277abe9fd7c3cf595805
1 file changed +4
views/default.handlebars
+4
@@ -3555,6 +3555,7 @@
3555 x += '<label><input id=d2c2 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('user') >= 0)?' checked':'') + '>' + "Logged in users" + '</label><br />';
3556 x += '<label><input id=d2c3 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('ip') >= 0)?' checked':'') + '>' + "Agent IP address" + '</label><br />';
3557 x += '<label><input id=d2c4 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('conn') >= 0)?' checked':'') + '>' + "Server Connectivity" + '</label><br />';
3558 + x += '<label><input id=d2c7 type=checkbox' + ((deviceViewSettings.devsCols.indexOf('lastseen') >= 0)?' checked':'') + '>' + "Last Seen" + '</label><br />';
3559 setDialogMode(2, "Device View Columns", 3, onDeviceViewSettingsEx, x);
3560 }
3561
@@ -3566,6 +3567,7 @@
3567 if (Q('d2c4').checked) { cols.push('conn'); }
3568 if (Q('d2c5').checked) { cols.push('os'); }
3569 if (Q('d2c6').checked) { cols.push('desc'); }
3570 + if (Q('d2c7').checked) { cols.push('lastseen'); }
3571 deviceViewSettings.devsCols = cols;
3572 putstore('_deviceViewSettings', JSON.stringify(deviceViewSettings));
3573 mainUpdate(4);
@@ -3981,6 +3983,7 @@
3983 if (deviceViewSettings.devsCols.indexOf('user') >= 0) { colums += '<th style=color:gray;width:120px>' + "User"; }
3984 if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { colums += '<th style=color:gray;width:120px>' + "Address"; }
3985 if (deviceViewSettings.devsCols.indexOf('conn') >= 0) { colums += '<th style=color:gray;width:100px>' + "Connectivity"; }
3986 + if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) { colums += '<th style=color:gray;width:120px>' + "Last Seen"; }
3987
3988 // This height of 1 div at the end to fix a problem in Linux firefox browsers
3989 r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray>' + colums + r + '</tr></table><div style=height:1px></div>';
@@ -4240,6 +4243,7 @@
4243 if (deviceViewSettings.devsCols.indexOf('user') >= 0) { r += '<td style=text-align:center>' + getUserShortStr(node); } // User
4244 if (deviceViewSettings.devsCols.indexOf('ip') >= 0) { r += '<td style=text-align:center>' + (node.ip != null ? node.ip : ''); } // IP address
4245 if (deviceViewSettings.devsCols.indexOf('conn') >= 0) { r += '<td style=text-align:center>' + states.join('&nbsp;+&nbsp;'); } // Connectivity
4246 + if (deviceViewSettings.devsCols.indexOf('lastseen') >= 0) { r += '<td style=text-align:center;font-size:x-small>' + ((node.conn & 23 > 0) ? '' : printDateTime(new Date(node.lastconnect))); }
4247
4248 div.innerHTML = r;
4249 } else if ((view == 3) || (view == 5)) {