feature(superuser panel): ability to view logs

users would like the ability to view build logs in the superuser panel

[None]
This commit is contained in:
Charlton Austin 2017-01-24 12:15:26 -05:00
parent d8e08fd5df
commit dae93dce78
10 changed files with 224 additions and 27 deletions

View file

@ -11,11 +11,18 @@ angular.module('quay').directive('buildLogsView', function () {
scope: {
'build': '=build',
'useTimestamps': '=useTimestamps',
'buildUpdated': '&buildUpdated'
'buildUpdated': '&buildUpdated',
'isSuperUser': '=isSuperUser'
},
controller: function($scope, $element, $interval, $sanitize, ansi2html, AngularViewArray,
AngularPollChannel, ApiService, Restangular, UtilService) {
var repoStatusApiCall = ApiService.getRepoBuildStatus;
var repoLogApiCall = ApiService.getRepoBuildLogsAsResource;
if( $scope.isSuperUser ){
repoStatusApiCall = ApiService.getRepoBuildStatusSuperUser;
repoLogApiCall = ApiService.getRepoBuildLogsSuperUserAsResource;
}
var result = $element.find('#copyButton').clipboardCopy();
if (!result) {
$element.find('#copyButton').hide();
@ -95,7 +102,8 @@ angular.module('quay').directive('buildLogsView', function () {
'build_uuid': build.id
};
ApiService.getRepoBuildStatus(null, params, true).then(function(resp) {
repoStatusApiCall(null, params, true).then(function(resp) {
if (resp.id != $scope.build.id) { callback(false); return; }
// Call the build updated handler.
@ -109,7 +117,7 @@ angular.module('quay').directive('buildLogsView', function () {
'start': $scope.logStartIndex
};
ApiService.getRepoBuildLogsAsResource(params, true).withOptions(options).get(function(resp) {
repoLogApiCall(params, true).withOptions(options).get(function(resp) {
// If we get a logs url back, then we need to make another XHR request to retrieve the
// data.
var logsUrl = resp['logs_url'];