- Fix trigger setup to… work…

- Make sure new manual builds are added to the repo build list immediately
This commit is contained in:
Joseph Schorr 2014-04-16 17:50:25 -04:00
parent 0a9ee6c49f
commit 63cf8beb26
3 changed files with 28 additions and 9 deletions

View file

@ -8,7 +8,10 @@
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">Setup new build trigger</h4>
</div>
<div class="modal-body">
<div class="modal-body" ng-show="activating">
<span class="quay-spinner"></span> Setting up trigger...
</div>
<div class="modal-body" ng-show="!activating">
<!-- Trigger-specific setup -->
<div class="trigger-description-element trigger-option-section" ng-switch on="trigger.service">
<div ng-switch-when="github">
@ -90,8 +93,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-disabled="!trigger.$ready || (!publicPull && !pullEntity) || checkingPullRequirements"
ng-click="activate">Finished</button>
ng-disabled="!trigger.$ready || (!publicPull && !pullEntity) || checkingPullRequirements || activating"
ng-click="activate()">Finished</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div><!-- /.modal-content -->

View file

@ -3722,17 +3722,26 @@ quayApp.directive('setupTriggerDialog', function () {
'activated': '&activated'
},
controller: function($scope, $element, ApiService, UserService) {
var modalSetup = false;
$scope.show = function() {
$scope.activating = false;
$scope.pullEntity = null;
$scope.publicPull = true;
$scope.showPullRequirements = false;
$('#setupTriggerModal').modal({});
$('#setupTriggerModal').on('hidden.bs.modal', function () {
$scope.$apply(function() {
$scope.cancelSetupTrigger();
if (!modalSetup) {
$('#setupTriggerModal').on('hidden.bs.modal', function () {
if ($scope.trigger['is_active']) { return; }
$scope.$apply(function() {
$scope.cancelSetupTrigger();
});
});
});
modalSetup = true;
}
};
$scope.isNamespaceAdmin = function(namespace) {
@ -3744,6 +3753,7 @@ quayApp.directive('setupTriggerDialog', function () {
};
$scope.hide = function() {
$scope.activating = false;
$('#setupTriggerModal').modal('hide');
};
@ -3810,9 +3820,12 @@ quayApp.directive('setupTriggerDialog', function () {
data['pull_robot'] = $scope.pullEntity['name'];
}
$scope.activating = true;
ApiService.activateBuildTrigger(data, params).then(function(resp) {
trigger['is_active'] = true;
trigger['pull_robot'] = resp['pull_robot'];
$scope.hide();
$scope.trigger['is_active'] = true;
$scope.trigger['pull_robot'] = resp['pull_robot'];
$scope.activated({'trigger': $scope.trigger});
}, function(resp) {
$scope.hide();

View file

@ -362,6 +362,7 @@ function RepoCtrl($scope, $sanitize, Restangular, ImageMetadataService, ApiServi
};
$scope.handleBuildStarted = function(build) {
getBuildInfo($scope.repo);
startBuildInfoTimer($scope.repo);
};
@ -1518,6 +1519,8 @@ function RepoAdminCtrl($scope, Restangular, ApiService, KeyService, $routeParams
};
$scope.deleteTrigger = function(trigger) {
if (!trigger) { return; }
var params = {
'repository': namespace + '/' + name,
'trigger_uuid': trigger.id