diff --git a/static/directives/credentials.html b/static/directives/credentials.html index e17e481af..9580f4ed1 100644 --- a/static/directives/credentials.html +++ b/static/directives/credentials.html @@ -1,18 +1,6 @@
-
-

- In order to use this trigger, the following first requires action: -

- For more information, refer to the Custom Git Triggers documentation. -

-
-
-

The following key has been automatically added to your GitHub repository.

-
+
diff --git a/static/directives/source-commit-link.html b/static/directives/source-commit-link.html index 5bd3b187a..30808421a 100644 --- a/static/directives/source-commit-link.html +++ b/static/directives/source-commit-link.html @@ -1,4 +1,6 @@ - {{ commitSha.substring(0, 8) }} + + {{ commitSha.substring(0, 8) }} + diff --git a/static/directives/source-ref-link.html b/static/directives/source-ref-link.html index 986216aa8..69e286581 100644 --- a/static/directives/source-ref-link.html +++ b/static/directives/source-ref-link.html @@ -3,13 +3,13 @@ - {{ getTitle(ref) }} + {{ getTitle(ref) }} - {{ getTitle(ref) }} + {{ getTitle(ref) }} diff --git a/static/directives/trigger-description.html b/static/directives/trigger-description.html index 7a434b075..e55313e1b 100644 --- a/static/directives/trigger-description.html +++ b/static/directives/trigger-description.html @@ -1,39 +1,3 @@ - - - - Push to GitHub Enterprise repository - - {{ trigger.config.build_source }} - -
-
- Branches/Tags: - Matching Regular Expression {{ trigger.config.branchtag_regex }} - (All Branches and Tags) -
- -
- Dockerfile: - {{ TriggerService.getDockerfileLocation(trigger) }} -
-
-
- - - - - Push to {{ trigger.config.build_source }} -
-
- Dockerfile: - {{ TriggerService.getDockerfileLocation(trigger) }} -
- - - - - Unknown - + diff --git a/static/directives/trigger/bitbucket/trigger-description.html b/static/directives/trigger/bitbucket/trigger-description.html new file mode 100644 index 000000000..992fd14ac --- /dev/null +++ b/static/directives/trigger/bitbucket/trigger-description.html @@ -0,0 +1,19 @@ + + + Push to BitBucket repository + + {{ trigger.config.build_source }} + +
+
+ Branches/Tags: + Matching Regular Expression {{ trigger.config.branchtag_regex }} + (All Branches and Tags) +
+ +
+ Dockerfile: + {{ TriggerService.getDockerfileLocation(trigger) }} +
+
+
\ No newline at end of file diff --git a/static/directives/trigger/custom-git/credentials.html b/static/directives/trigger/custom-git/credentials.html new file mode 100644 index 000000000..246d223b9 --- /dev/null +++ b/static/directives/trigger/custom-git/credentials.html @@ -0,0 +1,10 @@ +
+

+ In order to use this trigger, the following first requires action: +

    +
  • You must give the following public key read access to the git repository.
  • +
  • You must set your repository to POST to the following URL to trigger a build.
  • +
+ For more information, refer to the Custom Git Triggers documentation. +

+
\ No newline at end of file diff --git a/static/directives/trigger/custom-git/trigger-description.html b/static/directives/trigger/custom-git/trigger-description.html new file mode 100644 index 000000000..9264669cd --- /dev/null +++ b/static/directives/trigger/custom-git/trigger-description.html @@ -0,0 +1,10 @@ + + + Push to {{ trigger.config.build_source }} +
+
+ Dockerfile: + {{ TriggerService.getDockerfileLocation(trigger) }} +
+ \ No newline at end of file diff --git a/static/directives/trigger/githost/credentials.html b/static/directives/trigger/githost/credentials.html new file mode 100644 index 000000000..9a7616c49 --- /dev/null +++ b/static/directives/trigger/githost/credentials.html @@ -0,0 +1,3 @@ +
+

The following key has been automatically added to your source control repository.

+
\ No newline at end of file diff --git a/static/directives/trigger/github/trigger-description.html b/static/directives/trigger/github/trigger-description.html new file mode 100644 index 000000000..0309d5f4f --- /dev/null +++ b/static/directives/trigger/github/trigger-description.html @@ -0,0 +1,19 @@ + + + Push to GitHub Enterprise repository + + {{ trigger.config.build_source }} + +
+
+ Branches/Tags: + Matching Regular Expression {{ trigger.config.branchtag_regex }} + (All Branches and Tags) +
+ +
+ Dockerfile: + {{ TriggerService.getDockerfileLocation(trigger) }} +
+
+
\ No newline at end of file diff --git a/static/directives/triggered-build-description.html b/static/directives/triggered-build-description.html index fe9f31a80..d3ae4e0b9 100644 --- a/static/directives/triggered-build-description.html +++ b/static/directives/triggered-build-description.html @@ -1,47 +1,30 @@
- - - (Manually Triggered Build) - - - - {{ build.job_config.manual_user }} - - - - - -
- - +
+ +
+ (Manually Triggered Build)
- -
+ +
+ {{ build.job_config.manual_user }} +
+ + +
+ Triggered by commit to +
+
+ + +
+ Triggered by commit + +
+ + +
{{ build.job_config.trigger_metadata.commit_info.message }}
@@ -53,48 +36,11 @@ {{ build.job_config.trigger_metadata.commit_info.author.username }} - - {{ build.job_config.trigger_metadata.commit_sha }} - - - {{ build.job_config.trigger_metadata.ref }} - + +
- - - - - Triggered by commit - -
- -
- - -
- {{ build.job_config.trigger_metadata.commit_sha }} -
-
- - - - Triggered by commit to - - - - -
- - {{ build.trigger.config.build_source }} -
-
- +
diff --git a/static/js/directives/ui/credentials.js b/static/js/directives/ui/credentials.js index 5fd403044..44c3b1ca2 100644 --- a/static/js/directives/ui/credentials.js +++ b/static/js/directives/ui/credentials.js @@ -10,7 +10,9 @@ angular.module('quay').directive('credentials', function() { scope: { 'trigger': '=trigger' }, - controller: function($scope) {} + controller: function($scope, TriggerService) { + TriggerService.populateTemplate($scope, 'credentials'); + } }; return directiveDefinitionObject; }); diff --git a/static/js/directives/ui/trigger-description.js b/static/js/directives/ui/trigger-description.js index 0921fd023..f8ad3f630 100644 --- a/static/js/directives/ui/trigger-description.js +++ b/static/js/directives/ui/trigger-description.js @@ -13,8 +13,10 @@ angular.module('quay').directive('triggerDescription', function () { 'short': '=short' }, controller: function($scope, $element, KeyService, TriggerService) { + // TODO(jschorr): Clean up and remove the 'short' once we're on new layout. $scope.KeyService = KeyService; $scope.TriggerService = TriggerService; + TriggerService.populateTemplate($scope, 'trigger-description'); } }; return directiveDefinitionObject; diff --git a/static/js/directives/ui/triggered-build-description.js b/static/js/directives/ui/triggered-build-description.js index 63cafa779..d43a4a065 100644 --- a/static/js/directives/ui/triggered-build-description.js +++ b/static/js/directives/ui/triggered-build-description.js @@ -12,9 +12,33 @@ angular.module('quay').directive('triggeredBuildDescription', function () { 'build': '=build' }, controller: function($scope, $element, KeyService, TriggerService) { - $scope.getGitHubRepoURL = function(build) { - return KeyService['githubTriggerEndpoint'] + build.trigger.config.build_source + '/'; - }; + $scope.$watch('build', function(build) { + if (!build) { return; } + + var jobConfig = build.job_config || {}; + var triggerMetadata = jobConfig.trigger_metadata || {}; + + if (!build.trigger && !jobConfig.manual_user) { + $scope.infoDisplay = 'manual'; + return; + } + + if (!build.trigger && jobConfig.manual_user) { + $scope.infoDisplay = 'manual+user'; + return; + } + + if (triggerMetadata.commit_info) { + $scope.infoDisplay = 'fullcommit'; + return; + } + + if (triggerMetadata.commit_sha) { + $scope.infoDisplay = 'commitsha'; + } + + $scope.infoDisplay = 'source'; + }); } }; return directiveDefinitionObject; diff --git a/static/js/services/trigger-service.js b/static/js/services/trigger-service.js index 02459adf4..c8beec42e 100644 --- a/static/js/services/trigger-service.js +++ b/static/js/services/trigger-service.js @@ -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) {