github.com/justinjmoses/evergreen@v0.0.0-20170530173719-1d50e381ff0d/public/static/js/directives/directives.badges.js (about) 1 var directives = directives || {}; 2 3 directives.badges = angular.module('directives.badges', ['filters.common']); 4 5 directives.badges.directive('buildStatusLabel', function($filter) { 6 return function(scope, element, attrs) { 7 // buildStatusLabel should be a particular build, and we adjust 8 // the label to match the state of the build 9 scope.$watch(attrs.buildStatusLabel, function(v, old) { 10 if (v) { 11 switch (v.Build.status) { 12 case 'created': 13 case 'unstarted': 14 if (v.Build.activated) { 15 element.html('Scheduled'); 16 } else { 17 element.html('Not Scheduled'); 18 } 19 break; 20 case 'started': 21 element.html('In Progress'); 22 break; 23 default: 24 element.html($filter('capitalize')(v.Build.status)); 25 break; 26 } 27 } 28 }); 29 }; 30 });