summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 00:16:10 +0000
committerjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-06 00:16:10 +0000
commit8d6bcf551a7def877dcf7519e6eba2778ccbdc10 (patch)
tree261a3368468b68ecfc0960ae0aa49d738ef7a409 /remoting
parentfaecb9e641e70130e76dfbaceabaac83f78c973e (diff)
downloadchromium_src-8d6bcf551a7def877dcf7519e6eba2778ccbdc10.zip
chromium_src-8d6bcf551a7def877dcf7519e6eba2778ccbdc10.tar.gz
chromium_src-8d6bcf551a7def877dcf7519e6eba2778ccbdc10.tar.bz2
Sort host list to put on-line hosts first.
BUG=None TEST=Manual Review URL: https://chromiumcodereview.appspot.com/9554004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125041 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/webapp/host_list.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js
index 08865205..69f49a5 100644
--- a/remoting/webapp/host_list.js
+++ b/remoting/webapp/host_list.js
@@ -120,6 +120,19 @@ remoting.HostList.prototype.parseHostListResponse_ = function(xhr, onDone) {
/** @type {{data: {items: Array}}} */ JSON.parse(xhr.responseText);
if (parsed_response.data && parsed_response.data.items) {
this.hosts_ = parsed_response.data.items;
+ /**
+ * @param {remoting.Host} a
+ * @param {remoting.Host} b
+ */
+ var cmp = function(a, b) {
+ if (a.status < b.status) {
+ return 1;
+ } else if (b.status < a.status) {
+ return -1;
+ }
+ return 0;
+ };
+ this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp);
}
} else {
// Some other error.