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/08/14 23:37:39 UTC

[07/12] guacamole-client git commit: GUACAMOLE-220: Do not display "X" for removing an identifier if the identifier cannot actually be edited.

GUACAMOLE-220: Do not display "X" for removing an identifier if the identifier cannot actually be edited.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/ca1db783
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/ca1db783
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/ca1db783

Branch: refs/heads/staging/1.0.0
Commit: ca1db7831bfc7b365f4bb84e2d0f9b082354162f
Parents: 0059121
Author: Michael Jumper <mj...@apache.org>
Authored: Tue Aug 7 13:05:09 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Aug 8 21:50:26 2018 -0700

----------------------------------------------------------------------
 .../app/manage/directives/identifierSetEditor.js | 19 +++++++++++++++++++
 .../manage/templates/identifierSetEditor.html    |  3 ++-
 2 files changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ca1db783/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js b/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js
index 4240901..d2936e7 100644
--- a/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js
+++ b/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js
@@ -118,6 +118,15 @@ angular.module('manage').directive('identifierSetEditor', ['$injector',
         $scope.identifierFlags = {};
 
         /**
+         * Map of identifiers to boolean flags indicating whether that
+         * identifier is editable. If an identifier is not editable, it will be
+         * absent from this map.
+         *
+         * @type Object.<String, Boolean>
+         */
+        $scope.isEditable = {};
+
+        /**
          * Adds the given identifier to the given sorted array of identifiers,
          * preserving the sorted order of the array. If the identifier is
          * already present, no change is made to the array. The given array
@@ -194,6 +203,16 @@ angular.module('manage').directive('identifierSetEditor', ['$injector',
 
         });
 
+        // An identifier is editable iff it is available to be added or removed
+        // from the identifier set being edited (iff it is within the
+        // identifiersAvailable array)
+        $scope.$watch('identifiersAvailable', function availableIdentifiersChanged(identifiers) {
+            $scope.isEditable = {};
+            angular.forEach(identifiers, function storeEditableIdentifier(identifier) {
+                $scope.isEditable[identifier] = true;
+            });
+        });
+
         /**
          * Notifies the controller that a change has been made to the flag
          * denoting presence/absence of a particular identifier within the

http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/ca1db783/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html
----------------------------------------------------------------------
diff --git a/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html b/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html
index 7f66088..72c235c 100644
--- a/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html
+++ b/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html
@@ -18,7 +18,8 @@
             <ul>
                 <li ng-repeat="identifier in identifiers | filter: filterString">
                     <label><img src="images/x-red.png" alt="Remove" class="remove"
-                                ng-click="removeIdentifier(identifier)"/><span class="identifier">{{ identifier }}</span>
+                                ng-click="removeIdentifier(identifier)"
+                                ng-show="isEditable[identifier]"/><span class="identifier">{{ identifier }}</span>
                     </label>
                 </li>
             </ul>