/**
 * An element which displays the status of a build as a mini-bar.
 */
angular.module('quay').directive('buildMiniStatus', function () {
  var directiveDefinitionObject = {
    priority: 0,
    templateUrl: '/static/directives/build-mini-status.html',
    replace: false,
    transclude: false,
    restrict: 'C',
    scope: {
      'build': '=build',
      'isAdmin': '=isAdmin'
    },
    controller: function($scope, $element) {
      $scope.isBuilding = function(build) {
        if (!build) { return true; }
        return build.phase != 'complete' && build.phase != 'error';
      };
    }
  };
  return directiveDefinitionObject;
});