From ca1db7831bfc7b365f4bb84e2d0f9b082354162f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Tue, 7 Aug 2018 13:05:09 -0700 Subject: [PATCH] GUACAMOLE-220: Do not display "X" for removing an identifier if the identifier cannot actually be edited. --- .../manage/directives/identifierSetEditor.js | 19 +++++++++++++++++++ .../manage/templates/identifierSetEditor.html | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js b/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js index 4240901b9..d2936e7b9 100644 --- a/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js +++ b/guacamole/src/main/webapp/app/manage/directives/identifierSetEditor.js @@ -117,6 +117,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. + */ + $scope.isEditable = {}; + /** * Adds the given identifier to the given sorted array of identifiers, * preserving the sorted order of the array. If the identifier is @@ -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 diff --git a/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html b/guacamole/src/main/webapp/app/manage/templates/identifierSetEditor.html index 7f660883d..72c235c66 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 @@