Prevent the entity search typeahead "no users found" message from being displayed when the entity is set from code

This commit is contained in:
Joseph Schorr 2014-04-01 19:33:11 -04:00
parent 93fd48d6b0
commit 2a72e91bdb

View file

@ -2728,7 +2728,7 @@ quayApp.directive('entitySearch', function () {
entity['is_org_member'] = true; entity['is_org_member'] = true;
} }
$scope.setEntityInternal(entity); $scope.setEntityInternal(entity, false);
}; };
$scope.clearEntityInternal = function() { $scope.clearEntityInternal = function() {
@ -2738,8 +2738,12 @@ quayApp.directive('entitySearch', function () {
} }
}; };
$scope.setEntityInternal = function(entity) { $scope.setEntityInternal = function(entity, updateTypeahead) {
$(input).typeahead('val', $scope.isPersistent ? entity.name : ''); if (updateTypeahead) {
$(input).typeahead('val', $scope.isPersistent ? entity.name : '');
} else {
$(input).val($scope.isPersistent ? entity.name : '');
}
if ($scope.isPersistent) { if ($scope.isPersistent) {
$scope.currentEntity = entity; $scope.currentEntity = entity;
@ -2854,7 +2858,7 @@ quayApp.directive('entitySearch', function () {
$(input).on('typeahead:selected', function(e, datum) { $(input).on('typeahead:selected', function(e, datum) {
$scope.$apply(function() { $scope.$apply(function() {
$scope.setEntityInternal(datum.entity); $scope.setEntityInternal(datum.entity, true);
}); });
}); });