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

View file

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