custom trigger: initial setup wizard

This commit is contained in:
Jimmy Zelinskie 2015-03-27 17:07:06 -04:00
parent c5272f3545
commit 7d1d53ebcb
8 changed files with 86 additions and 31 deletions

View file

@ -0,0 +1,35 @@
/**
* An element which displays custom git-specific setup information for its build triggers.
*/
angular.module('quay').directive('triggerSetupCustom', function() {
var directiveDefinitionObject = {
priority: 0,
templateUrl: '/static/directives/trigger-setup-custom.html',
replace: false,
transclude: false,
restrict: 'C',
scope: {
'repository': '=repository',
'trigger': '=trigger',
'nextStepCounter': '=nextStepCounter',
'currentStepValid': '=currentStepValid',
'analyze': '&analyze'
},
controller: function($scope, $element, ApiService) {
$scope.analyzeCounter = 0;
$scope.setupReady = false,
$scope.state = {
'gitURL': null,
};
$scope.stepsCompleted = function() {
$scope.analyze({'isValid': $scope.state.gitURL != null});
};
}
};
return directiveDefinitionObject;
});

View file

@ -14,7 +14,6 @@ angular.module('quay').factory('KeyService', ['$location', 'Config', function($l
keyService['githubRedirectUri'] = Config.getUrl('/oauth2/github/callback');
keyService['googleRedirectUri'] = Config.getUrl('/oauth2/google/callback');
keyService['customRedirectUri'] = Config.getUrl('/oauth2/custom/callback');
keyService['githubLoginUrl'] = oauth['GITHUB_LOGIN_CONFIG']['AUTHORIZE_ENDPOINT'];
keyService['googleLoginUrl'] = oauth['GOOGLE_LOGIN_CONFIG']['AUTHORIZE_ENDPOINT'];

View file

@ -2,8 +2,8 @@
* Helper service for defining the various kinds of build triggers and retrieving information
* about them.
*/
angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'KeyService', 'Features', 'CookieService',
function(UtilService, $sanitize, KeyService, Features, CookieService) {
angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'KeyService', 'Features', 'CookieService', 'Config',
function(UtilService, $sanitize, KeyService, Features, CookieService, Config) {
var triggerService = {};
var triggerTypes = {
@ -37,6 +37,7 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
return authorize_url + 'client_id=' + client_id +
'&scope=repo,user:email&redirect_uri=' + redirect_uri;
},
'target': '',
'is_enabled': function() {
return Features.GITHUB_BUILD;
},
@ -71,8 +72,9 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
}
],
'get_redirect_url': function(namespace, repository) {
return KeyService['customRedirectUri'] + '/trigger/' + namespace + '/' + repository;
return Config.getUrl('/customtrigger/setup/' + namespace + '/' + repository);
},
'target': '_self',
'is_enabled': function() { return true; },
'icon': 'fa-git',
'title': function() { return 'Custom Git Repository Push'; }