Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1326)

Unified Diff: remoting/webapp/crd/js/gcd_client.js

Issue 1104383002: Added ability to list and delete hosts with GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for review Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | remoting/webapp/crd/js/host_list_api_gcd_impl.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | remoting/webapp/crd/js/host_list_api_gcd_impl.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698