You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/04/30 21:41:02 UTC
[1/3] guacamole-client git commit: GUACAMOLE-526: Use toArray where
necessary for orderBy.
Repository: guacamole-client
Updated Branches:
refs/heads/master d22f065fe -> 8181a9606
GUACAMOLE-526: Use toArray where necessary for orderBy.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/ae6994a9
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/ae6994a9
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/ae6994a9
Branch: refs/heads/master
Commit: ae6994a9124a57aebc16cfc8b4018048c8a64bcd
Parents: f7ca11d
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Apr 30 13:37:09 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Apr 30 13:45:36 2018 -0700
----------------------------------------------------------------------
guacamole/src/main/webapp/app/client/templates/client.html | 6 +++---
.../src/main/webapp/app/form/templates/timeZoneField.html | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ae6994a9/guacamole/src/main/webapp/app/client/templates/client.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/client/templates/client.html b/guacamole/src/main/webapp/app/client/templates/client.html
index 0d2b688..8468218 100644
--- a/guacamole/src/main/webapp/app/client/templates/client.html
+++ b/guacamole/src/main/webapp/app/client/templates/client.html
@@ -64,9 +64,9 @@
translate="CLIENT.HELP_SHARE_LINK"
translate-values="{LINKS : getShareLinkCount()}"></p>
<table>
- <tr ng-repeat="link in client.shareLinks | orderBy: name">
- <th>{{link.name}}</th>
- <td><a href="{{link.href}}" target="_blank">{{link.href}}</a></td>
+ <tr ng-repeat="link in client.shareLinks | toArray | orderBy: value.name">
+ <th>{{link.value.name}}</th>
+ <td><a href="{{link.value.href}}" target="_blank">{{link.value.href}}</a></td>
</tr>
</table>
</div>
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ae6994a9/guacamole/src/main/webapp/app/form/templates/timeZoneField.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/form/templates/timeZoneField.html b/guacamole/src/main/webapp/app/form/templates/timeZoneField.html
index e5db1b8..15fd4d6 100644
--- a/guacamole/src/main/webapp/app/form/templates/timeZoneField.html
+++ b/guacamole/src/main/webapp/app/form/templates/timeZoneField.html
@@ -9,6 +9,6 @@
<select class="time-zone"
ng-disabled="!region"
ng-model="model"
- ng-options="name for (name, value) in timeZones[region] | orderBy: name"></select>
+ ng-options="timeZone.value as timeZone.key for timeZone in timeZones[region] | toArray | orderBy: key"></select>
</div>
[3/3] guacamole-client git commit: GUACAMOLE-526: Merge use toArray
as necessary for orderBy.
Posted by vn...@apache.org.
GUACAMOLE-526: Merge use toArray as necessary for orderBy.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/8181a960
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/8181a960
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/8181a960
Branch: refs/heads/master
Commit: 8181a96060a8da4d6acc079ab37f8e3ccb415bdb
Parents: d22f065 ae6994a
Author: Nick Couchman <vn...@apache.org>
Authored: Mon Apr 30 17:40:15 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Mon Apr 30 17:40:15 2018 -0400
----------------------------------------------------------------------
.../webapp/app/client/templates/client.html | 6 +--
.../app/form/templates/timeZoneField.html | 2 +-
.../webapp/app/index/filters/arrayFilter.js | 50 ++++++++++++++++++--
.../app/manage/templates/manageConnection.html | 2 +-
4 files changed, 51 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[2/3] guacamole-client git commit: GUACAMOLE-526: Provide key/value
pairs via toArray filter. Consistently return same array for same object.
Posted by vn...@apache.org.
GUACAMOLE-526: Provide key/value pairs via toArray filter. Consistently return same array for same object.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/f7ca11df
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/f7ca11df
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/f7ca11df
Branch: refs/heads/master
Commit: f7ca11df50c217d0c845897bccdbbc24563b9b51
Parents: d22f065
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Apr 30 12:42:07 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Apr 30 13:45:36 2018 -0700
----------------------------------------------------------------------
.../webapp/app/index/filters/arrayFilter.js | 50 ++++++++++++++++++--
.../app/manage/templates/manageConnection.html | 2 +-
2 files changed, 47 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f7ca11df/guacamole/src/main/webapp/app/index/filters/arrayFilter.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/index/filters/arrayFilter.js b/guacamole/src/main/webapp/app/index/filters/arrayFilter.js
index d3a5df2..8612953 100644
--- a/guacamole/src/main/webapp/app/index/filters/arrayFilter.js
+++ b/guacamole/src/main/webapp/app/index/filters/arrayFilter.js
@@ -19,20 +19,62 @@
/**
* A filter for transforming an object into an array of all non-inherited
- * property values.
+ * property key/value pairs. The resulting array contains one object for each
+ * property in the original object, where the "key" property contains the
+ * original property key and the "value" property contains the original
+ * property value.
*/
angular.module('index').filter('toArray', [function toArrayFactory() {
- return function toArrayFiter(input) {
+ /**
+ * The name of the property to use to store the cached result of converting
+ * an object to an array. This property is added to each object converted,
+ * such that the same array is returned each time unless the original
+ * object has changed.
+ *
+ * @type String
+ */
+ var CACHE_KEY = '_guac_toArray';
+
+ return function toArrayFilter(input) {
// If no object is available, just return an empty array
if (!input) {
return [];
}
- return Object.keys(input).map(function fetchValueByKey(key) {
- return input[key];
+ // Translate object into array of key/value pairs
+ var array = [];
+ angular.forEach(input, function fetchValueByKey(value, key) {
+ array.push({
+ key : key,
+ value : value
+ });
+ });
+
+ // Sort consistently by key
+ array.sort(function compareKeys(a, b) {
+ if (a.key < b.key) return -1;
+ if (a.key > b.key) return 1;
+ return 0;
});
+
+ // Define non-enumerable property for holding cached array
+ if (!input[CACHE_KEY]) {
+ Object.defineProperty(input, CACHE_KEY, {
+ value : [],
+ enumerable : false,
+ configurable : true,
+ writable : true
+ });
+ }
+
+ // Update cache if resulting array is different
+ if (!angular.equals(input[CACHE_KEY], array))
+ input[CACHE_KEY] = array;
+
+ return input[CACHE_KEY];
+
};
}]);
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/f7ca11df/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/templates/manageConnection.html b/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
index 112f715..ed10335 100644
--- a/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
+++ b/guacamole/src/main/webapp/app/manage/templates/manageConnection.html
@@ -32,7 +32,7 @@
<tr>
<th>{{'MANAGE_CONNECTION.FIELD_HEADER_PROTOCOL' | translate}}</th>
<td>
- <select ng-model="connection.protocol" ng-options="protocol.name as getProtocolName(protocol.name) | translate for protocol in protocols | toArray | orderBy: name"></select>
+ <select ng-model="connection.protocol" ng-options="protocol.value.name as getProtocolName(protocol.value.name) | translate for protocol in protocols | toArray | orderBy: value.name"></select>
</td>
</tr>
</table>