GUACAMOLE-724: Prefer to return an existing group rather than create a new one.
This ensures that focus state is maintained when switching from one group to another. Focus state is otherwise reset when the group is recreated.
This commit is contained in:
1 parent
74f0e0aec3
commit
f6909a06e7
1 file changed
+9
-1
@@ -235,6 +235,15 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
||||
*/
|
||||
service.getManagedClientGroup = function getManagedClientGroup(id) {
|
||||
|
||||
var managedClientGroups = storedManagedClientGroups();
|
||||
var existingGroup = _.find(managedClientGroups, (group) => {
|
||||
return id === ManagedClientGroup.getIdentifier(group);
|
||||
});
|
||||
|
||||
// Prefer to return the existing group if it exactly matches
|
||||
if (existingGroup)
|
||||
return existingGroup;
|
||||
|
||||
var clients = [];
|
||||
var clientIds = ManagedClientGroup.getClientIdentifiers(id);
|
||||
|
||||
@@ -253,7 +262,6 @@ angular.module('client').factory('guacClientManager', ['$injector',
|
||||
clients : clients
|
||||
});
|
||||
|
||||
var managedClientGroups = storedManagedClientGroups();
|
||||
managedClientGroups.push(group);
|
||||
return group;
|
||||
|
||||
|
||||
Reference in new issue
Block a user