Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,7 @@ footer img {
.css-form input.ng-valid.ng-dirty {
background-color: #78FA89;
}

.caret{
cursor: pointer;
}
35 changes: 29 additions & 6 deletions app/tag/tag-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ angular.module('tag-controller', ['registry-services'])
if(! $scope.tagsCurrentPage){
$scope.tagsCurrentPage = 1;
}else{
$scope.tagsCurrentPage = parseInt($scope.tagsCurrentPage)
$scope.tagsCurrentPage = parseInt($scope.tagsCurrentPage)
if($scope.tagsCurrentPage > $scope.maxTagsPage || $scope.tagsCurrentPage < 1){
$scope.tagsCurrentPage = 1;
$scope.tagsCurrentPage = 1;
}
}
// Select wanted tags
// Select wanted tags
var idxShift = 0;
$scope.displayedTags = $scope.tags;
if($scope.tagsPerPage){
Expand All @@ -57,13 +57,13 @@ angular.module('tag-controller', ['registry-services'])
}
}
});





// Copy collection for rendering in a smart-table
$scope.displayedTags = [].concat($scope.tags);


// selected tags
$scope.selection = [];

Expand All @@ -72,6 +72,29 @@ angular.module('tag-controller', ['registry-services'])
return filterFilter($scope.displayedTags, { selected: true });
};

// sort tags
$scope.orderByCreated = true;

function compare(a, b){
var at = new Date(a.details.created),
bt = new Date(b.details.created);

return at.getTime() - bt.getTime();
}

$scope.sortTags = function(){
if($scope.orderByCreated){
$scope.displayedTags.sort(compare);
}
else{
// if $scope.orderByCreated is false, that means $scope.displayedTags.sort(compare) has been invoked.
// then just need to call reverse() function
$scope.displayedTags.reverse();
}

$scope.orderByCreated = !$scope.orderByCreated;
}

$scope.openConfirmTagDeletionDialog = function(size) {
var modalInstance = $modal.open({
animation: true,
Expand Down
6 changes: 5 additions & 1 deletion app/tag/tag-list-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
<tr>
<th ng-class="{strike: deleted}"><span class="glyphicon glyphicon-tag"></span> Tag</th>
<th ><span class="glyphicon glyphicon-qrcode"></span> Image ID</th>
<th ><span class="glyphicon glyphicon-calendar"></span> Created</th>
<th ng-click="sortTags()" ng-class="{dropup: orderByCreated==true, dropdown: orderByCreated==false}">
<span class="glyphicon glyphicon-calendar"></span>
Created
<span class="caret"></span>
</th>
<th ><span class="glyphicon glyphicon-user"></span> Author</th>
<th ><span class="glyphicon glyphicon-eye-open"></span> Docker version</th>
<!-- <th ><span class="glyphicon glyphicon-arrow-up"></span> Parent's ID</th> -->
Expand Down