initial import for Open Source 🎉
This commit is contained in:
parent
1898c361f3
commit
9c0dd3b722
2048 changed files with 218743 additions and 0 deletions
49
static/js/directives/ui/build-log-command.js
Normal file
49
static/js/directives/ui/build-log-command.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
/**
|
||||
* An element which displays a command in a build.
|
||||
*/
|
||||
angular.module('quay').directive('buildLogCommand', function () {
|
||||
var directiveDefinitionObject = {
|
||||
priority: 0,
|
||||
templateUrl: '/static/directives/build-log-command.html',
|
||||
replace: false,
|
||||
transclude: false,
|
||||
restrict: 'C',
|
||||
scope: {
|
||||
'command': '<command'
|
||||
},
|
||||
controller: function($scope, $element) {
|
||||
$scope.getWithoutStep = function(fullTitle) {
|
||||
var colon = fullTitle.indexOf(':');
|
||||
if (colon <= 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $.trim(fullTitle.substring(colon + 1));
|
||||
};
|
||||
|
||||
$scope.isSecondaryFrom = function(fullTitle) {
|
||||
if (!fullTitle) { return false; }
|
||||
|
||||
var command = $scope.getWithoutStep(fullTitle);
|
||||
return command.indexOf('FROM ') == 0 && fullTitle.indexOf('Step 1 ') < 0;
|
||||
};
|
||||
|
||||
$scope.fromName = function(fullTitle) {
|
||||
var command = $scope.getWithoutStep(fullTitle);
|
||||
if (command.indexOf('FROM ') != 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var parts = command.split(' ');
|
||||
for (var i = 0; i < parts.length - 1; i++) {
|
||||
var part = parts[i];
|
||||
if ($.trim(part) == 'as') {
|
||||
return parts[i + 1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
return directiveDefinitionObject;
|
||||
});
|
Reference in a new issue