GUAC-932: Make display of connections and groups within guacGroupList more abstract.

This commit is contained in:
Michael Jumper
2014-12-18 23:11:16 -08:00
parent ad5ceaa6c7
commit 2d60d2a4f9
6 changed files with 97 additions and 42 deletions

View File

@@ -35,7 +35,36 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
*
* @type ConnectionGroup|Object
*/
connectionGroup : '='
connectionGroup : '=',
/**
* Arbitrary object which shall be made available to the connection
* and connection group templates within the scope as
* <code>context</code>.
*/
context : '=',
/**
* The URL or ID of the Angular template to use when rendering a
* connection. The @link{GroupListItem} associated with that
* connection will be exposed within the scope of the template
* as <code>item</code>, and the arbitrary context object, if any,
* will be exposed as <code>context</code>.
*
* @type String
*/
connectionTemplate : '=',
/**
* The URL or ID of the Angular template to use when rendering a
* connection group. The @link{GroupListItem} associated with that
* connection group will be exposed within the scope of the
* template as <code>item</code>, and the arbitrary context object,
* if any, will be exposed as <code>context</code>.
*
* @type String
*/
connectionGroupTemplate : '='
},

View File

@@ -1,21 +0,0 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

View File

@@ -25,35 +25,18 @@
<!-- Connection -->
<div class="connection" ng-show="item.isConnection">
<a ng-href="#/client/c/{{item.identifier}}">
<div class="caption">
<!-- Connection icon -->
<div class="protocol">
<div class="icon type" ng-class="item.protocol"></div>
</div>
<!-- Connection name -->
<span class="name">{{item.name}}</span>
</div>
</a>
<ng-include src="connectionTemplate"/>
</div>
<!-- Connection group -->
<div class="group" ng-show="item.isConnectionGroup">
<div class="caption">
<!-- Connection group icon -->
<div class="icon group type" ng-click="toggleExpanded(item)"
ng-class="{expanded: item.isExpanded, empty: !item.children.length, balancer: item.isBalancing}"></div>
<!-- Connection group name -->
<span class="name">
<a ng-show="item.isBalancing" ng-href="#/client/g/{{item.identifier}}">{{item.name}}</a>
<span ng-show="!item.isBalancing">{{item.name}}</span>
</span>
<ng-include src="connectionGroupTemplate"/>
</div>

View File

@@ -0,0 +1,35 @@
<a ng-href="#/client/c/{{item.identifier}}">
<!--
Copyright (C) 2014 Glyptodon LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<div class="caption">
<!-- Connection icon -->
<div class="protocol">
<div class="icon type" ng-class="item.protocol"></div>
</div>
<!-- Connection name -->
<span class="name">{{item.name}}</span>
</div>
</a>

View File

@@ -0,0 +1,26 @@
<span class="name">
<!--
Copyright (C) 2014 Glyptodon LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<a ng-show="item.isBalancing" ng-href="#/client/g/{{item.identifier}}">{{item.name}}</a>
<span ng-show="!item.isBalancing">{{item.name}}</span>
</span>

View File

@@ -36,7 +36,10 @@
<!-- All connections for this user -->
<h2>{{'home.allConnections' | translate}}</h2>
<div class="all-connections" ng-class="{loading: loading}">
<guac-group-list connection-group="rootConnectionGroup"/>
<guac-group-list
connection-group="rootConnectionGroup"
connection-template="'app/home/templates/connection.html'"
connection-group-template="'app/home/templates/connectionGroup.html'"/>
</div>
</div>