/**
* Service which provides helper methods for reasoning about builds.
*/
angular.module('quay').factory('BuildService', [function() {
var buildService = {};
buildService.isActive = function(build) {
return build.phase != 'complete' && build.phase != 'error' && build.phase != 'expired' && build.phase != 'cancelled';
};
buildService.getBuildMessage = function(phase) {
switch (phase) {
case 'cannot_load':
return 'Cannot load build status';
case 'starting':
case 'initializing':
return 'Starting Dockerfile build';
case 'waiting':
return 'Waiting for available build worker';
case 'unpacking':
return 'Unpacking build package';
case 'pulling':
return 'Pulling base image';
case 'building':
return 'Building image from Dockerfile';
case 'checking-cache':
return 'Looking up cached images';
case 'priming-cache':
return 'Priming cache for build';
case 'build-scheduled':
return 'Preparing build node';
case 'pushing':
return 'Pushing image built from Dockerfile';
case 'complete':
return 'Dockerfile build completed and pushed';
case 'error':
return 'Dockerfile build failed';
case 'expired':
return 'Build did not complete after 3 attempts. Re-submit this build to try again.';
case 'internalerror':
return 'An internal system error occurred while building; the build will be retried in the next few minutes.';
case 'cancelled':
return 'This build was previously cancelled.';
}
return buildService;
}]);