Cleanup and handle stats that are not yet ready

This commit is contained in:
Bryan Ashby 2022-04-12 22:16:42 -06:00
parent 3d070ddf35
commit 568c94e341
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
1 changed files with 20 additions and 17 deletions

View File

@ -152,9 +152,9 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
}
_refreshStats(cb) {
const fileAreaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats);
const sysMemStats = StatLog.getSystemStat(SysProps.SystemMemoryStats);
const sysLoadStats = StatLog.getSystemStat(SysProps.SystemLoadStats);
const fileAreaStats = StatLog.getSystemStat(SysProps.FileBaseAreaStats) || {};
const sysMemStats = StatLog.getSystemStat(SysProps.SystemMemoryStats) || {};
const sysLoadStats = StatLog.getSystemStat(SysProps.SystemLoadStats) || {};
const lastLoginStats = StatLog.getSystemStat(SysProps.LastLogin);
const now = moment();
@ -197,10 +197,10 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
lastLoginTime : moment(lastLoginStats.timestamp).format(this.getTimeFormat()),
lastLogin : moment(lastLoginStats.timestamp).format(this._dateTimeFormat('lastLogin')),
totalMemoryBytes : sysMemStats.totalBytes,
freeMemoryBytes : sysMemStats.freeBytes,
systemAvgLoad : sysLoadStats.average,
systemCurrentLoad : sysLoadStats.current,
totalMemoryBytes : sysMemStats.totalBytes || 0,
freeMemoryBytes : sysMemStats.freeBytes || 0,
systemAvgLoad : sysLoadStats.average || 0,
systemCurrentLoad : sysLoadStats.current || 0,
};
return cb(null);
@ -212,10 +212,12 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
return cb(null);
}
const nodeStatusItems = getActiveConnectionList(false).slice(0, nodeStatusView.dimens.height).map(ac => {
const nodeStatusItems = getActiveConnectionList(false)
.slice(0, nodeStatusView.dimens.height)
.map(ac => {
// Handle pre-authenticated
if (!ac.authenticated) {
ac.text = ac.userName = 'Pre Auth';
ac.text = ac.userName = '*Pre Auth*';
ac.action = 'Logging In';
}
@ -248,7 +250,8 @@ exports.getModule = class WaitingForCallerModule extends MenuModule {
return cb(null);
}
const quickLogTimestampFormat = this.config.quickLogTimestampFormat ||
const quickLogTimestampFormat =
this.config.quickLogTimestampFormat ||
this.getDateTimeFormat('short');
const levelIndicators = this.config.quickLogLevelIndicators ||