Hopefully real fix to #88 with new StatLog ability

This commit is contained in:
Bryan Ashby 2016-09-01 23:42:15 -06:00
parent 767bddcc4b
commit 470897eadc
1 changed files with 17 additions and 3 deletions

View File

@ -67,15 +67,29 @@ LastCallersModule.prototype.mciReady = function(mciData, cb) {
function fetchHistory(callback) {
callersView = vc.getView(MciCodeIds.CallerList);
StatLog.getSystemLogEntries('user_login_history', StatLog.Order.TimestampDesc, callersView.dimens.height, (err, lh) => {
// fetch up
StatLog.getSystemLogEntries('user_login_history', StatLog.Order.TimestampDesc, 200, (err, lh) => {
loginHistory = lh;
if(self.menuConfig.config.hideSysOpLogin) {
loginHistory = loginHistory.filter(lh => {
const noOpLoginHistory = loginHistory.filter(lh => {
return false === isRootUserId(parseInt(lh.log_value)); // log_value=userId
});
}
//
// If we have enough items to display, or hideSysOpLogin is set to 'always',
// then set loginHistory to our filtered list. Else, we'll leave it be.
//
if(noOpLoginHistory.length >= callersView.dimens.height || 'always' === self.menuConfig.config.hideSysOpLogin) {
loginHistory = noOpLoginHistory;
}
}
//
// Finally, we need to trim up the list to the needed size
//
loginHistory = loginHistory.slice(0, callersView.dimens.height);
return callback(err);
});
},