diff --git a/endpoints/api/build.py b/endpoints/api/build.py
index 92745c089..a784c4f84 100644
--- a/endpoints/api/build.py
+++ b/endpoints/api/build.py
@@ -52,6 +52,9 @@ def trigger_view(trigger, can_read=False, can_admin=False):
repo_url = build_trigger.get_repository_url() if build_source else None
+ if can_admin:
+ can_read = True
+
return {
'service': trigger.service.name,
'build_source': build_source if can_read else None,
diff --git a/static/js/directives/ui/trigger-setup-githost.js b/static/js/directives/ui/trigger-setup-githost.js
index 990059dd3..51f05975b 100644
--- a/static/js/directives/ui/trigger-setup-githost.js
+++ b/static/js/directives/ui/trigger-setup-githost.js
@@ -179,11 +179,7 @@ angular.module('quay').directive('triggerSetupGithost', function () {
};
$scope.scmIcon = function(kind) {
- if (kind == 'gitlab') {
- return 'fa-git-square';
- }
-
- return 'fa-' + kind;
+ return TriggerService.getIcon(kind);
};
var setupTypeahead = function() {
diff --git a/static/js/services/trigger-service.js b/static/js/services/trigger-service.js
index 69d01c386..8b636d701 100644
--- a/static/js/services/trigger-service.js
+++ b/static/js/services/trigger-service.js
@@ -8,13 +8,6 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
var triggerTypes = {
'github': {
- 'description': function(config) {
- var source = UtilService.textToSafeHtml(config['build_source']);
- var desc = ' Push to Github Repository ';
- desc += '' + source + '';
- desc += '
Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
- return desc;
- },
'run_parameters': [
{
'title': 'Branch',
@@ -63,13 +56,6 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
},
'bitbucket': {
- 'description': function(config) {
- var source = UtilService.textToSafeHtml(config['build_source']);
- var desc = ' Push to Bitbucket Repository ';
- desc += '' + source + '';
- desc += '
Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
- return desc;
- },
'run_parameters': [
{
'title': 'Branch',
@@ -99,13 +85,6 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
},
'gitlab': {
- 'description': function(config) {
- var source = UtilService.textToSafeHtml(config['build_source']);
- var desc = ' Push to GitLab Repository ';
- desc += '' + source + '';
- desc += '
Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
- return desc;
- },
'run_parameters': [
{
'title': 'Branch',
@@ -139,12 +118,6 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
},
'custom-git': {
- 'description': function(config) {
- var source = UtilService.textToSafeHtml(config['build_source']);
- var desc = ' Push to Custom Git Repository ' + source;
- desc += '
Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
- return desc;
- },
'run_parameters': [
{
'title': 'Commit',
@@ -232,10 +205,16 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
};
triggerService.getDockerfileLocation = function(trigger) {
- if (!trigger.config.subdir) {
+ var subdirectory = trigger.config.subdir;
+ if (!subdirectory) {
return '//Dockerfile';
}
- return '//' + trigger.config.subdir.replace(new RegExp('(^\/+|\/+$)'), '') + '/Dockerfile';
+
+ if (subdirectory[subdirectory.length - 1] != '/') {
+ subdirectory = subdirectory + '/';
+ }
+
+ return '//' + subdirectory.replace(new RegExp('(^\/+|\/+$)'), '') + 'Dockerfile';
};
triggerService.isEnabled = function(name) {
@@ -246,6 +225,14 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
return type['is_enabled']();
};
+ triggerService.getIcon = function(name) {
+ var type = triggerTypes[name];
+ if (!type) {
+ return 'Unknown';
+ }
+ return type['icon'];
+ };
+
triggerService.getTitle = function(name) {
var type = triggerTypes[name];
if (!type) {
@@ -255,11 +242,11 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
};
triggerService.getDescription = function(name, config) {
- var type = triggerTypes[name];
- if (!type) {
- return 'Unknown';
- }
- return type['description'](config);
+ var icon = triggerService.getIcon(config['service']);
+ var title = triggerService.getTitle(config['service']);
+ var source = UtilService.textToSafeHtml(config['build_source']);
+ var desc = ' Push to ' + title + ' ' + source;
+ return desc;
};
triggerService.getMetadata = function(name) {