From 4ddb760d19c2c7d75dc30a1fa2b272f9f74512a2 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Fri, 2 Jan 2015 21:18:55 -0800 Subject: [PATCH] GUAC-976: Do not display connection or connection group divs within guacGroupList if there is no corresponding template. --- .../app/groupList/directives/guacGroupList.js | 32 +++++++++++++++++++ .../groupList/templates/guacGroupList.html | 4 +-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js index 7d7f18871..d1190bab6 100644 --- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js +++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js @@ -85,6 +85,38 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList() // Get required types var GroupListItem = $injector.get('GroupListItem'); + /** + * Returns whether the given item represents a connection that can + * be displayed. If there is no connection template, then no + * connection is visible. + * + * @param {GroupListItem} item + * The item to check. + * + * @returns {Boolean} + * true if the given item is a connection that can be + * displayed, false otherwise. + */ + $scope.isVisibleConnection = function isVisibleConnection(item) { + return item.isConnection && !!$scope.connectionTemplate; + }; + + /** + * Returns whether the given item represents a connection group + * that can be displayed. If there is no connection group template, + * then no connection group is visible. + * + * @param {GroupListItem} item + * The item to check. + * + * @returns {Boolean} + * true if the given item is a connection group that can be + * displayed, false otherwise. + */ + $scope.isVisibleConnectionGroup = function isVisibleConnectionGroup(item) { + return item.isConnectionGroup && !!$scope.connectionGroupTemplate; + }; + // Set contents whenever the connection group is assigned or changed $scope.$watch("connectionGroup", function setContents(connectionGroup) { diff --git a/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html b/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html index 21c040318..287804321 100644 --- a/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html +++ b/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html @@ -24,14 +24,14 @@