forked from Polymer/old-docs-site
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpolymer-buildbot.html
More file actions
147 lines (146 loc) · 4.06 KB
/
polymer-buildbot.html
File metadata and controls
147 lines (146 loc) · 4.06 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<link rel="import" href="../components/polymer/polymer.html">
<link rel="import" href="../components/polymer-ajax/polymer-ajax.html">
<polymer-element name="polymer-buildbot" attributes="builder details inactive browsers">
<template>
<style>
.status.inactive,
.result.inactive {
background-color: #b1b1b1;
}
.result.failed {
background-color: #d84437;
}
.result.passed {
background-color: #00a95c;
}
#badge {
cursor: pointer;
display: inline;
color: #7f7f7f;
text-transform: uppercase;
font-size: 10px;
border: 1px solid #7f7f7f;
border-radius: 2px;
padding: 3px 1px 3px 2px;
user-select: none;
-webkit-user-select: none;
}
#badge .result {
color: white;
padding: 2px 10px;
}
.details {
display: none;
}
.details.visible {
display: block;
}
.details a {
font-size: 12px;
}
ul {
padding: 0;
list-style-type: none;
}
li {
margin: 10px;
}
.label.status,
.label.result {
color: white;
font-size: 11px;
text-align: center;
border-radius: 3px;
padding: 3px 10px;
}
.label.status {
display: inline-block;
margin-left: 5px;
}
.label.result {
float: left;
margin-right: 5px;
}
</style>
<polymer-ajax id="bbot" handleAs="json" on-polymer-response="{{onResponse}}"></polymer-ajax>
<div id="badge" on-click="{{toggleDetails}}">
<span class="builder">{{builder.platform}}</span>
<span class="result {{result.resultStr}}">{{result.resultStr}}</span>
</div>
<div id="details" class="details">
<h3>
{{builder.project}} {{builder.platform}}
<template if="{{inactive}}">
<div class="label status inactive">inactive</div>
</template>
<a href="{{url}}/builders/{{builder.project}} {{builder.platform}}/builds/{{result.number}}" target="_blank">(latest test)</a>
<a href="{{url}}" target="_blank">(main page)</a>
</h3>
<ul>
<template repeat="{{browsers}}">
<li>
<div class="label result {{result}}">{{result}}</div>
{{browser}}
</li>
</template>
</ul>
</div>
</template>
<script>
Polymer('polymer-buildbot', {
details: false,
inactive: false,
browsers: null,
builder: null,
url: 'http://build.chromium.org/p/client.polymer',
detailsChanged: function() {
this.$.details.classList.toggle('visible', this.details);
},
builderChanged: function() {
if (this.inactive) {
return;
}
if (this.builder) {
this.$.bbot.url = this.url + '/json/builders/' +
this.builder.project + ' ' + this.builder.platform +
'/builds/-1';
this.$.bbot.go();
}
},
inactiveChanged: function() {
if (this.inactive) {
this.result = {
resultStr: 'inactive'
};
}
},
onResponse: function(inEvent, inResponse) {
this.result = inResponse.response;
this.result.resultStr = this.result.results ? 'failed' : 'passed';
var steps = inResponse.response.steps;
var foundTest = false;
var browsers = [];
for (var i = 0, s; s = steps[i]; i++) {
if (foundTest) {
// FIXME munge the data because I'm not sure how to access
// array elements from mdv...
browsers.push({
'browser': s.text,
'result': s.results[0] ? 'failed' : 'passed'
});
}
if (s.name == 'test') {
foundTest = true;
}
}
this.browsers = browsers;
},
toggleDetails: function() {
if (this.inactive) {
return;
}
this.details = !this.details;
}
});
</script>
</polymer-element>