GUACAMOLE-5: Generalize and clean the guacGroupList directive such that arbitrary GroupListItem types can be supported.

This commit is contained in:
Michael Jumper
2016-08-05 16:28:33 -07:00
parent 558d242060
commit 56d9c90940
11 changed files with 121 additions and 159 deletions

View File

@@ -26,6 +26,7 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
// Get required types
var ConnectionGroup = $injector.get('ConnectionGroup');
var ClientIdentifier = $injector.get('ClientIdentifier');
var GroupListItem = $injector.get('GroupListItem');
// Get required services
var authenticationService = $injector.get('authenticationService');
@@ -95,15 +96,15 @@ angular.module('home').controller('homeController', ['$scope', '$injector',
getClientIdentifier : function getClientIdentifier(item) {
// If the item is a connection, generate a connection identifier
if (item.isConnection)
if (item.type === GroupListItem.Type.CONNECTION)
return ClientIdentifier.toString({
dataSource : item.dataSource,
type : ClientIdentifier.Types.CONNECTION,
id : item.identifier
});
// If the item is a connection, generate a connection group identifier
if (item.isConnectionGroup)
// If the item is a connection group, generate a connection group identifier
if (item.type === GroupListItem.Type.CONNECTION_GROUP)
return ClientIdentifier.toString({
dataSource : item.dataSource,
type : ClientIdentifier.Types.CONNECTION_GROUP,

View File

@@ -1,5 +1,4 @@
<span class="name">
<a ng-show="item.isBalancing" ng-href="#/client/{{context.getClientIdentifier(item)}}">{{item.name}}</a>
<span ng-show="!item.isBalancing">{{item.name}}</span>
<a ng-show="item.balancing" ng-href="#/client/{{context.getClientIdentifier(item)}}">{{item.name}}</a>
<span ng-show="!item.balancing">{{item.name}}</span>
</span>

View File

@@ -25,8 +25,10 @@
<guac-group-list
context="context"
connection-groups="filteredRootConnectionGroups"
connection-template="'app/home/templates/connection.html'"
connection-group-template="'app/home/templates/connectionGroup.html'"
templates="{
'connection' : 'app/home/templates/connection.html',
'connection-group' : 'app/home/templates/connectionGroup.html'
}"
page-size="20"></guac-group-list>
</div>