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'];

View file

@ -0,0 +1,31 @@
/**
* An element for managing global messages.
*/
angular.module('quay').directive('superUserBuildLogs', function () {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/super-user-build-logs.html',
replace: false,
transclude: true,
restrict: 'C',
scope: {
'isEnabled': '=isEnabled'
},
controller: function ($scope, $element, ApiService) {
$scope.buildParams = {};
$scope.showLogTimestamps = true;
$scope.loadBuild = function () {
var params = {
'build_uuid': $scope.buildParams.buildUuid
};
ApiService.getRepoBuildSuperUserAsResource(params).get(function (build) {
$scope.build = build;
});
};
$scope.setUpdatedBuild = function (build) {
$scope.build = build;
};
}
};
return directiveDefinitionObject;
});

View file

@ -30,6 +30,7 @@
$scope.currentConfig = null;
$scope.serviceKeysActive = false;
$scope.globalMessagesActive = false;
$scope.superUserBuildLogsActive = false;
$scope.manageUsersActive = false;
$scope.orderedOrgs = [];
$scope.orgsPerPage = 10;
@ -43,6 +44,11 @@
$scope.loadMessageOfTheDay = function () {
$scope.globalMessagesActive = true;
};
$scope.loadSuperUserBuildLogs = function () {
$scope.superUserBuildLogsActive = true;
};
$scope.configurationSaved = function(config) {
$scope.currentConfig = config;
$scope.requiresRestart = true;