trigger service: trimsubdir helper method
This commit is contained in:
parent
c8b931609e
commit
6465e7492a
2 changed files with 7 additions and 2 deletions
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div>
|
||||
<span class="trigger-description-subtitle">Dockerfile:</span>
|
||||
<span ng-if="trigger.config.subdir">//{{ trigger.config.subdir }}/Dockerfile</span>
|
||||
<span ng-if="trigger.config.subdir">//{{ TriggerService.trimSubdir(trigger.config.subdir) }}/Dockerfile</span>
|
||||
<span ng-if="!trigger.config.subdir">//Dockerfile</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<div style="margin-top: 4px; margin-left: 26px; font-size: 12px; color: gray;" ng-if="!short">
|
||||
<div>
|
||||
<span class="trigger-description-subtitle">Dockerfile:</span>
|
||||
<span ng-if="trigger.config.subdir">//{{ trigger.config.subdir }}/Dockerfile</span>
|
||||
<span ng-if="trigger.config.subdir">//{{ TriggerService.trimSubdir(trigger.config.subdir) }}/Dockerfile</span>
|
||||
<span ng-if="!trigger.config.subdir">//Dockerfile</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -95,6 +95,11 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
|
|||
return type['get_redirect_url'](namespace, repository);
|
||||
};
|
||||
|
||||
// Helper to remove the prefix and suffix /s on subdir paths.
|
||||
triggerService.trimSubdir = function(subdir) {
|
||||
return subdir.replace(new RegExp('(^\/+|\/+$)'), '');
|
||||
};
|
||||
|
||||
triggerService.getTitle = function(name) {
|
||||
var type = triggerTypes[name];
|
||||
if (!type) {
|
||||
|
|
Reference in a new issue