UI improvements to entity-search and the create-external-notification-dialog

This commit is contained in:
Joseph Schorr 2014-07-18 16:51:05 -04:00
parent 752efb9e0f
commit d5d9cb7a45
3 changed files with 37 additions and 3 deletions

View file

@ -17,7 +17,7 @@
<td style="width: 120px">When this occurs:</td>
<td>
<div class="dropdown-select" placeholder="'(Notification Event)'" selected-item="currentEvent.title"
handle-item-selected="handleEventSelected(datum)">
handle-item-selected="handleEventSelected(datum)" clear-value="clearCounter">
<!-- Icons -->
<i class="dropdown-select-icon fa fa-lg" ng-class="currentEvent.icon"></i>
@ -37,7 +37,7 @@
<td>Then issue a:</td>
<td>
<div class="dropdown-select" placeholder="'(Notification Action)'" selected-item="currentMethod.title"
handle-item-selected="handleMethodSelected(datum)">
handle-item-selected="handleMethodSelected(datum)" clear-value="clearCounter">
<!-- Icons -->
<i class="dropdown-select-icon fa fa-lg" ng-class="currentMethod.icon"></i>

View file

@ -11,6 +11,29 @@
<li role="presentation" class="dropdown-header" ng-show="!lazyLoading && !robots && !isAdmin && !teams">
You do not have permission to manage teams and robots for this organization
</li>
<li role="presentation" class="dropdown-header"
ng-show="!lazyLoading && !teams.length && !robots.length && !((includeTeams && isOrganization && isAdmin) || (includeRobots && isAdmin))">
<span ng-if="includeRobots && includeTeams && isOrganization">
No robot accounts or teams found
</span>
<span ng-if="!includeRobots && includeTeams && isOrganization">
No teams found
</span>
<span ng-if="includeRobots && !includeTeams && isOrganization">
No robot accounts found
</span>
<span ng-if="!includeRobots && !includeTeams && isOrganization">
Robot accounts and teams are not permitted
</span>
<span ng-if="includeRobots && !isOrganization">
No robot accounts found
</span>
<span ng-if="!includeRobots && !isOrganization">
Robot accounts are not permitted
</span>
</li>
<li role="presentation" ng-repeat="team in teams" ng-show="!lazyLoading"
ng-click="setEntity(team.name, 'team', false)">

View file

@ -3985,7 +3985,9 @@ quayApp.directive('dropdownSelect', function ($compile) {
'placeholder': '=placeholder',
'lookaheadItems': '=lookaheadItems',
'handleItemSelected': '&handleItemSelected',
'handleInput': '&handleInput'
'handleInput': '&handleInput',
'clearValue': '=clearValue'
},
controller: function($scope, $element, $rootScope) {
if (!$rootScope.__dropdownSelectCounter) {
@ -3998,6 +4000,13 @@ quayApp.directive('dropdownSelect', function ($compile) {
// Setup lookahead.
var input = $($element).find('.lookahead-input');
$scope.$watch('clearValue', function(cv) {
if (cv) {
$scope.selectedItem = null;
$(input).val('');
}
});
$scope.$watch('selectedItem', function(item) {
if ($scope.selectedItem == $scope.internalItem) {
// The item has already been set due to an internal action.
@ -4743,6 +4752,7 @@ quayApp.directive('createExternalNotificationDialog', function () {
$scope.currentMethod = null;
$scope.creating = false;
$scope.currentConfig = {};
$scope.clearCounter = 0;
$scope.events = ExternalNotificationData.getSupportedEvents();
$scope.methods = ExternalNotificationData.getSupportedMethods();
@ -4777,6 +4787,7 @@ quayApp.directive('createExternalNotificationDialog', function () {
$scope.$watch('counter', function(counter) {
if (counter) {
$scope.clearCounter++;
$scope.creating = false;
$scope.currentEvent = null;
$scope.currentMethod = null;