Nicer handling of robots: sort the robots by name and add a filtering box

This commit is contained in:
Joseph Schorr 2015-04-09 15:03:07 -04:00
parent 0be0aed17d
commit c2e4cbe95b
3 changed files with 23 additions and 2 deletions

View file

@ -78,3 +78,9 @@
.robots-manager-element .member-perm-summary { .robots-manager-element .member-perm-summary {
margin-right: 14px; margin-right: 14px;
} }
.robots-manager-element .co-filter-box {
float: right;
min-width: 175px;
margin-bottom: 10px;
}

View file

@ -19,6 +19,10 @@
be shared, such as deployment systems. be shared, such as deployment systems.
</div> </div>
<span class="co-filter-box" ng-show="robots.length">
<input class="form-control" type="text" ng-model="robotFilter" placeholder="Filter Robot Accounts...">
</span>
<div class="empty" ng-if="!robots.length"> <div class="empty" ng-if="!robots.length">
<div class="empty-primary-msg">No robot accounts defined.</div> <div class="empty-primary-msg">No robot accounts defined.</div>
<div class="empty-secondary-msg"> <div class="empty-secondary-msg">
@ -26,7 +30,14 @@
</div> </div>
</div> </div>
<table class="co-table" ng-if="robots.length"> <div class="empty" ng-if="robots.length && !(robots | filter:robotFilter).length">
<div class="empty-primary-msg">No robot accounts found matching filter.</div>
<div class="empty-secondary-msg">
Please change your filter to display robot accounts.
</div>
</div>
<table class="co-table" ng-if="(robots | filter:robotFilter).length">
<thead> <thead>
<td class="caret-col" ng-if="(user || organization.is_admin) && Config.isNewLayout()"></td> <td class="caret-col" ng-if="(user || organization.is_admin) && Config.isNewLayout()"></td>
<td>Robot Account Name</td> <td>Robot Account Name</td>
@ -35,7 +46,7 @@
<td class="options-col"></td> <td class="options-col"></td>
</thead> </thead>
<tbody ng-repeat="robotInfo in robots"> <tbody ng-repeat="robotInfo in robots | filter:robotFilter | orderBy:getShortenedRobotName">
<tr ng-class="robotInfo.showing_permissions ? 'open' : 'closed'"> <tr ng-class="robotInfo.showing_permissions ? 'open' : 'closed'">
<td class="caret-col" ng-if="(user || organization.is_admin) && Config.isNewLayout()"> <td class="caret-col" ng-if="(user || organization.is_admin) && Config.isNewLayout()">
<span ng-if="robotInfo.repositories.length > 0" ng-click="showPermissions(robotInfo)"> <span ng-if="robotInfo.repositories.length > 0" ng-click="showPermissions(robotInfo)">

View file

@ -73,6 +73,10 @@ angular.module('quay').directive('robotsManager', function () {
return -1; return -1;
}; };
$scope.getShortenedRobotName = function(info) {
return $scope.getShortenedName(info.name);
};
$scope.getShortenedName = function(name) { $scope.getShortenedName = function(name) {
var plus = name.indexOf('+'); var plus = name.indexOf('+');
return name.substr(plus + 1); return name.substr(plus + 1);