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

This commit is contained in:
Michael Jumper
2017-04-23 15:29:01 -07:00
parent 0c2bcdbd81
commit 0b2c63bd74
2 changed files with 20 additions and 5 deletions

View File

@@ -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;
});
/**

View File

@@ -107,6 +107,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
@@ -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;
});
}