mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-220: Do not display "X" for removing an identifier if the identifier cannot actually be edited.
This commit is contained in:
@@ -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.<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
|
||||
@@ -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
|
||||
|
@@ -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>
|
||||
|
Reference in New Issue
Block a user