Make robot accounts filter rather than display the dialog when "showRobot" is passed to the manager

This commit is contained in:
Joseph Schorr 2015-04-20 13:11:21 -04:00
parent ecf1135dcd
commit 72abd80f08
5 changed files with 47 additions and 4 deletions

View file

@ -0,0 +1,17 @@
.filter-box {
display: block;
text-align: right;
margin-top: 20px;
margin-bottom: 26px;
}
.filter-box .form-control {
max-width: 300px;
display: inline-block;
}
.filter-box .filter-message {
display: inline-block;
margin-right: 10px;
color: #ccc;
}

View file

@ -0,0 +1,6 @@
<div class="filter-box-element" ng-show="collection.length">
<span class="filter-message" ng-if="filterModel">
Showing {{ (collection|filter:filterModel).length }} of {{ collection.length }} {{ filterName }}
</span>
<input class="form-control" type="text" ng-model="filterModel" placeholder="Filter {{ filterName }}...">
</div>

View file

@ -19,9 +19,8 @@
be shared, such as deployment systems.
</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="filter-box" collection="robots" filter-model="robotFilter"
filter-name="Robot Accounts"></div>
<div class="empty" ng-if="!robots.length">
<div class="empty-primary-msg">No robot accounts defined.</div>

View file

@ -0,0 +1,21 @@
/**
* An element which displays a right-aligned control bar with an <input> for filtering a collection.
*/
angular.module('quay').directive('filterBox', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/filter-box.html',
replace: false,
transclude: true,
restrict: 'C',
scope: {
'collection': '=collection',
'filterModel': '=filterModel',
'filterName': '@filterName'
},
controller: function($scope, $element) {
}
};
return directiveDefinitionObject;
});

View file

@ -118,7 +118,7 @@ angular.module('quay').directive('robotsManager', function () {
if ($routeParams.showRobot) {
var index = $scope.findRobotIndexByName($routeParams.showRobot);
if (index >= 0) {
$scope.showRobot($scope.robots[index]);
$scope.robotFilter = $routeParams.showRobot;
}
}
});