You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2016/08/10 23:45:04 UTC
[1/5] incubator-guacamole-client git commit: GUACAMOLE-5: Define
sorting weight for GroupListItem.
Repository: incubator-guacamole-client
Updated Branches:
refs/heads/master 989ad3951 -> 97eb8a92c
GUACAMOLE-5: Define sorting weight for GroupListItem.
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/558d2420
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/558d2420
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/558d2420
Branch: refs/heads/master
Commit: 558d2420608784b084410ff5268f856e9196ca88
Parents: 989ad39
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 5 15:29:26 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun Aug 7 23:09:37 2016 -0700
----------------------------------------------------------------------
.../webapp/app/groupList/templates/guacGroupList.html | 2 +-
.../src/main/webapp/app/groupList/types/GroupListItem.js | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/558d2420/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html b/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
index df9b5b6..be06a5c 100644
--- a/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
+++ b/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
@@ -58,7 +58,7 @@
</div>
<!-- Pager for connections / groups -->
- <guac-pager page="childrenPage" items="rootItems | orderBy : 'name'"
+ <guac-pager page="childrenPage" items="rootItems | orderBy : ['weight', 'name']"
page-size="pageSize"></guac-pager>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/558d2420/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js b/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
index 2fc9cf5..f472090 100644
--- a/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
+++ b/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
@@ -132,6 +132,16 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
*/
this.wrappedItem = template.wrappedItem;
+ /**
+ * The sorting weight to apply when displaying this GroupListItem. This
+ * weight is relative only to other sorting weights. If two items have
+ * the same weight, they will be sorted based on their names.
+ *
+ * @type Number
+ * @default 0
+ */
+ this.weight = template.weight || 0;
+
};
/**
[5/5] incubator-guacamole-client git commit: GUACAMOLE-5: Merge
contextual create link changes.
Posted by jm...@apache.org.
GUACAMOLE-5: Merge contextual create link changes.
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/97eb8a92
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/97eb8a92
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/97eb8a92
Branch: refs/heads/master
Commit: 97eb8a92c8ca694058b16d980701c214f990db4a
Parents: 989ad39 5779274
Author: James Muehlner <ja...@guac-dev.org>
Authored: Wed Aug 10 16:44:31 2016 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Wed Aug 10 16:44:31 2016 -0700
----------------------------------------------------------------------
.../app/groupList/directives/guacGroupList.js | 112 ++++++----------
.../app/groupList/templates/guacGroupList.html | 50 ++-----
.../webapp/app/groupList/types/GroupListItem.js | 97 +++++++++-----
.../app/home/controllers/homeController.js | 7 +-
.../app/home/templates/connectionGroup.html | 5 +-
.../main/webapp/app/home/templates/home.html | 6 +-
.../src/main/webapp/app/index/styles/lists.css | 8 +-
.../src/main/webapp/app/index/styles/ui.css | 6 +-
.../controllers/manageConnectionController.js | 5 +-
.../manageConnectionGroupController.js | 4 +-
.../app/manage/templates/locationChooser.html | 4 +-
.../webapp/app/manage/templates/manageUser.html | 8 +-
.../directives/guacSettingsConnections.js | 133 +++++++++++++++++--
.../app/settings/styles/connection-list.css | 34 +++++
.../app/settings/templates/newConnection.html | 3 +
.../settings/templates/newConnectionGroup.html | 3 +
.../settings/templates/settingsConnections.html | 12 +-
17 files changed, 321 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
[2/5] incubator-guacamole-client git commit: GUACAMOLE-5: Generalize
and clean the guacGroupList directive such that arbitrary GroupListItem types
can be supported.
Posted by jm...@apache.org.
GUACAMOLE-5: Generalize and clean the guacGroupList directive such that arbitrary GroupListItem types can be supported.
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/56d9c909
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/56d9c909
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/56d9c909
Branch: refs/heads/master
Commit: 56d9c9094083acd6857bcfb431264ad291aad836
Parents: 558d242
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 5 16:28:33 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun Aug 7 23:10:20 2016 -0700
----------------------------------------------------------------------
.../app/groupList/directives/guacGroupList.js | 95 +++++---------------
.../app/groupList/templates/guacGroupList.html | 48 +++-------
.../webapp/app/groupList/types/GroupListItem.js | 87 +++++++++++-------
.../app/home/controllers/homeController.js | 7 +-
.../app/home/templates/connectionGroup.html | 5 +-
.../main/webapp/app/home/templates/home.html | 6 +-
.../src/main/webapp/app/index/styles/lists.css | 8 +-
.../src/main/webapp/app/index/styles/ui.css | 6 +-
.../app/manage/templates/locationChooser.html | 4 +-
.../webapp/app/manage/templates/manageUser.html | 8 +-
.../settings/templates/settingsConnections.html | 6 +-
11 files changed, 121 insertions(+), 159 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/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 d5404c7..3587be7 100644
--- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
+++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
@@ -46,37 +46,18 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
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>.
+ * The map of @link{GroupListItem} type to the URL or ID of the
+ * Angular template to use when rendering a @link{GroupListItem} of
+ * that type. The @link{GroupListItem} itself will be within the
+ * scope of the template as <code>item</code>, and the arbitrary
+ * context object, if any, will be exposed as <code>context</code>.
+ * If the template for a type is omitted, items of that type will
+ * not be rendered. All standard types are defined by
+ * @link{GroupListItem.Type}, but use of custom types is legal.
*
- * @type String
+ * @type Object.<String, 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 : '=',
-
- /**
- * The URL or ID of the Angular template to use when rendering a
- * sharing profile. The @link{GroupListItem} associated with that
- * sharing profile 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
- */
- sharingProfileTemplate : '=',
+ templates : '=',
/**
* Whether the root of the connection group hierarchy given should
@@ -145,51 +126,20 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
};
/**
- * 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;
- };
-
- /**
- * Returns whether the given item represents a sharing profile that
- * can be displayed. If there is no sharing profile template, then
- * no sharing profile is visible.
+ * Returns whether a @link{GroupListItem} of the given type can be
+ * displayed. If there is no template associated with the given
+ * type, then a @link{GroupListItem} of that type cannot be
+ * displayed.
*
- * @param {GroupListItem} item
- * The item to check.
+ * @param {String} type
+ * The type to check.
*
* @returns {Boolean}
- * true if the given item is a sharing profile that can be
- * displayed, false otherwise.
+ * true if the given @link{GroupListItem} type can be displayed,
+ * false otherwise.
*/
- $scope.isVisibleSharingProfile = function isVisibleSharingProfile(item) {
- return item.isSharingProfile && !!$scope.sharingProfileTemplate;
+ $scope.isVisible = function isVisible(type) {
+ return !!$scope.templates[type];
};
// Set contents whenever the connection group is assigned or changed
@@ -212,7 +162,8 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
// Create root item for current connection group
var rootItem = GroupListItem.fromConnectionGroup(dataSource, connectionGroup,
- !!$scope.connectionTemplate, !!$scope.sharingProfileTemplate,
+ $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
@@ -265,7 +216,7 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
* connection group.
*/
$scope.toggleExpanded = function toggleExpanded(groupListItem) {
- groupListItem.isExpanded = !groupListItem.isExpanded;
+ groupListItem.expanded = !groupListItem.expanded;
};
}]
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html b/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
index be06a5c..4c9bb42 100644
--- a/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
+++ b/guacamole/src/main/webapp/app/groupList/templates/guacGroupList.html
@@ -1,55 +1,31 @@
<div class="group-list">
<script type="text/ng-template" id="nestedItem.html">
-
- <!-- Connection -->
- <div class="connection expandable" ng-if="isVisibleConnection(item)"
- ng-class="{expanded: item.isExpanded, empty: !item.children.length}">
+ <div class="{{item.type}}" ng-if="isVisible(item.type)"
+ ng-class="{
+ expanded : item.expanded,
+ expandable : item.expandable,
+ empty : !item.children.length
+ }">
+
+ <!-- Item caption -->
<div class="caption">
<!-- Expand/collapse icon -->
<div class="icon expand" ng-click="toggleExpanded(item)"
- ng-if="sharingProfileTemplate"></div>
+ ng-if="item.expandable"></div>
- <ng-include src="connectionTemplate"/>
+ <ng-include src="templates[item.type]"/>
</div>
- <!-- Children of this connection -->
- <div class="children" ng-show="item.isExpanded">
+ <!-- Children of item (if any) -->
+ <div class="children" ng-if="item.expanded">
<div class="list-item" ng-repeat="item in item.children | orderBy : 'name'"
ng-include="'nestedItem.html'"></div>
</div>
</div>
-
- <!-- Connection group -->
- <div class="group expandable" ng-if="isVisibleConnectionGroup(item)"
- ng-class="{expanded: item.isExpanded, empty: !item.children.length, balancer: item.isBalancing}">
- <div class="caption">
-
- <!-- Expand/collapse icon -->
- <div class="icon expand" ng-click="toggleExpanded(item)"></div>
-
- <ng-include src="connectionGroupTemplate"/>
-
- </div>
-
- <!-- Children of this group -->
- <div class="children" ng-if="item.isExpanded">
- <div class="list-item" ng-repeat="item in item.children | orderBy : 'name'"
- ng-include="'nestedItem.html'"></div>
- </div>
-
- </div>
-
- <!-- Sharing profile -->
- <div class="sharing-profile" ng-show="isVisibleSharingProfile(item)">
- <div class="caption">
- <ng-include src="sharingProfileTemplate"/>
- </div>
- </div>
-
</script>
<!-- Root-level connections / groups -->
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js b/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
index f472090..3591dd0 100644
--- a/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
+++ b/guacamole/src/main/webapp/app/groupList/types/GroupListItem.js
@@ -77,43 +77,36 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
this.children = template.children || [];
/**
- * Whether this item represents a connection. If this item represents
- * a connection group or sharing profile, this MUST be false.
+ * The type of object represented by this GroupListItem. Standard types
+ * are defined by GroupListItem.Type, but custom types are also legal.
*
- * @type Boolean
- */
- this.isConnection = template.isConnection;
-
- /**
- * Whether this item represents a connection group. If this item
- * represents a connection or sharing profile, this MUST be false.
- *
- * @type Boolean
+ * @type String
*/
- this.isConnectionGroup = template.isConnectionGroup;
+ this.type = template.type;
/**
- * Whether this item represents a sharing profile. If this item
- * represents a connection or connection group, this MUST be false.
+ * Whether this item, or items of the same type, can contain children.
+ * This may be true even if this particular item does not presently
+ * contain children.
*
* @type Boolean
*/
- this.isSharingProfile = template.isSharingProfile;
+ this.expandable = template.expandable;
/**
* Whether this item represents a balancing connection group.
*
* @type Boolean
*/
- this.isBalancing = template.isBalancing;
+ this.balancing = template.balancing;
/**
* Whether the children items should be displayed.
*
* @type Boolean
*/
- this.isExpanded = template.isExpanded;
-
+ this.expanded = template.expanded;
+
/**
* Returns the number of currently active users for this connection,
* connection group, or sharing profile, if known.
@@ -126,9 +119,11 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
/**
* The connection, connection group, or sharing profile whose data is
- * exposed within this GroupListItem.
+ * exposed within this GroupListItem. If the type of this GroupListItem
+ * is not one of the types defined by GroupListItem.Type, then this
+ * value may be anything.
*
- * @type Connection|ConnectionGroup|SharingProfile
+ * @type Connection|ConnectionGroup|SharingProfile|*
*/
this.wrappedItem = template.wrappedItem;
@@ -192,9 +187,8 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
dataSource : dataSource,
// Type information
- isConnection : true,
- isConnectionGroup : false,
- isSharingProfile : false,
+ expandable : includeSharingProfiles,
+ type : GroupListItem.Type.CONNECTION,
// Already-converted children
children : children,
@@ -287,10 +281,9 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
dataSource : dataSource,
// Type information
- isConnection : false,
- isConnectionGroup : true,
- isSharingProfile : false,
- isBalancing : connectionGroup.type === ConnectionGroup.Type.BALANCING,
+ type : GroupListItem.Type.CONNECTION_GROUP,
+ balancing : connectionGroup.type === ConnectionGroup.Type.BALANCING,
+ expandable : true,
// Already-converted children
children : children,
@@ -341,9 +334,7 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
dataSource : dataSource,
// Type information
- isConnection : false,
- isConnectionGroup : false,
- isSharingProfile : true,
+ type : GroupListItem.Type.SHARING_PROFILE,
// Wrapped item
wrappedItem : sharingProfile
@@ -352,6 +343,42 @@ angular.module('groupList').factory('GroupListItem', ['ConnectionGroup', functio
};
+ /**
+ * All pre-defined types of GroupListItems. Note that, while these are the
+ * standard types supported by GroupListItem and the related guacGroupList
+ * directive, the type string is otherwise arbitrary and custom types are
+ * legal.
+ *
+ * @type Object.<String, String>
+ */
+ GroupListItem.Type = {
+
+ /**
+ * The standard type string of a GroupListItem which represents a
+ * connection.
+ *
+ * @type String
+ */
+ CONNECTION : 'connection',
+
+ /**
+ * The standard type string of a GroupListItem which represents a
+ * connection group.
+ *
+ * @type String
+ */
+ CONNECTION_GROUP : 'connection-group',
+
+ /**
+ * The standard type string of a GroupListItem which represents a
+ * sharing profile.
+ *
+ * @type String
+ */
+ SHARING_PROFILE : 'sharing-profile'
+
+ };
+
return GroupListItem;
}]);
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/home/controllers/homeController.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/home/controllers/homeController.js b/guacamole/src/main/webapp/app/home/controllers/homeController.js
index aff81ae..150ac4e 100644
--- a/guacamole/src/main/webapp/app/home/controllers/homeController.js
+++ b/guacamole/src/main/webapp/app/home/controllers/homeController.js
@@ -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,
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/home/templates/connectionGroup.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/home/templates/connectionGroup.html b/guacamole/src/main/webapp/app/home/templates/connectionGroup.html
index 1fe1515..7356883 100644
--- a/guacamole/src/main/webapp/app/home/templates/connectionGroup.html
+++ b/guacamole/src/main/webapp/app/home/templates/connectionGroup.html
@@ -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>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/home/templates/home.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/home/templates/home.html b/guacamole/src/main/webapp/app/home/templates/home.html
index 7271945..f68a0a9 100644
--- a/guacamole/src/main/webapp/app/home/templates/home.html
+++ b/guacamole/src/main/webapp/app/home/templates/home.html
@@ -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>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/index/styles/lists.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/styles/lists.css b/guacamole/src/main/webapp/app/index/styles/lists.css
index 5ce162a..0c761ae 100644
--- a/guacamole/src/main/webapp/app/index/styles/lists.css
+++ b/guacamole/src/main/webapp/app/index/styles/lists.css
@@ -18,28 +18,28 @@
*/
.user,
-.group,
+.connection-group,
.connection {
cursor: pointer;
}
.user a,
.connection a,
-.group a {
+.connection-group a {
text-decoration:none;
color: black;
}
.user a:hover,
.connection a:hover,
-.group a:hover {
+.connection-group a:hover {
text-decoration:none;
color: black;
}
.user a:visited,
.connection a:visited,
-.group a:visited {
+.connection-group a:visited {
text-decoration:none;
color: black;
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/index/styles/ui.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/styles/ui.css b/guacamole/src/main/webapp/app/index/styles/ui.css
index 62db41f..434f443 100644
--- a/guacamole/src/main/webapp/app/index/styles/ui.css
+++ b/guacamole/src/main/webapp/app/index/styles/ui.css
@@ -178,11 +178,11 @@ div.section {
background-position: center center;
}
-.group > .caption .icon {
+.connection-group > .caption .icon {
background-image: url('images/folder-closed.png');
}
-.group.expanded > .caption .icon {
+.connection-group.expanded > .caption .icon {
background-image: url('images/folder-open.png');
}
@@ -213,7 +213,7 @@ div.section {
padding-left: 13px;
}
-.group.empty.balancer .icon {
+.connection-group.empty.balancer .icon {
background-image: url('images/protocol-icons/guac-monitor.png');
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/manage/templates/locationChooser.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/templates/locationChooser.html b/guacamole/src/main/webapp/app/manage/templates/locationChooser.html
index 57c957e..baeebde 100644
--- a/guacamole/src/main/webapp/app/manage/templates/locationChooser.html
+++ b/guacamole/src/main/webapp/app/manage/templates/locationChooser.html
@@ -9,7 +9,9 @@
context="groupListContext"
show-root-group="true"
connection-groups="rootGroups"
- connection-group-template="'app/manage/templates/locationChooserConnectionGroup.html'"/>
+ templates="{
+ 'connection-group' : 'app/manage/templates/locationChooserConnectionGroup.html'
+ }"/>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/manage/templates/manageUser.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/templates/manageUser.html b/guacamole/src/main/webapp/app/manage/templates/manageUser.html
index 82bc1e9..e32d725 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageUser.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageUser.html
@@ -78,9 +78,11 @@
<guac-group-list
context="groupListContext"
connection-groups="filteredRootGroups"
- connection-template="'app/manage/templates/connectionPermission.html'"
- sharing-profile-template="'app/manage/templates/sharingProfilePermission.html'"
- connection-group-template="'app/manage/templates/connectionGroupPermission.html'"
+ templates="{
+ 'connection' : 'app/manage/templates/connectionPermission.html',
+ 'sharing-profile' : 'app/manage/templates/sharingProfilePermission.html',
+ 'connection-group' : 'app/manage/templates/connectionGroupPermission.html'
+ }"
page-size="20"/>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/56d9c909/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html b/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
index ea1805b..d56993e 100644
--- a/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
+++ b/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
@@ -33,7 +33,9 @@
<guac-group-list
page-size="25"
connection-groups="filteredRootGroups"
- connection-template="'app/settings/templates/connection.html'"
- connection-group-template="'app/settings/templates/connectionGroup.html'"/>
+ templates="{
+ 'connection' : 'app/settings/templates/connection.html',
+ 'connection-group' : 'app/settings/templates/connectionGroup.html'
+ }"/>
</div>
</div>
[4/5] incubator-guacamole-client git commit: GUACAMOLE-5: Use
contextual actions to add connections and connection groups.
Posted by jm...@apache.org.
GUACAMOLE-5: Use contextual actions to add connections and connection groups.
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/5779274e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/5779274e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/5779274e
Branch: refs/heads/master
Commit: 5779274e257f0d05fee94aa52beb3017290ea2b8
Parents: 4c7af7e
Author: Michael Jumper <mj...@apache.org>
Authored: Sun Aug 7 23:41:09 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun Aug 7 23:41:09 2016 -0700
----------------------------------------------------------------------
.../controllers/manageConnectionController.js | 5 +-
.../manageConnectionGroupController.js | 4 +-
.../directives/guacSettingsConnections.js | 133 +++++++++++++++++--
.../app/settings/styles/connection-list.css | 34 +++++
.../app/settings/templates/newConnection.html | 3 +
.../settings/templates/newConnectionGroup.html | 3 +
.../settings/templates/settingsConnections.html | 8 +-
7 files changed, 174 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
index 0e21873..a911ab2 100644
--- a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
+++ b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionController.js
@@ -291,7 +291,10 @@ angular.module('manage').controller('manageConnectionController', ['$scope', '$i
// If we are creating a new connection, populate skeleton connection data
else {
- $scope.connection = new Connection({ protocol: 'vnc' });
+ $scope.connection = new Connection({
+ protocol : 'vnc',
+ parentIdentifier : $location.search().parent
+ });
$scope.historyEntryWrappers = [];
$scope.parameters = {};
}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
index d76b27a..0d0af59 100644
--- a/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
+++ b/guacamole/src/main/webapp/app/manage/controllers/manageConnectionGroupController.js
@@ -175,7 +175,9 @@ angular.module('manage').controller('manageConnectionGroupController', ['$scope'
// If we are creating a new connection group, populate skeleton connection group data
else
- $scope.connectionGroup = new ConnectionGroup();
+ $scope.connectionGroup = new ConnectionGroup({
+ parentIdentifier : $location.search().parent
+ });
/**
* Available connection group types, as translation string / internal value
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js b/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
index 1414f91..b174a8d 100644
--- a/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
+++ b/guacamole/src/main/webapp/app/settings/directives/guacSettingsConnections.js
@@ -35,6 +35,7 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
// Required types
var ConnectionGroup = $injector.get('ConnectionGroup');
+ var GroupListItem = $injector.get('GroupListItem');
var PermissionSet = $injector.get('PermissionSet');
// Required services
@@ -205,6 +206,112 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
};
+ /**
+ * Returns whether the current user can update the connection group
+ * having the given identifier within the current data source.
+ *
+ * @param {String} identifier
+ * The identifier of the connection group to check.
+ *
+ * @return {Boolean}
+ * true if the current user can update the connection group
+ * having the given identifier within the current data source,
+ * false otherwise.
+ */
+ $scope.canUpdateConnectionGroup = function canUpdateConnectionGroup(identifier) {
+
+ // Abort if permissions have not yet loaded
+ if (!$scope.permissions)
+ return false;
+
+ // Can update the connection if adminstrator or have explicit permission
+ if (PermissionSet.hasSystemPermission($scope.permissions, PermissionSet.SystemPermissionType.ADMINISTER)
+ || PermissionSet.hasConnectionGroupPermission($scope.permissions, PermissionSet.ObjectPermissionType.UPDATE, identifier))
+ return true;
+
+ // Current data sources does not allow the connection group to be updated
+ return false;
+
+ };
+
+ /**
+ * Adds connection-group-specific contextual actions to the given
+ * array of GroupListItems. Each contextual action will be
+ * represented by a new GroupListItem.
+ *
+ * @param {GroupListItem[]} items
+ * The array of GroupListItems to which new GroupListItems
+ * representing connection-group-specific contextual actions
+ * should be added.
+ *
+ * @param {GroupListItem} [parent]
+ * The GroupListItem representing the connection group which
+ * contains the given array of GroupListItems, if known.
+ */
+ var addConnectionGroupActions = function addConnectionGroupActions(items, parent) {
+
+ // Do nothing if we lack permission to modify the parent at all
+ if (parent && !$scope.canUpdateConnectionGroup(parent.identifier))
+ return;
+
+ // Add action for creating a child connection, if the user has
+ // permission to do so
+ if ($scope.canCreateConnections())
+ items.push(new GroupListItem({
+ type : 'new-connection',
+ dataSource : $scope.dataSource,
+ weight : 1,
+ wrappedItem : parent
+ }));
+
+ // Add action for creating a child connection group, if the user
+ // has permission to do so
+ if ($scope.canCreateConnectionGroups())
+ items.push(new GroupListItem({
+ type : 'new-connection-group',
+ dataSource : $scope.dataSource,
+ weight : 1,
+ wrappedItem : parent
+ }));
+
+ };
+
+ /**
+ * Decorates the given GroupListItem, including all descendants,
+ * adding contextual actions.
+ *
+ * @param {GroupListItem} item
+ * The GroupListItem which should be decorated with additional
+ * GroupListItems representing contextual actions.
+ */
+ var decorateItem = function decorateItem(item) {
+
+ // If the item is a connection group, add actions specific to
+ // connection groups
+ if (item.type === GroupListItem.Type.CONNECTION_GROUP)
+ addConnectionGroupActions(item.children, item);
+
+ // Decorate all children
+ angular.forEach(item.children, decorateItem);
+
+ };
+
+ /**
+ * Callback which decorates all items within the given array of
+ * GroupListItems, including their descendants, adding contextual
+ * actions.
+ *
+ * @param {GroupListItem[]} items
+ * The array of GroupListItems which should be decorated with
+ * additional GroupListItems representing contextual actions.
+ */
+ $scope.rootItemDecorator = function rootItemDecorator(items) {
+
+ // Decorate each root-level item
+ angular.forEach(items, decorateItem);
+
+ };
+
// Retrieve current permissions
permissionService.getPermissions($scope.dataSource, currentUsername)
.success(function permissionsRetrieved(permissions) {
@@ -219,19 +326,19 @@ angular.module('settings').directive('guacSettingsConnections', [function guacSe
if (!$scope.canManageConnections())
$location.path('/');
- });
-
- // Retrieve all connections for which we have UPDATE or DELETE permission
- dataSourceService.apply(
- connectionGroupService.getConnectionGroupTree,
- [$scope.dataSource],
- ConnectionGroup.ROOT_IDENTIFIER,
- [PermissionSet.ObjectPermissionType.UPDATE, PermissionSet.ObjectPermissionType.DELETE]
- )
- .then(function connectionGroupsReceived(rootGroups) {
- $scope.rootGroups = rootGroups;
- });
-
+ // Retrieve all connections for which we have UPDATE or DELETE permission
+ dataSourceService.apply(
+ connectionGroupService.getConnectionGroupTree,
+ [$scope.dataSource],
+ ConnectionGroup.ROOT_IDENTIFIER,
+ [PermissionSet.ObjectPermissionType.UPDATE, PermissionSet.ObjectPermissionType.DELETE]
+ )
+ .then(function connectionGroupsReceived(rootGroups) {
+ $scope.rootGroups = rootGroups;
+ });
+
+ }); // end retrieve permissions
+
}]
};
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/settings/styles/connection-list.css
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/styles/connection-list.css b/guacamole/src/main/webapp/app/settings/styles/connection-list.css
new file mode 100644
index 0000000..7bf3553
--- /dev/null
+++ b/guacamole/src/main/webapp/app/settings/styles/connection-list.css
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+.settings.connections .connection-list .new-connection,
+.settings.connections .connection-list .new-connection-group {
+ opacity: 0.5;
+ font-style: italic;
+}
+
+.settings.connections .connection-list .new-connection a,
+.settings.connections .connection-list .new-connection a:hover,
+.settings.connections .connection-list .new-connection a:visited,
+.settings.connections .connection-list .new-connection-group a,
+.settings.connections .connection-list .new-connection-group a:hover,
+.settings.connections .connection-list .new-connection-group a:visited {
+ text-decoration:none;
+ color: black;
+}
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/settings/templates/newConnection.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/newConnection.html b/guacamole/src/main/webapp/app/settings/templates/newConnection.html
new file mode 100644
index 0000000..e4debbe
--- /dev/null
+++ b/guacamole/src/main/webapp/app/settings/templates/newConnection.html
@@ -0,0 +1,3 @@
+<a ng-href="#/manage/{{item.dataSource}}/connections/?parent={{item.wrappedItem.identifier}}">
+ <span class="name">{{'SETTINGS_CONNECTIONS.ACTION_NEW_CONNECTION' | translate}}</span>
+</a>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/settings/templates/newConnectionGroup.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/newConnectionGroup.html b/guacamole/src/main/webapp/app/settings/templates/newConnectionGroup.html
new file mode 100644
index 0000000..c1d6bba
--- /dev/null
+++ b/guacamole/src/main/webapp/app/settings/templates/newConnectionGroup.html
@@ -0,0 +1,3 @@
+<a ng-href="#/manage/{{item.dataSource}}/connectionGroups/?parent={{item.wrappedItem.identifier}}">
+ <span class="name">{{'SETTINGS_CONNECTIONS.ACTION_NEW_CONNECTION_GROUP' | translate}}</span>
+</a>
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/5779274e/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html b/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
index d56993e..dfdf686 100644
--- a/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
+++ b/guacamole/src/main/webapp/app/settings/templates/settingsConnections.html
@@ -33,9 +33,15 @@
<guac-group-list
page-size="25"
connection-groups="filteredRootGroups"
+ decorator="rootItemDecorator"
templates="{
+
'connection' : 'app/settings/templates/connection.html',
- 'connection-group' : 'app/settings/templates/connectionGroup.html'
+ 'connection-group' : 'app/settings/templates/connectionGroup.html',
+
+ 'new-connection' : 'app/settings/templates/newConnection.html',
+ 'new-connection-group' : 'app/settings/templates/newConnectionGroup.html'
+
}"/>
</div>
</div>
[3/5] incubator-guacamole-client git commit: GUACAMOLE-5: Allow uses
of the guacGroupList directive to decorate any rendered GroupListItems.
Posted by jm...@apache.org.
GUACAMOLE-5: Allow uses of the guacGroupList directive to decorate any rendered GroupListItems.
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/4c7af7e6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/4c7af7e6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/4c7af7e6
Branch: refs/heads/master
Commit: 4c7af7e6922641fabc0946c7f29206aefce63cb2
Parents: 56d9c90
Author: Michael Jumper <mj...@apache.org>
Authored: Fri Aug 5 21:26:02 2016 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Sun Aug 7 23:10:25 2016 -0700
----------------------------------------------------------------------
.../app/groupList/directives/guacGroupList.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/4c7af7e6/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 3587be7..87adb49 100644
--- a/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
+++ b/guacamole/src/main/webapp/app/groupList/directives/guacGroupList.js
@@ -73,7 +73,18 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
*
* @type Number
*/
- pageSize : '='
+ pageSize : '=',
+
+ /**
+ * A callback which accepts an array of GroupListItems as its sole
+ * parameter. If provided, the callback will be invoked whenever an
+ * array of root-level GroupListItems is about to be rendered.
+ * Changes may be made by this function to that array or to the
+ * GroupListItems themselves.
+ *
+ * @type Function
+ */
+ decorator : '='
},
@@ -206,6 +217,10 @@ angular.module('groupList').directive('guacGroupList', [function guacGroupList()
}
+ // Invoke item decorator, if provided
+ if ($scope.decorator)
+ $scope.decorator($scope.rootItems);
+
});
/**