Refactor the entity-search directive/control to make its interface much cleaner and to add support for ng-model validity checking

This commit is contained in:
Joseph Schorr 2014-07-18 13:45:08 -04:00
parent df7b8d651c
commit 3865e3b1b7
8 changed files with 234 additions and 155 deletions

View file

@ -62,6 +62,12 @@
<input type="email" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="email" required>
<input type="url" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="url" required>
<input type="text" class="form-control" ng-model="currentConfig[field.name]" ng-switch-when="string" required>
<div class="entity-search" namespace="repository.namespace"
placeholder="''"
current-entity="currentConfig[field.name]"
ng-model="currentConfig[field.name]"
allowed-entities="['user', 'team']"
ng-switch-when="entity">
</div>
</td>
</tr>

View file

@ -1,5 +1,5 @@
<span class="entity-search-element" ng-class="isPersistent ? 'persistent' : ''"><input class="entity-search-control form-control">
<span class="entity-reference block-reference" ng-show="isPersistent && currentEntityInternal" entity="currentEntityInternal"></span>
<span class="entity-search-element" ng-class="autoClear ? '' : 'persistent'"><input class="entity-search-control form-control">
<span class="entity-reference block-reference" ng-show="!autoClear && currentEntityInternal" entity="currentEntityInternal"></span>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="entityDropdownMenu" data-toggle="dropdown"
ng-click="lazyLoad()">
@ -34,7 +34,7 @@
<i class="fa fa-group"></i> Create team
</a>
</li>
<li role="presentation" ng-show="!lazyLoading && isAdmin">
<li role="presentation" ng-show="includeRobots && !lazyLoading && isAdmin">
<a role="menuitem" class="new-action" tabindex="-1" href="javascript:void(0)" ng-click="createRobot()">
<i class="fa fa-wrench"></i>
Create robot account

View file

@ -83,9 +83,11 @@
<tr ng-show="!newForWholeOrg">
<td>Repository Creator:</td>
<td>
<span class="entity-search" namespace="organization.name" input-title="'User/Robot'"
is-organization="true" include-teams="false" current-entity="activatingForNew" is-persistent="true"
clear-now="clearCounter">
<span class="entity-search" namespace="organization.name"
placeholder="'User/Robot'"
allowed-entities="['user', 'robot']"
current-entity="activatingForNew"
clear-value="clearCounter">
</span>
</td>
</tr>
@ -98,9 +100,9 @@
<tr>
<td>Applied To:</td>
<td>
<span class="entity-search" namespace="organization.name" input-title="'User/Robot/Team'"
is-organization="true" include-teams="true" current-entity="delegateForNew" is-persistent="true"
clear-now="clearCounter">
<span class="entity-search" namespace="organization.name" placeholder="'User/Robot/Team'"
current-entity="delegateForNew"
clear-value="clearCounter">
</span>
</td>
</tr>

View file

@ -71,12 +71,10 @@
<td>
</td>
<td>
<div class="entity-search" namespace="repository.namespace" include-teams="false"
input-title="'Select robot account for pulling...'"
is-organization="repository.is_organization"
is-persistent="true"
<div class="entity-search" namespace="repository.namespace"
placeholder="'Select robot account for pulling...'"
current-entity="pullEntity"
filter="['robot']"></div>
allowed-entities="['robot']"></div>
<div class="alert alert-info" ng-if="pullRequirements.robots.length" style="margin-top: 20px; margin-bottom: 0px;">
Note: We've automatically selected robot account <span class="entity-reference" entity="pullRequirements.robots[0]"></span>, since it has access to the Quay.io repository.