diff options
-rw-r--r-- | remoting/resources/remoting_strings.grd | 5 | ||||
-rw-r--r-- | remoting/webapp/host.js | 2 | ||||
-rw-r--r-- | remoting/webapp/host_table_entry.js | 19 |
3 files changed, 23 insertions, 3 deletions
diff --git a/remoting/resources/remoting_strings.grd b/remoting/resources/remoting_strings.grd index f71fafd..41d6c534 100644 --- a/remoting/resources/remoting_strings.grd +++ b/remoting/resources/remoting_strings.grd @@ -530,9 +530,12 @@ <message desc="Label for general-purpose OK buttons." name="IDR_OK"> OK </message> - <message desc="Modified version of the host name shown for hosts that are not currently accessible." name="IDR_OFFLINE"> + <message desc="Modified version of the host name shown for hosts that are not currently accessible, and for which no last-online status is available." name="IDR_OFFLINE"> <ph name="HOSTNAME">$1<ex>My Linux desktop</ex></ph> (offline) </message> + <message desc="Modified version of the host name shown for hosts that are not currently accessible." name="IDR_LAST_ONLINE"> + <ph name="HOSTNAME">$1<ex>My Linux desktop</ex></ph> (last online <ph name="DATE">$2<ex>1/6/13</ex></ph>) + </message> <message desc="Modified version of the host name shown for hosts that are running an out-of-date version of the Me2Me host software." name="IDR_UPDATE_REQUIRED"> <ph name="HOSTNAME">$1<ex>My Linux desktop</ex></ph> (out-of-date) </message> diff --git a/remoting/webapp/host.js b/remoting/webapp/host.js index 24634b6..5d24b7f 100644 --- a/remoting/webapp/host.js +++ b/remoting/webapp/host.js @@ -32,6 +32,8 @@ remoting.Host = function() { this.hostVersion = ''; /** @type {Array.<string>} */ this.tokenUrlPatterns = []; + /** @type {string} */ + this.updatedTime = ''; }; /** diff --git a/remoting/webapp/host_table_entry.js b/remoting/webapp/host_table_entry.js index 3ba5189..fe9970b 100644 --- a/remoting/webapp/host_table_entry.js +++ b/remoting/webapp/host_table_entry.js @@ -336,8 +336,23 @@ remoting.HostTableEntry.prototype.setHostName_ = function() { }; hostNameNode.addEventListener('keydown', onKeyDown, false); } else { - hostNameNode.innerText = chrome.i18n.getMessage(/*i18n-content*/'OFFLINE', - this.host.hostName); + if (this.host.updatedTime) { + var lastOnline = new Date(this.host.updatedTime); + var now = new Date(); + var displayString = ''; + if (now.getFullYear() == lastOnline.getFullYear() && + now.getMonth() == lastOnline.getMonth() && + now.getDate() == lastOnline.getDate()) { + displayString = lastOnline.toLocaleTimeString(); + } else { + displayString = lastOnline.toLocaleDateString(); + } + hostNameNode.innerText = chrome.i18n.getMessage( + /*i18n-content*/'LAST_ONLINE', [this.host.hostName, displayString]); + } else { + hostNameNode.innerText = chrome.i18n.getMessage( + /*i18n-content*/'OFFLINE', this.host.hostName); + } } hostNameNode.classList.add('host-list-label'); this.hostNameCell_.innerText = ''; // Remove previous contents (if any). |