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:
Joseph Schorr 2013-09-27 17:01:45 -04:00
parent 94cba8a0bc
commit bf926aceee
5 changed files with 89 additions and 16 deletions

View file

@ -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;