From fcdf966c9f5dc5f9887a3285b2a6973360c7d340 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 30 Jan 2017 13:56:53 -0500 Subject: [PATCH] Fix multiple loading of build logs in new superuser panel Also adds an error message if the logs fail to load --- static/directives/super-user-build-logs.html | 14 ++++++++------ static/js/directives/ui/build-logs-view.js | 4 ++++ static/js/directives/ui/super-user-build-logs.js | 9 +++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/static/directives/super-user-build-logs.html b/static/directives/super-user-build-logs.html index 64a7415b5..a29b5aed7 100644 --- a/static/directives/super-user-build-logs.html +++ b/static/directives/super-user-build-logs.html @@ -9,10 +9,12 @@ Get Logs -
+
+
+
diff --git a/static/js/directives/ui/build-logs-view.js b/static/js/directives/ui/build-logs-view.js index e37da1dce..e46fe6112 100644 --- a/static/js/directives/ui/build-logs-view.js +++ b/static/js/directives/ui/build-logs-view.js @@ -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(); }; diff --git a/static/js/directives/ui/super-user-build-logs.js b/static/js/directives/ui/super-user-build-logs.js index aa1e3b7f1..8e69c4556 100644 --- a/static/js/directives/ui/super-user-build-logs.js +++ b/static/js/directives/ui/super-user-build-logs.js @@ -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;