guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vn...@apache.org
Subject [1/4] incubator-guacamole-client git commit: GUACAMOLE-338: Allow guacGroupList and guacGroupListFilter to accept GroupListItems in addition to ConnectionGroups.
Date Fri, 14 Jul 2017 19:39:14 GMT
Repository: incubator-guacamole-client
Updated Branches:
  refs/heads/master 33e76c4d7 -> 7c162fde9


GUACAMOLE-338: Allow guacGroupList and guacGroupListFilter to accept GroupListItems in addition
to ConnectionGroups.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/5648c36c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5648c36c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5648c36c

Branch: refs/heads/master
Commit: 5648c36c267b6becb287542766eba77a4d9a9311
Parents: 303be24
Author: Michael Jumper <mjumper@apache.org>
Authored: Mon Jul 3 16:07:24 2017 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Mon Jul 3 16:07:24 2017 -0700

----------------------------------------------------------------------
 .../app/groupList/directives/guacGroupList.js     | 18 +++++++++++++-----
 .../groupList/directives/guacGroupListFilter.js   |  7 ++++++-
 2 files changed, 19 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5648c36c/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
index 87adb49..97a4f22 100644
--- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
+++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
@@ -32,7 +32,7 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
              * The connection groups to display as a map of data source
              * identifier to corresponding root group.
              *
-             * @type Object.<String, ConnectionGroup>
+             * @type Object.<String, ConnectionGroup|GroupListItem>
              */
             connectionGroups : '=',
 
@@ -167,15 +167,23 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
                     // Add each provided connection group
                     angular.forEach(connectionGroups, function addConnectionGroup(connectionGroup,
dataSource) {
 
+                        var rootItem;
+
                         // Prepare data source for active connection counting
                         dataSources.push(dataSource);
                         connectionCount[dataSource] = {};
 
+                        // If the provided connection group is already a
+                        // GroupListItem, no need to create a new item
+                        if (connectionGroup instanceof GroupListItem)
+                            rootItem = connectionGroup;
+
                         // Create root item for current connection group
-                        var rootItem = GroupListItem.fromConnectionGroup(dataSource, connectionGroup,
-                            $scope.isVisible(GroupListItem.Type.CONNECTION),
-                            $scope.isVisible(GroupListItem.Type.SHARING_PROFILE),
-                            countActiveConnections);
+                        else
+                            rootItem = GroupListItem.fromConnectionGroup(dataSource, connectionGroup,
+                                $scope.isVisible(GroupListItem.Type.CONNECTION),
+                                $scope.isVisible(GroupListItem.Type.SHARING_PROFILE),
+                                countActiveConnections);
 
                         // If root group is to be shown, add it as a root item
                         if ($scope.showRootGroup)

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5648c36c/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js b/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
index 818b2ff..0352393 100644
--- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
+++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupListFilter.js
@@ -49,7 +49,7 @@ angular.module('groupList').directive('guacGroupListFilter', [function guacGroup
              * identifier to corresponding root group. A subset of this map
              * will be exposed as filteredConnectionGroups.
              *
-             * @type Object.<String, ConnectionGroup>
+             * @type Object.<String, ConnectionGroup|GroupListItem>
              */
             connectionGroups : '&',
 
@@ -81,6 +81,7 @@ angular.module('groupList').directive('guacGroupListFilter', [function guacGroup
             // Required types
             var ConnectionGroup = $injector.get('ConnectionGroup');
             var FilterPattern   = $injector.get('FilterPattern');
+            var GroupListItem   = $injector.get('GroupListItem');
 
             /**
              * The pattern object to use when filtering connections.
@@ -176,6 +177,10 @@ angular.module('groupList').directive('guacGroupListFilter', [function
guacGroup
                 if (connectionGroups) {
                     angular.forEach(connectionGroups, function updateFilteredConnectionGroup(connectionGroup,
dataSource) {
 
+                        // Unwrap GroupListItem
+                        if (connectionGroup instanceof GroupListItem)
+                            connectionGroup = connectionGroup.wrappedItem;
+
                         // Flatten hierarchy of connection group
                         var filteredGroup = flattenConnectionGroup(connectionGroup);
 


Mime
View raw message