Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 0c2bcdbd8 -> 1c0ee41d0


GUACAMOLE-265: Set page title when "name" instruction is received.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/0b2c63bd
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/0b2c63bd
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/0b2c63bd

Branch: refs/heads/master
Commit: 0b2c63bd746f06b20be029d74ee74aefcbc03fb3
Parents: 0c2bcdb
Author: Michael Jumper <mjum...@apache.org>
Authored: Sun Apr 23 15:29:01 2017 -0700
Committer: Michael Jumper <mjum...@apache.org>
Committed: Sun Apr 23 15:29:01 2017 -0700

----------------------------------------------------------------------
 .../app/client/controllers/clientController.js   |  6 +++---
 .../webapp/app/client/types/ManagedClient.js     | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/0b2c63bd/guacamole/src/main/webapp/app/client/controllers/clientController.js
----------------------------------------------------------------------
diff --git 
a/guacamole/src/main/webapp/app/client/controllers/clientController.js 
b/guacamole/src/main/webapp/app/client/controllers/clientController.js
index 71e7842..88cfaa0 100644
--- a/guacamole/src/main/webapp/app/client/controllers/clientController.js
+++ b/guacamole/src/main/webapp/app/client/controllers/clientController.js
@@ -540,9 +540,9 @@ angular.module('client').controller('clientController', 
['$scope', '$routeParams
 
     });
 
-    // Update page title when client name is received
-    $scope.$watch('client.name', function clientNameChanged(name) {
-        $scope.page.title = name;
+    // Update page title when client title changes
+    $scope.$watch('client.title', function clientTitleChanged(title) {
+        $scope.page.title = title;
     });
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/0b2c63bd/guacamole/src/main/webapp/app/client/types/ManagedClient.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/types/ManagedClient.js 
b/guacamole/src/main/webapp/app/client/types/ManagedClient.js
index 404b597..72481eb 100644
--- a/guacamole/src/main/webapp/app/client/types/ManagedClient.js
+++ b/guacamole/src/main/webapp/app/client/types/ManagedClient.js
@@ -108,6 +108,14 @@ angular.module('client').factory('ManagedClient', 
['$rootScope', '$injector',
         this.name = template.name;
 
         /**
+         * The title which should be displayed as the page title for this
+         * client.
+         *
+         * @type String
+         */
+        this.title = template.title;
+
+        /**
          * The most recently-generated thumbnail for this connection, as
          * stored within the local connection history. If no thumbnail is
          * stored, this will be null.
@@ -470,6 +478,13 @@ angular.module('client').factory('ManagedClient', 
['$rootScope', '$injector',
 
         };
 
+        // Update title when a "name" instruction is received
+        client.onname = function clientNameReceived(name) {
+            $rootScope.$apply(function updateClientTitle() {
+                managedClient.title = name;
+            });
+        };
+
         // Handle any received files
         client.onfile = function clientFileReceived(stream, mimetype, 
filename) {
             tunnelService.downloadStream(tunnel.uuid, stream, mimetype, 
filename);
@@ -498,7 +513,7 @@ angular.module('client').factory('ManagedClient', 
['$rootScope', '$injector',
         if (clientIdentifier.type === ClientIdentifier.Types.CONNECTION) {
             connectionService.getConnection(clientIdentifier.dataSource, 
clientIdentifier.id)
             .success(function connectionRetrieved(connection) {
-                managedClient.name = connection.name;
+                managedClient.name = managedClient.title = connection.name;
             });
         }
         
@@ -506,7 +521,7 @@ angular.module('client').factory('ManagedClient', 
['$rootScope', '$injector',
         else if (clientIdentifier.type === 
ClientIdentifier.Types.CONNECTION_GROUP) {
             
connectionGroupService.getConnectionGroup(clientIdentifier.dataSource, 
clientIdentifier.id)
             .success(function connectionGroupRetrieved(group) {
-                managedClient.name = group.name;
+                managedClient.name = managedClient.title = group.name;
             });
         }
 

Reply via email to