mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
GUAC-586: Support data sources within home screen.
This commit is contained in:
@@ -31,13 +31,15 @@ angular.module('home').directive('guacRecentConnections', [function guacRecentCo
|
||||
scope: {
|
||||
|
||||
/**
|
||||
* The root connection group, and all visible descendants.
|
||||
* Recent connections will only be shown if they exist within this
|
||||
* hierarchy, regardless of their existence within the history.
|
||||
* The root connection groups to display, and all visible
|
||||
* descendants, as a map of data source identifier to the root
|
||||
* connection group within that data source. Recent connections
|
||||
* will only be shown if they exist within this hierarchy,
|
||||
* regardless of their existence within the history.
|
||||
*
|
||||
* @type ConnectionGroup
|
||||
* @type Object.<String, ConnectionGroup>
|
||||
*/
|
||||
rootGroup : '='
|
||||
rootGroups : '='
|
||||
|
||||
},
|
||||
|
||||
@@ -91,11 +93,15 @@ angular.module('home').directive('guacRecentConnections', [function guacRecentCo
|
||||
/**
|
||||
* Adds the given connection to the internal set of visible
|
||||
* objects.
|
||||
*
|
||||
*
|
||||
* @param {String} dataSource
|
||||
* The identifier of the data source associated with the
|
||||
* given connection group.
|
||||
*
|
||||
* @param {Connection} connection
|
||||
* The connection to add to the internal set of visible objects.
|
||||
*/
|
||||
var addVisibleConnection = function addVisibleConnection(connection) {
|
||||
var addVisibleConnection = function addVisibleConnection(dataSource, connection) {
|
||||
|
||||
// Add given connection to set of visible objects
|
||||
visibleObjects['c/' + connection.identifier] = connection;
|
||||
@@ -105,28 +111,36 @@ angular.module('home').directive('guacRecentConnections', [function guacRecentCo
|
||||
/**
|
||||
* Adds the given connection group to the internal set of visible
|
||||
* objects, along with any descendants.
|
||||
*
|
||||
*
|
||||
* @param {String} dataSource
|
||||
* The identifier of the data source associated with the
|
||||
* given connection group.
|
||||
*
|
||||
* @param {ConnectionGroup} connectionGroup
|
||||
* The connection group to add to the internal set of visible
|
||||
* objects, along with any descendants.
|
||||
*/
|
||||
var addVisibleConnectionGroup = function addVisibleConnectionGroup(connectionGroup) {
|
||||
var addVisibleConnectionGroup = function addVisibleConnectionGroup(dataSource, connectionGroup) {
|
||||
|
||||
// Add given connection group to set of visible objects
|
||||
visibleObjects['g/' + connectionGroup.identifier] = connectionGroup;
|
||||
|
||||
// Add all child connections
|
||||
if (connectionGroup.childConnections)
|
||||
connectionGroup.childConnections.forEach(addVisibleConnection);
|
||||
connectionGroup.childConnections.forEach(function addChildConnection(child) {
|
||||
addVisibleConnection(dataSource, child);
|
||||
});
|
||||
|
||||
// Add all child connection groups
|
||||
if (connectionGroup.childConnectionGroups)
|
||||
connectionGroup.childConnectionGroups.forEach(addVisibleConnectionGroup);
|
||||
connectionGroup.childConnectionGroups.forEach(function addChildConnectionGroup(child) {
|
||||
addVisibleConnectionGroup(dataSource, child);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// Update visible objects when root group is set
|
||||
$scope.$watch("rootGroup", function setRootGroup(rootGroup) {
|
||||
// Update visible objects when root groups are set
|
||||
$scope.$watch("rootGroups", function setRootGroups(rootGroups) {
|
||||
|
||||
// Clear connection arrays
|
||||
$scope.activeConnections = [];
|
||||
@@ -134,8 +148,11 @@ angular.module('home').directive('guacRecentConnections', [function guacRecentCo
|
||||
|
||||
// Produce collection of visible objects
|
||||
visibleObjects = {};
|
||||
if (rootGroup)
|
||||
addVisibleConnectionGroup(rootGroup);
|
||||
if (rootGroups) {
|
||||
angular.forEach(rootGroups, function addConnectionGroup(rootGroup, dataSource) {
|
||||
addVisibleConnectionGroup(dataSource, rootGroup);
|
||||
});
|
||||
}
|
||||
|
||||
var managedClients = guacClientManager.getManagedClients();
|
||||
|
||||
|
Reference in New Issue
Block a user