UI fixes for all the new trigger stuff
This commit is contained in:
parent
de29a441c8
commit
b7317f894b
25 changed files with 260 additions and 149 deletions
|
@ -42,15 +42,14 @@ angular.module('quay').directive('repoPanelBuilds', function () {
|
|||
|
||||
var unordered = $scope.allBuilds.map(function(build_info) {
|
||||
var commit_sha = null;
|
||||
var job_config = build_info.job_config || {};
|
||||
|
||||
if (job_config.trigger_metadata) {
|
||||
commit_sha = job_config.trigger_metadata.commit_sha;
|
||||
if (build_info.trigger_metadata) {
|
||||
commit_sha = build_info.trigger_metadata.commit_sha;
|
||||
}
|
||||
|
||||
return $.extend(build_info, {
|
||||
'started_datetime': (new Date(build_info.started)).valueOf() * (-1),
|
||||
'building_tags': job_config.docker_tags || [],
|
||||
'building_tags': build_info.tags || [],
|
||||
'commit_sha': commit_sha
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,6 +10,7 @@ angular.module('quay').directive('anchor', function () {
|
|||
restrict: 'C',
|
||||
scope: {
|
||||
'href': '@href',
|
||||
'target': '@target',
|
||||
'isOnlyText': '=isOnlyText'
|
||||
},
|
||||
controller: function($scope, $element) {
|
||||
|
|
|
@ -6,11 +6,12 @@ angular.module('quay').directive('sourceCommitLink', function () {
|
|||
priority: 0,
|
||||
templateUrl: '/static/directives/source-commit-link.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
transclude: true,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'commitSha': '=commitSha',
|
||||
'urlTemplate': '=urlTemplate'
|
||||
'urlTemplate': '=urlTemplate',
|
||||
'showTransclude': '=showTransclude'
|
||||
},
|
||||
controller: function($scope, $element) {
|
||||
$scope.getUrl = function(sha, template) {
|
||||
|
|
|
@ -16,26 +16,38 @@ angular.module('quay').directive('stepView', function ($compile) {
|
|||
'stepsCompleted': '&stepsCompleted'
|
||||
},
|
||||
controller: function($scope, $element, $rootScope) {
|
||||
this.currentStepIndex = -1;
|
||||
this.steps = [];
|
||||
this.watcher = null;
|
||||
var currentStepIndex = -1;
|
||||
var steps = [];
|
||||
var watcher = null;
|
||||
|
||||
this.getCurrentStep = function() {
|
||||
return this.steps[this.currentStepIndex];
|
||||
// Members on 'this' are accessed by the individual steps.
|
||||
this.register = function(scope, element) {
|
||||
element.hide();
|
||||
|
||||
steps.push({
|
||||
'scope': scope,
|
||||
'element': element
|
||||
});
|
||||
|
||||
nextStep();
|
||||
};
|
||||
|
||||
this.reset = function() {
|
||||
this.currentStepIndex = -1;
|
||||
for (var i = 0; i < this.steps.length; ++i) {
|
||||
this.steps[i].element.hide();
|
||||
var getCurrentStep = function() {
|
||||
return steps[currentStepIndex];
|
||||
};
|
||||
|
||||
var reset = function() {
|
||||
currentStepIndex = -1;
|
||||
for (var i = 0; i < steps.length; ++i) {
|
||||
steps[i].element.hide();
|
||||
}
|
||||
|
||||
$scope.currentStepValid = false;
|
||||
};
|
||||
|
||||
this.next = function() {
|
||||
if (this.currentStepIndex >= 0) {
|
||||
var currentStep = this.getCurrentStep();
|
||||
var next = function() {
|
||||
if (currentStepIndex >= 0) {
|
||||
var currentStep = getCurrentStep();
|
||||
if (!currentStep || !currentStep.scope) { return; }
|
||||
|
||||
if (!currentStep.scope.completeCondition) {
|
||||
|
@ -44,20 +56,20 @@ angular.module('quay').directive('stepView', function ($compile) {
|
|||
|
||||
currentStep.element.hide();
|
||||
|
||||
if (this.unwatch) {
|
||||
this.unwatch();
|
||||
this.unwatch = null;
|
||||
if (unwatch) {
|
||||
unwatch();
|
||||
unwatch = null;
|
||||
}
|
||||
}
|
||||
|
||||
this.currentStepIndex++;
|
||||
currentStepIndex++;
|
||||
|
||||
if (this.currentStepIndex < this.steps.length) {
|
||||
var currentStep = this.getCurrentStep();
|
||||
if (currentStepIndex < steps.length) {
|
||||
var currentStep = getCurrentStep();
|
||||
currentStep.element.show();
|
||||
currentStep.scope.load()
|
||||
|
||||
this.unwatch = currentStep.scope.$watch('completeCondition', function(cc) {
|
||||
unwatch = currentStep.scope.$watch('completeCondition', function(cc) {
|
||||
$scope.currentStepValid = !!cc;
|
||||
});
|
||||
} else {
|
||||
|
@ -65,23 +77,17 @@ angular.module('quay').directive('stepView', function ($compile) {
|
|||
}
|
||||
};
|
||||
|
||||
this.register = function(scope, element) {
|
||||
element.hide();
|
||||
var nextStep = function() {
|
||||
if (!steps || !steps.length) { return; }
|
||||
|
||||
this.steps.push({
|
||||
'scope': scope,
|
||||
'element': element
|
||||
});
|
||||
if ($scope.nextStepCounter >= 0) {
|
||||
next();
|
||||
} else {
|
||||
reset();
|
||||
}
|
||||
};
|
||||
|
||||
var that = this;
|
||||
$scope.$watch('nextStepCounter', function(nsc) {
|
||||
if (nsc >= 0) {
|
||||
that.next();
|
||||
} else {
|
||||
that.reset();
|
||||
}
|
||||
});
|
||||
$scope.$watch('nextStepCounter', nextStep);
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
|
|
|
@ -12,29 +12,30 @@ angular.module('quay').directive('triggeredBuildDescription', function () {
|
|||
'build': '=build'
|
||||
},
|
||||
controller: function($scope, $element, KeyService, TriggerService) {
|
||||
$scope.TriggerService = TriggerService;
|
||||
$scope.$watch('build', function(build) {
|
||||
if (!build) { return; }
|
||||
|
||||
var jobConfig = build.job_config || {};
|
||||
var triggerMetadata = jobConfig.trigger_metadata || {};
|
||||
var triggerMetadata = build.trigger_metadata || {};
|
||||
|
||||
if (!build.trigger && !jobConfig.manual_user) {
|
||||
if (!build.trigger && !build.manual_user) {
|
||||
$scope.infoDisplay = 'manual';
|
||||
return;
|
||||
}
|
||||
|
||||
if (!build.trigger && jobConfig.manual_user) {
|
||||
if (!build.trigger && build.manual_user) {
|
||||
$scope.infoDisplay = 'manual+user';
|
||||
return;
|
||||
}
|
||||
|
||||
if (triggerMetadata.commit_info) {
|
||||
if (build.trigger && triggerMetadata.commit_info) {
|
||||
$scope.infoDisplay = 'fullcommit';
|
||||
return;
|
||||
}
|
||||
|
||||
if (triggerMetadata.commit_sha) {
|
||||
if (build.trigger && build.trigger.build_source && triggerMetadata.commit_sha) {
|
||||
$scope.infoDisplay = 'commitsha';
|
||||
return;
|
||||
}
|
||||
|
||||
$scope.infoDisplay = 'source';
|
||||
|
|
Reference in a new issue