Get the tabs working and the UI for the image history. Note that the model changes for the image history are WRONG and need to be fixed
This commit is contained in:
parent
94cba8a0bc
commit
bf926aceee
5 changed files with 89 additions and 16 deletions
|
@ -182,11 +182,15 @@ p.editable:hover i {
|
|||
min-width: 300px;
|
||||
}
|
||||
|
||||
.repo-admin thead td {
|
||||
.repo thead td {
|
||||
padding: 4px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.repo-admin td {
|
||||
.repo td {
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.repo .images {
|
||||
margin: 10px;
|
||||
}
|
|
@ -16,8 +16,24 @@ function LandingCtrl($scope) {
|
|||
}
|
||||
|
||||
function RepoCtrl($scope, Restangular, $routeParams, $rootScope) {
|
||||
var tabs = ['current-image', 'image-history'];
|
||||
|
||||
$rootScope.title = 'Loading...';
|
||||
|
||||
$scope.showTab = function(tabName) {
|
||||
for (var i = 0; i < tabs.length; ++i) {
|
||||
$('#' + tabs[i]).hide();
|
||||
$('#' + tabs[i] + '-tab').removeClass('active');
|
||||
}
|
||||
|
||||
$('#' + tabName).show();
|
||||
$('#' + tabName + '-tab').addClass('active');
|
||||
|
||||
if (tabName == 'image-history') {
|
||||
$scope.listImages();
|
||||
}
|
||||
};
|
||||
|
||||
$scope.editDescription = function() {
|
||||
if (!$scope.repo.can_write) { return; }
|
||||
$('#descriptionEdit')[0].value = $scope.repo.description || '';
|
||||
|
@ -33,6 +49,15 @@ function RepoCtrl($scope, Restangular, $routeParams, $rootScope) {
|
|||
$scope.parseDate = function(dateString) {
|
||||
return Date.parse(dateString);
|
||||
};
|
||||
|
||||
$scope.listImages = function() {
|
||||
if ($scope.imageHistory) { return; }
|
||||
|
||||
var imageFetch = Restangular.one('repository/' + namespace + '/' + name + '/tag/' + $scope.currentTag.name + '/images');
|
||||
imageFetch.get().then(function(resp) {
|
||||
$scope.imageHistory = resp.images;
|
||||
});
|
||||
};
|
||||
|
||||
var namespace = $routeParams.namespace;
|
||||
var name = $routeParams.name;
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
</ul>
|
||||
</span>
|
||||
</li>
|
||||
<li class="active"><a href="javascript:void(0)">Current Image</a></li>
|
||||
<li><a href="javascript:void(0)">Image History</a></li>
|
||||
<li id="current-image-tab" class="active" ng-click="showTab('current-image')"><a href="javascript:void(0)">Current Image</a></li>
|
||||
<li id="image-history-tab" ng-click="showTab('image-history')"><a href="javascript:void(0)">Image History</a></li>
|
||||
</ul>
|
||||
|
||||
<div id="current-image">
|
||||
|
@ -73,6 +73,30 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="image-history" style="display: none">
|
||||
<div ng-hide="imageHistory">
|
||||
Loading images...
|
||||
</div>
|
||||
|
||||
<div ng-show="imageHistory">
|
||||
<table class="images">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Created</td>
|
||||
<td>Comment</td>
|
||||
<td>ID</td>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tr ng-repeat="image in imageHistory">
|
||||
<td><span am-time-ago="parseDate(image.created)"></span></td>
|
||||
<td>{{ image.comment }}</td>
|
||||
<td>{{ image.id }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal edit for the description -->
|
||||
<div class="modal fade" id="editModal">
|
||||
<div class="modal-dialog">
|
||||
|
|
Reference in a new issue