GUACAMOLE-265: Merge page title change on name instruction.

This commit is contained in:
James Muehlner
2017-04-26 19:55:17 -07:00
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 // Update page title when client title changes
$scope.$watch('client.name', function clientNameChanged(name) { $scope.$watch('client.title', function clientTitleChanged(title) {
$scope.page.title = name; $scope.page.title = title;
}); });
/** /**

View File

@@ -107,6 +107,14 @@ angular.module('client').factory('ManagedClient', ['$rootScope', '$injector',
*/ */
this.name = template.name; 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 * The most recently-generated thumbnail for this connection, as
* stored within the local connection history. If no thumbnail is * 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 // Handle any received files
client.onfile = function clientFileReceived(stream, mimetype, filename) { client.onfile = function clientFileReceived(stream, mimetype, filename) {
tunnelService.downloadStream(tunnel.uuid, 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) { if (clientIdentifier.type === ClientIdentifier.Types.CONNECTION) {
connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id) connectionService.getConnection(clientIdentifier.dataSource, clientIdentifier.id)
.success(function connectionRetrieved(connection) { .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) { else if (clientIdentifier.type === ClientIdentifier.Types.CONNECTION_GROUP) {
connectionGroupService.getConnectionGroup(clientIdentifier.dataSource, clientIdentifier.id) connectionGroupService.getConnectionGroup(clientIdentifier.dataSource, clientIdentifier.id)
.success(function connectionGroupRetrieved(group) { .success(function connectionGroupRetrieved(group) {
managedClient.name = group.name; managedClient.name = managedClient.title = group.name;
}); });
} }