forked from openshift/origin-web-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildPipeline.js
50 lines (47 loc) · 1.43 KB
/
buildPipeline.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"use strict";
angular.module('openshiftConsole')
.directive('buildPipeline', function($filter, Logger) {
return {
restrict: 'E',
scope: {
build: '=',
collapseStagesOnCompletion: '=?',
buildConfigNameOnExpanded: '=?'
},
// To fill height as flexbox item.
replace: true,
templateUrl: 'views/directives/build-pipeline.html',
link: function($scope) {
// Example JSON:
// https://github.com/jenkinsci/pipeline-stage-view-plugin/tree/master/rest-api#get-jobjob-namerun-idwfapidescribe
var annotation = $filter('annotation');
$scope.$watch(function() {
return annotation($scope.build, 'jenkinsStatus');
}, function(value) {
if (!value) {
return;
}
try {
$scope.jenkinsStatus = JSON.parse(value);
} catch (e) {
Logger.error('Could not parse Jenkins status as JSON', value);
}
});
var buildConfigForBuild = $filter('buildConfigForBuild');
$scope.$watch(function() {
return buildConfigForBuild($scope.build);
}, function(buildConfigName) {
$scope.buildConfigName = buildConfigName;
});
}
};
})
.directive('pipelineStatus', function() {
return {
restrict: 'E',
scope: {
status: '='
},
templateUrl: 'views/directives/pipeline-status.html'
};
});