Work in progress: UI fixes for the new trigger type

This commit is contained in:
Joseph Schorr 2015-04-29 19:50:13 -04:00
parent 5a8093bbea
commit de29a441c8
14 changed files with 160 additions and 144 deletions

View file

@ -50,7 +50,11 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
return 'GitHub Repository Push';
},
'supports_full_directory_listing': true
'supports_full_directory_listing': true,
'templates': {
'credentials': '/static/directives/trigger/githost/credentials.html',
'trigger-description': '/static/directives/trigger/github/trigger-description.html'
}
},
'bitbucket': {
@ -77,7 +81,11 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
},
'icon': 'fa-bitbucket',
'title': function() { return 'Bitbucket Repository Push'; },
'supports_full_directory_listing': false
'supports_full_directory_listing': false,
'templates': {
'credentials': '/static/directives/trigger/githost/credentials.html',
'trigger-description': '/static/directives/trigger/bitbucket/trigger-description.html'
}
},
'custom-git': {
@ -102,9 +110,20 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
'is_external': false,
'is_enabled': function() { return true; },
'icon': 'fa-git',
'title': function() { return 'Custom Git Repository Push'; }
'title': function() { return 'Custom Git Repository Push'; },
'templates': {
'credentials': '/static/directives/trigger/custom-git/credentials.html',
'trigger-description': '/static/directives/trigger/custom-git/trigger-description.html'
}
}
}
};
triggerService.populateTemplate = function(scope, name) {
scope.$watch('trigger', function(trigger) {
if (!trigger) { return; }
scope.triggerTemplate = triggerService.getTemplate(trigger.service, name);
});
};
triggerService.supportsFullListing = function(name) {
var type = triggerTypes[name];
@ -126,6 +145,14 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
return types;
};
triggerService.getTemplate = function(name, template) {
var type = triggerTypes[name];
if (!type) {
return '';
}
return type['templates'][template];
};
triggerService.getRedirectUrl = function(name, namespace, repository) {
var type = triggerTypes[name];
if (!type) {