Add support for multi-step phase delimitation in build logs view

This commit is contained in:
Joseph Schorr 2017-06-23 16:00:22 -04:00
parent 1d60414a23
commit 09e9b5cb53
4 changed files with 47 additions and 10 deletions

View file

@ -9,7 +9,7 @@ angular.module('quay').directive('buildLogCommand', function () {
transclude: false,
restrict: 'C',
scope: {
'command': '=command'
'command': '<command'
},
controller: function($scope, $element) {
$scope.getWithoutStep = function(fullTitle) {
@ -20,6 +20,29 @@ angular.module('quay').directive('buildLogCommand', function () {
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;