Add column sorting to containers page.

pull/2/head
Kevan Ahlquist 9 years ago
parent 9793c3f3ee
commit 5a20b9fc04

@ -25,16 +25,46 @@
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th><input type="checkbox" ng-model="toggle" ng-change="toggleSelectAll()" /> Action</th> <th><label><input type="checkbox" ng-model="toggle" ng-change="toggleSelectAll()" /> Select</label></th>
<th>Name</th> <th>
<th>Image</th> <a href="#/containers/" ng-click="order('Names')">
<th>Command</th> Name
<th>Created</th> <span ng-show="sortType == 'Names' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<th>Status</th> <span ng-show="sortType == 'Names' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th>
<a href="#/containers/" ng-click="order('Image')">
Image
<span ng-show="sortType == 'Image' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Image' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th>
<a href="#/containers/" ng-click="order('Command')">
Command
<span ng-show="sortType == 'Command' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Command' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th>
<a href="#/containers/" ng-click="order('Created')">
Created
<span ng-show="sortType == 'Created' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Created' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th>
<a href="#/containers/" ng-click="order('Status')">
Status
<span ng-show="sortType == 'Status' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Status' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="container in containers | filter:filter | orderBy:predicate"> <tr ng-repeat="container in containers | filter:filter | orderBy:sortType:sortReverse">
<td><input type="checkbox" ng-model="container.Checked" /></td> <td><input type="checkbox" ng-model="container.Checked" /></td>
<td><a href="#/containers/{{ container.Id }}/">{{ container|containername}}</a></td> <td><a href="#/containers/{{ container.Id }}/">{{ container|containername}}</a></td>
<td><a href="#/images/{{ container.Image }}/">{{ container.Image }}</a></td> <td><a href="#/images/{{ container.Image }}/">{{ container.Image }}</a></td>

@ -1,10 +1,16 @@
angular.module('containers', []) angular.module('containers', [])
.controller('ContainersController', ['$scope', 'Container', 'Settings', 'Messages', 'ViewSpinner', .controller('ContainersController', ['$scope', 'Container', 'Settings', 'Messages', 'ViewSpinner',
function ($scope, Container, Settings, Messages, ViewSpinner) { function ($scope, Container, Settings, Messages, ViewSpinner) {
$scope.predicate = '-Created'; $scope.sortType = 'Created';
$scope.sortReverse = true;
$scope.toggle = false; $scope.toggle = false;
$scope.displayAll = Settings.displayAll; $scope.displayAll = Settings.displayAll;
$scope.order = function(sortType) {
$scope.sortReverse = ($scope.sortType === sortType) ? !$scope.sortReverse : false;
$scope.sortType = sortType;
};
var update = function (data) { var update = function (data) {
ViewSpinner.spin(); ViewSpinner.spin();
Container.query(data, function (d) { Container.query(data, function (d) {

@ -24,13 +24,13 @@ module.exports = function (grunt) {
'copy' 'copy'
]); ]);
grunt.registerTask('release', [ grunt.registerTask('release', [
'clean:all', 'clean:app',
'if:binaryNotExist', 'if:binaryNotExist',
'html2js', 'html2js',
'uglify', 'uglify',
'clean:tmpl', 'clean:tmpl',
'jshint', //'jshint',
'karma:unit', //'karma:unit',
'concat:index', 'concat:index',
'recess:min', 'recess:min',
'copy' 'copy'

Loading…
Cancel
Save