Get the main repo page design working

This commit is contained in:
Joseph Schorr 2015-03-10 17:22:46 -07:00
parent 3d3c8ca198
commit 002dc083f2
18 changed files with 299 additions and 18 deletions

View file

@ -9,7 +9,8 @@ angular.module('quay').directive('repoPanelInfo', function () {
transclude: false,
restrict: 'C',
scope: {
'repository': '=repository'
'repository': '=repository',
'builds': '=builds'
},
controller: function($scope, $element, ApiService) {
$scope.updateDescription = function(content) {

View file

@ -10,7 +10,8 @@ angular.module('quay').directive('buildInfoBar', function () {
restrict: 'C',
scope: {
'build': '=build',
'showTime': '=showTime'
'showTime': '=showTime',
'hideId': '=hideId'
},
controller: function($scope, $element) {
}

View file

@ -0,0 +1,22 @@
/**
* An element which displays the status of a build as a mini-bar.
*/
angular.module('quay').directive('buildMiniStatus', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/build-mini-status.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {
'build': '=build'
},
controller: function($scope, $element) {
$scope.isBuilding = function(build) {
if (!build) { return true; }
return build.phase != 'complete' && build.phase != 'error';
};
}
};
return directiveDefinitionObject;
});

View file

@ -1,5 +1,5 @@
/**
* An element which displays the status of a build.
* DEPRECATED: An element which displays the status of a build.
*/
angular.module('quay').directive('buildStatus', function () {
var directiveDefinitionObject = {

View file

@ -13,12 +13,14 @@
}, ['old-layout']);
}]);
function RepoViewCtrl($scope, $routeParams, ApiService, UserService) {
function RepoViewCtrl($scope, $routeParams, ApiService, UserService, AngularPollChannel) {
$scope.namespace = $routeParams.namespace;
$scope.name = $routeParams.name;
$scope.logsShown = 0;
var buildPollChannel = null;
// Make sure we track the current user.
UserService.updateUserIn($scope);
@ -30,12 +32,32 @@
$scope.repositoryResource = ApiService.getRepoAsResource(params).get(function(repo) {
$scope.repository = repo;
$scope.setTag($routeParams.tag);
// Track builds.
buildPollChannel = AngularPollChannel.create($scope, loadRepositoryBuilds, 5000 /* 5s */);
buildPollChannel.start();
});
};
var loadRepositoryBuilds = function(callback) {
var params = {
'repository': $scope.namespace + '/' + $scope.name
};
var errorHandler = function() {
callback(false);
};
$scope.repositoryBuildsResource = ApiService.getRepoBuildsAsResource(params, /* background */true).get(function(resp) {
$scope.builds = resp.builds;
callback(false);
}, errorHandler);
};
// Load the repository.
loadRepository();
$scope.setTag = function(tagName) {
window.console.log('set tag')
};