Merge pull request #2317 from coreos-inc/fix-build-logs-load

Fix multiple loading of build logs in new superuser panel
This commit is contained in:
josephschorr 2017-01-30 14:12:13 -05:00 committed by GitHub
commit 3cc2838ee8
3 changed files with 17 additions and 10 deletions

View file

@ -9,10 +9,12 @@
<i class="fa fa-plus" style="margin-right: 6px;"></i>Get Logs <i class="fa fa-plus" style="margin-right: 6px;"></i>Get Logs
</button> </button>
</div> </div>
<div class="build-logs-view" <div class="resource-view" resource="buildResource" error-message="'Cannot find or load build'"
build="build" ng-show="buildId">
use-timestamps="showLogTimestamps" <div class="build-logs-view"
build-updated="setUpdatedBuild(build)" build="build"
is-super-user="true" use-timestamps="showLogTimestamps"
ng-show="build"></div> is-super-user="true"
ng-show="build"></div>
</div>
</div> </div>

View file

@ -164,6 +164,10 @@ angular.module('quay').directive('buildLogsView', function () {
getBuildStatusAndLogs(build, callback); getBuildStatusAndLogs(build, callback);
}; };
// Make sure to cancel any existing watchers first.
stopWatching();
// Register a new poll channel to start watching.
$scope.pollChannel = AngularPollChannel.create($scope, conductStatusAndLogRequest, 5 * 1000 /* 5s */); $scope.pollChannel = AngularPollChannel.create($scope, conductStatusAndLogRequest, 5 * 1000 /* 5s */);
$scope.pollChannel.start(); $scope.pollChannel.start();
}; };

View file

@ -14,17 +14,18 @@ angular.module('quay').directive('superUserBuildLogs', function () {
controller: function ($scope, $element, ApiService) { controller: function ($scope, $element, ApiService) {
$scope.buildParams = {}; $scope.buildParams = {};
$scope.showLogTimestamps = true; $scope.showLogTimestamps = true;
$scope.buildId = null;
$scope.loadBuild = function () { $scope.loadBuild = function () {
var params = { var params = {
'build_uuid': $scope.buildParams.buildUuid 'build_uuid': $scope.buildParams.buildUuid
}; };
ApiService.getRepoBuildSuperUserAsResource(params).get(function (build) {
$scope.buildId = $scope.buildParams.buildUuid;
$scope.buildResource = ApiService.getRepoBuildSuperUserAsResource(params).get(function (build) {
$scope.build = build; $scope.build = build;
}); });
}; };
$scope.setUpdatedBuild = function (build) {
$scope.build = build;
};
} }
}; };
return directiveDefinitionObject; return directiveDefinitionObject;