From 0cf513afa4ef677258b5bd5b8ea709006753c7d4 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 6 Aug 2013 15:09:33 -0700 Subject: [PATCH] Add handy functions for path and name parsing from the connection ID. --- guacamole/src/main/webapp/scripts/service.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/guacamole/src/main/webapp/scripts/service.js b/guacamole/src/main/webapp/scripts/service.js index af330c6e5..8dbcbe7da 100644 --- a/guacamole/src/main/webapp/scripts/service.js +++ b/guacamole/src/main/webapp/scripts/service.js @@ -51,6 +51,24 @@ GuacamoleService.Connection = function(protocol, id) { */ this.parameters = {}; + /** + * The hierarchy of groups containing this connection. The first element + * in this array is the highest-level group. If the connection is within + * the root group, this array will be empty. + * + * @type String[] + */ + this.path = id.split("/"); + + /** + * The name of this connection. This name is arbitrary and local to the + * group containing the connection. If the connection is in the root + * group, this name will be effectively equal to the ID. + * + * @type String + */ + this.name = guac_connection.path.pop(); + /** * An array of GuacamoleService.Connection.Record listing the usage * history of this connection.