Display proper online time in whos_online.js
This commit is contained in:
parent
2a7dce9fac
commit
1b68264dc2
|
@ -71,13 +71,18 @@ WhosOnlineModule.prototype.mciReady = function(mciData, cb) {
|
||||||
|
|
||||||
var listFormat = self.menuConfig.config.listFormat || '{node} - {username} - {action} - {timeOn}';
|
var listFormat = self.menuConfig.config.listFormat || '{node} - {username} - {action} - {timeOn}';
|
||||||
|
|
||||||
|
var now = moment();
|
||||||
|
|
||||||
onlineListView.setItems(_.map(onlineList, function formatOnlineEntry(oe) {
|
onlineListView.setItems(_.map(onlineList, function formatOnlineEntry(oe) {
|
||||||
return listFormat.format({
|
return listFormat.format({
|
||||||
node : oe.node,
|
node : oe.node,
|
||||||
userId : oe.user.userId,
|
userId : oe.user.userId,
|
||||||
userName : oe.user.username,
|
userName : oe.user.username,
|
||||||
realName : oe.user.properties.real_name,
|
realName : oe.user.properties.real_name,
|
||||||
timeOn : _.capitalize(moment.duration(55, 'minutes').humanize()),
|
timeOn : function getTimeOn() {
|
||||||
|
var diff = now.diff(moment(oe.user.properties.last_login_timestamp), 'minutes');
|
||||||
|
return _.capitalize(moment.duration(diff, 'minutes').humanize());
|
||||||
|
},
|
||||||
action : function getCurrentAction() {
|
action : function getCurrentAction() {
|
||||||
var cmm = oe.currentMenuModule;
|
var cmm = oe.currentMenuModule;
|
||||||
if(cmm) {
|
if(cmm) {
|
||||||
|
|
Loading…
Reference in New Issue