From 8ff593799387170b4f2b177196d7adf7a7f0db07 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 12 Jul 2011 14:10:55 +0200 Subject: [PATCH] display last ping for user --- public/user.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/public/user.html b/public/user.html index f232206..e8d3f1d 100644 --- a/public/user.html +++ b/public/user.html @@ -88,6 +88,19 @@ console.debug( cols ); self.r.table = $resource('/table/:table'); self.table_update = function () { if ( ! self.username || ! self.cpe.table_name ) return; + + self.message.ping = self.username+' loading'; + self.r.table.get({ username: self.username, table: 'ping', limit: 1 }, function(ping) { + $log.info('ping', ping); + self.message.ping = null; + var hash = {}; + for(var i = 0; i <= ping.columns.length; i++) { + hash[ping.columns[i]] = ping.rows[0][i]; + } + self.cpe.ping = hash; + $log.info('ping hash', hash); + }); + self.message.table = self.username + ' loading from ' + self.cpe.table_name; self.r.table.get({ username: self.username, table: self.cpe.table_name, limit: self.cpe_limit }, function(table) { $log.info( 'table', table ); @@ -274,6 +287,10 @@ li > tt {
  • {{c}} {{LDAP[0][c]}}
  • +
    + ping {{cpe.ping.ip}} rtt {{cpe.ping.rtt}} at {{cpe.ping.timestamp}} +
    +