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
</button>
</div>
<div class="build-logs-view"
build="build"
use-timestamps="showLogTimestamps"
build-updated="setUpdatedBuild(build)"
is-super-user="true"
ng-show="build"></div>
<div class="resource-view" resource="buildResource" error-message="'Cannot find or load build'"
ng-show="buildId">
<div class="build-logs-view"
build="build"
use-timestamps="showLogTimestamps"
is-super-user="true"
ng-show="build"></div>
</div>
</div>

View file

@ -164,6 +164,10 @@ angular.module('quay').directive('buildLogsView', function () {
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.start();
};

View file

@ -14,17 +14,18 @@ angular.module('quay').directive('superUserBuildLogs', function () {
controller: function ($scope, $element, ApiService) {
$scope.buildParams = {};
$scope.showLogTimestamps = true;
$scope.buildId = null;
$scope.loadBuild = function () {
var params = {
'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.setUpdatedBuild = function (build) {
$scope.build = build;
};
}
};
return directiveDefinitionObject;