Index: remoting/webapp/crd/js/gcd_client.js |
diff --git a/remoting/webapp/crd/js/gcd_client.js b/remoting/webapp/crd/js/gcd_client.js |
index 5417737253bc796e31a1dafa3897186b5e40ab82..173a10aac9a98000099cad1d5e6383b789b875d4 100644 |
--- a/remoting/webapp/crd/js/gcd_client.js |
+++ b/remoting/webapp/crd/js/gcd_client.js |
@@ -32,7 +32,8 @@ remoting.gcd.RegistrationTicket; |
/** |
* TODO: Flesh out with typical fields. |
* @typedef {{ |
- * id:string |
+ * id:string, |
+ * name:string |
* }} |
*/ |
remoting.gcd.Device; |
@@ -206,12 +207,18 @@ remoting.gcd.Client.prototype.finalizeRegistrationTicket = function(ticketId) { |
/** |
* Lists devices user has access to. |
* TODO: Add link to GCD docs. |
+ * @param {string=} opt_nameSubstring If present, the list of devices |
+ * is filtered by GCD such that every device returned contains |
+ * this string as as a substring of its |name| or |displayName|. |
* @return {!Promise<!Array<remoting.gcd.Device>>} |
*/ |
-remoting.gcd.Client.prototype.listDevices = function() { |
+remoting.gcd.Client.prototype.listDevices = function(opt_nameSubstring) { |
return new remoting.Xhr({ |
method: 'GET', |
url: this.apiBaseUrl_ + '/devices', |
+ urlParams: { |
+ nameSubstring: opt_nameSubstring || null |
+ }, |
useIdentity: true, |
acceptJson: true |
}).start().then(function(response) { |
@@ -241,7 +248,7 @@ remoting.gcd.Client.prototype.deleteDevice = function(deviceId) { |
return false; |
} |
if (response.isError()) { |
- console.warn('error deleting device'); |
+ console.error('error deleting device'); |
throw remoting.Error.unexpected(); |
} |
return true; |