Fix bug in robots manager around adding a new robot and make the robots listing using bind once to reduce the number of listeners

This commit is contained in:
Joseph Schorr 2015-04-23 13:56:25 -04:00
parent 518419097f
commit b02b98def3
2 changed files with 21 additions and 16 deletions

View file

@ -42,10 +42,10 @@
<td class="options-col"></td>
</thead>
<tbody ng-repeat="robotInfo in robots | filter:robotFilter | orderBy:getShortenedRobotName">
<tbody ng-repeat="robotInfo in robots | filter:robotFilter | orderBy:getShortenedRobotName" bindonce>
<tr ng-class="robotInfo.showing_permissions ? 'open' : 'closed'">
<td class="caret-col hidden-xs" ng-if="(user || organization.is_admin) && Config.isNewLayout()">
<span ng-if="robotInfo.repositories.length > 0" ng-click="showPermissions(robotInfo)">
<td class="caret-col hidden-xs" bo-if="(user || organization.is_admin) && Config.isNewLayout()">
<span bo-if="robotInfo.repositories.length > 0" ng-click="showPermissions(robotInfo)">
<i class="fa"
ng-class="robotInfo.showing_permissions ? 'fa-caret-down' : 'fa-caret-right'"
data-title="View Permissions List" bs-tooltip></i>
@ -54,14 +54,15 @@
<td class="robot">
<i class="fa fa-wrench hidden-xs"></i>
<a ng-click="showRobot(robotInfo)">
<span class="prefix">{{ getPrefix(robotInfo.name) }}+</span>{{ getShortenedName(robotInfo.name) }}
<span class="prefix" bo-text="getPrefix(robotInfo.name) + '+'"></span>
<span bo-text="getShortenedName(robotInfo.name)"></span>
</a>
</td>
<td ng-if="organization && Config.isNewLayout()">
<span class="empty" ng-if="robotInfo.teams.length == 0">
<td bo-if="organization && Config.isNewLayout()">
<span class="empty" bo-if="robotInfo.teams.length == 0">
(Not a member of any team)
</span>
<span class="empty" ng-if="robotInfo.teams.length > 0">
<span class="empty" bo-if="robotInfo.teams.length > 0">
<span ng-repeat="team in robotInfo.teams"
data-title="Team {{ team.name }}" bs-tooltip>
<span class="anchor" is-text-only="!organization.admin" href="/organization/{{ organization.name }}/teams/{{ team.name }}">
@ -70,21 +71,23 @@
</span>
</span>
</td>
<td ng-if="Config.isNewLayout()">
<span class="empty" ng-if="robotInfo.repositories.length == 0">
<td bo-if="Config.isNewLayout()">
<span class="empty" bo-if="robotInfo.repositories.length == 0">
(No direct permissions on any repositories)
</span>
<span class="member-perm-summary" ng-if="robotInfo.repositories.length > 0">
<span class="member-perm-summary" bo-if="robotInfo.repositories.length > 0">
Direct Permissions on
<span class="anchor hidden-xs" href="javascript:void(0)" is-text-only="!organization.is_admin"
ng-click="showPermissions(robotInfo)">{{ robotInfo.repositories.length }}
<span ng-if="robotInfo.repositories.length == 1">repository</span>
<span ng-if="robotInfo.repositories.length > 1">repositories</span>
ng-click="showPermissions(robotInfo)">
<span bo-text="robotInfo.repositories.length"></span>
<span bo-if="robotInfo.repositories.length == 1">repository</span>
<span bo-if="robotInfo.repositories.length > 1">repositories</span>
</span>
<span class="visible-xs" href="javascript:void(0)">{{ robotInfo.repositories.length }}
<span ng-if="robotInfo.repositories.length == 1">repository</span>
<span ng-if="robotInfo.repositories.length > 1">repositories</span>
<span class="visible-xs" href="javascript:void(0)">
<span bo-text="robotInfo.repositories.length"></span>
<span bo-if="robotInfo.repositories.length == 1">repository</span>
<span bo-if="robotInfo.repositories.length > 1">repositories</span>
</span>
</span>
</td>

View file

@ -86,6 +86,8 @@ angular.module('quay').directive('robotsManager', function () {
CreateService.createRobotAccount(ApiService, !!$scope.organization, $scope.organization ? $scope.organization.name : '', name,
function(created) {
created.teams = [];
created.repositories = [];
$scope.robots.push(created);
});
};