GUAC-1099: Do not attempt to display connections in guacGroupList if no connection template is provided.

This commit is contained in:
Michael Jumper
2015-02-28 12:30:36 -08:00
parent 777e031332
commit 10133ad577
2 changed files with 10 additions and 5 deletions

View File

@@ -130,8 +130,8 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
if (connectionGroup) { if (connectionGroup) {
// Create item hierarchy // Create item hierarchy, including connections only if they will be visible
var rootItem = GroupListItem.fromConnectionGroup(connectionGroup); var rootItem = GroupListItem.fromConnectionGroup(connectionGroup, !!$scope.connectionTemplate);
// If root group is to be shown, wrap that group as the child of a fake root group // If root group is to be shown, wrap that group as the child of a fake root group
if ($scope.showRootGroup) if ($scope.showRootGroup)

View File

@@ -160,17 +160,22 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
* @param {ConnectionGroup} connectionGroup * @param {ConnectionGroup} connectionGroup
* The connection group whose contents and descendants should be * The connection group whose contents and descendants should be
* represented by the new GroupListItem and its descendants. * represented by the new GroupListItem and its descendants.
*
* @param {Boolean} [includeConnections=true]
* Whether connections should be included in the contents of the
* resulting GroupListItem. By default, connections are included.
* *
* @returns {GroupListItem} * @returns {GroupListItem}
* A new GroupListItem which represents the given connection group, * A new GroupListItem which represents the given connection group,
* including all descendants. * including all descendants.
*/ */
GroupListItem.fromConnectionGroup = function fromConnectionGroup(connectionGroup) { GroupListItem.fromConnectionGroup = function fromConnectionGroup(connectionGroup,
includeConnections) {
var children = []; var children = [];
// Add any child connections // Add any child connections
if (connectionGroup.childConnections) { if (connectionGroup.childConnections && includeConnections !== false) {
connectionGroup.childConnections.forEach(function addChildConnection(child) { connectionGroup.childConnections.forEach(function addChildConnection(child) {
children.push(GroupListItem.fromConnection(child)); children.push(GroupListItem.fromConnection(child));
}); });
@@ -179,7 +184,7 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
// Add any child groups // Add any child groups
if (connectionGroup.childConnectionGroups) { if (connectionGroup.childConnectionGroups) {
connectionGroup.childConnectionGroups.forEach(function addChildGroup(child) { connectionGroup.childConnectionGroups.forEach(function addChildGroup(child) {
children.push(GroupListItem.fromConnectionGroup(child)); children.push(GroupListItem.fromConnectionGroup(child, includeConnections));
}); });
} }