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
This commit is contained in:
Joseph Schorr 2018-05-14 15:30:52 -04:00
parent e5b86d4763
commit 99c986df6c
3 changed files with 14 additions and 17 deletions

View file

@ -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;
}