From 99c986df6c076efe2e8cbb1fa4397ede4d9c3e63 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Mon, 14 May 2018 15:30:52 -0400 Subject: [PATCH] Fix display of triggered builds if their trigger has been deleted Before this change, if a build was triggered by a build trigger that was subsequently deleted, we'd display "Manually triggered" for the build in the UI, even though we have sufficient metadata to show *nearly the same* normal build information. After this change, if we have said trigger metadata, we still display as much as we can. Fixes https://jira.coreos.com/browse/QUAY-855 --- static/directives/build-info-bar.html | 4 ++-- .../ui/triggered-build-description.js | 20 +++++++------------ static/js/services/trigger-service.js | 7 +++++-- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/static/directives/build-info-bar.html b/static/directives/build-info-bar.html index b3b9b8479..788df8899 100644 --- a/static/directives/build-info-bar.html +++ b/static/directives/build-info-bar.html @@ -13,6 +13,6 @@ -
-
Manually Started Build
+
+
Manually Started Build
diff --git a/static/js/directives/ui/triggered-build-description.js b/static/js/directives/ui/triggered-build-description.js index e08fd038b..a49255135 100644 --- a/static/js/directives/ui/triggered-build-description.js +++ b/static/js/directives/ui/triggered-build-description.js @@ -46,23 +46,17 @@ angular.module('quay').directive('triggeredBuildDescription', function () { if (!build) { return; } var triggerMetadata = build.trigger_metadata || {}; - - if (!build.trigger && !build.manual_user) { - $scope.infoDisplay = 'manual'; - return; - } - - if (!build.trigger && build.manual_user) { - $scope.infoDisplay = 'manual+user'; - return; - } - - if (build.trigger && triggerMetadata.commit_info) { + if (triggerMetadata.commit_info) { $scope.infoDisplay = 'fullcommit'; return; } - if (build.trigger && build.trigger.build_source && TriggerService.getCommitSHA(triggerMetadata)) { + if (!build.trigger) { + $scope.infoDisplay = build.manual_user ? 'manual+user' : 'manual'; + return; + } + + if (build.trigger.build_source && TriggerService.getCommitSHA(triggerMetadata)) { $scope.infoDisplay = 'commitsha'; return; } diff --git a/static/js/services/trigger-service.js b/static/js/services/trigger-service.js index 3d8c3d143..08f64dcdb 100644 --- a/static/js/services/trigger-service.js +++ b/static/js/services/trigger-service.js @@ -147,8 +147,11 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K }; triggerService.getFullLinkTemplate = function(build, templateName) { - var name = build.trigger.service; - var type = triggerTypes[name]; + if (!build.trigger) { + return null; + } + + var type = triggerTypes[build.trigger.service]; if (!type) { return null; }