2015-02-26 22:45:28 +00:00
|
|
|
(function() {
|
|
|
|
/**
|
|
|
|
* Build view page. Displays the view of a particular build for a repository.
|
|
|
|
*/
|
|
|
|
angular.module('quayPages').config(['pages', function(pages) {
|
|
|
|
pages.create('build-view', 'build-view.html', BuildViewCtrl, {
|
2015-02-27 21:52:56 +00:00
|
|
|
newLayout: true,
|
|
|
|
title: 'Build {{ build.display_name }}',
|
|
|
|
description: 'Logs and status for build {{ build.display_name }}'
|
2015-02-26 22:45:28 +00:00
|
|
|
});
|
|
|
|
}]);
|
|
|
|
|
2017-05-05 19:10:06 +00:00
|
|
|
function BuildViewCtrl($scope, ApiService, $routeParams, AngularPollChannel, CookieService, $location) {
|
2015-02-26 22:45:28 +00:00
|
|
|
$scope.namespace = $routeParams.namespace;
|
|
|
|
$scope.name = $routeParams.name;
|
|
|
|
$scope.build_uuid = $routeParams.buildid;
|
|
|
|
|
2017-05-17 03:59:14 +00:00
|
|
|
if (!CookieService.get('quay.showBuildLogTimestamps')) {
|
|
|
|
$scope.showLogTimestamps = true;
|
|
|
|
} else {
|
|
|
|
$scope.showLogTimestamps = CookieService.get('quay.showBuildLogTimestamps') == 'true';
|
|
|
|
}
|
2015-02-27 21:00:32 +00:00
|
|
|
|
2015-02-26 22:45:28 +00:00
|
|
|
var loadBuild = function() {
|
|
|
|
var params = {
|
|
|
|
'repository': $scope.namespace + '/' + $scope.name,
|
|
|
|
'build_uuid': $scope.build_uuid
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.buildResource = ApiService.getRepoBuildAsResource(params).get(function(build) {
|
|
|
|
$scope.build = build;
|
|
|
|
$scope.originalBuild = build;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var loadRepository = function() {
|
|
|
|
var params = {
|
|
|
|
'repository': $scope.namespace + '/' + $scope.name
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.repoResource = ApiService.getRepoAsResource(params).get(function(repo) {
|
|
|
|
$scope.repo = repo;
|
|
|
|
}, ApiService.errorDisplay('Cannot load repository'));
|
|
|
|
};
|
|
|
|
|
|
|
|
// Page startup:
|
|
|
|
loadRepository();
|
|
|
|
loadBuild();
|
|
|
|
|
2015-02-27 21:00:32 +00:00
|
|
|
$scope.askCancelBuild = function(build) {
|
|
|
|
bootbox.confirm('Are you sure you want to cancel this build?', function(r) {
|
|
|
|
if (r) {
|
|
|
|
var params = {
|
|
|
|
'repository': $scope.namespace + '/' + $scope.name,
|
|
|
|
'build_uuid': build.id
|
|
|
|
};
|
|
|
|
|
2017-05-05 19:10:06 +00:00
|
|
|
ApiService.cancelRepoBuild(null, params).then(function () {
|
|
|
|
$location.path('/repository/' + $scope.namespace + '/' + $scope.name);
|
|
|
|
|
2015-02-27 21:00:32 +00:00
|
|
|
}, ApiService.errorDisplay('Cannot cancel build'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
$scope.toggleTimestamps = function() {
|
|
|
|
$scope.showLogTimestamps = !$scope.showLogTimestamps;
|
|
|
|
CookieService.putPermanent('quay.showBuildLogTimestamps', $scope.showLogTimestamps);
|
|
|
|
};
|
|
|
|
|
2015-02-26 22:45:28 +00:00
|
|
|
$scope.setUpdatedBuild = function(build) {
|
|
|
|
$scope.build = build;
|
|
|
|
};
|
|
|
|
}
|
2015-04-03 21:03:35 +00:00
|
|
|
})();
|