-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard2.html
251 lines (205 loc) · 8.88 KB
/
dashboard2.html
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<html>
<head>
<meta http-equiv="refresh" content="150" >
<style>
@import url('https://cdn.shopify.com/shopify-marketing_assets/builds/30.6.0/marketing_assets/builds/shopify-sans.css');
body {
font-family: ShopifySans, Arial, sans-serif !important;
background-color: #212B35;
color: #F4F6F8;
margin: 0px;
margin-top: 8px;
overflow: hidden;
}
td {
font-size: 18px;
line-height: 22px;
font-weight: 400;
height:54px;
}
table {
padding-left: 72px;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="snow.js"></script>
<script>
const STATUS_URL = "https://buildkite-build-status.herokuapp.com";
// const STATUS_URL = "http://localhost:4567";
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('timeclock').innerHTML =
h + ":" + m + ":" + s;
var t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
function makePlatformImg(platform, status) {
if (platform == "") {
return null
}
var img = $("<img/>")
img.attr("width", "44px")
img.attr("src", "images/snowflake-" + platform + "-" + status + ".png")
// img.attr("src", "images/" + platform + "-" + status + ".png")
// Halloween
// img.attr("src", "images/" + "pumpkin" + "-" + status + ".png")
return img
}
function makeLogoImg(logo) {
if (logo == "") {
return null
}
var img = $("<img/>")
img.attr("width", "44px")
img.attr("src", "images/" + logo + ".png")
return img
}
function makeStatusImg(badge) {
var img = $("<img/>");
img.attr("width", "90px");
img.attr("src", badge + "&theme=95bf46,ed6347,999")
return img;
}
function makeJsonTable(json, data) {
var container = $("#statusTable");
var table = $("<table/>").addClass('CSSTableGenerator');
var row = $("<tr/>");
let params = new URLSearchParams(window.location.search)
var columns = 2
if (params.has('columns')) {
columns = params.get('columns')
}
$.each(json.data, function(rowIndex, r) {
var dataRow = data[rowIndex];
var id = dataRow[0];
var platform = dataRow[1];
var logo = dataRow[2];
var title = dataRow[3];
var branch = dataRow[4] || "master";
var status = r.pipeline.status;
var badge = r.pipeline.badge;
if (rowIndex % columns == 0) {
row = $("<tr/>");
row.append($("<td/>").attr("width", "110px").append(makeStatusImg(badge)));
row.append($("<td/>").attr("width", "50px").append(makePlatformImg(platform, status)));
row.append($("<td/>").attr("width", "50px").append(makeLogoImg(logo)));
row.append($("<td/>").text(title));
row.append($("<td/>").attr("width", "50px"));
} else {
row.append($("<td/>").attr("width", "110px").append(makeStatusImg(badge)));
row.append($("<td/>").attr("width", "50px").append(makePlatformImg(platform, status)));
row.append($("<td/>").attr("width", "50px").append(makeLogoImg(logo)));
row.append($("<td/>").text(title));
}
table.append(row);
});
return container.append(table);
}
function postStatus(body, table_data) {
$.ajax({
url: STATUS_URL + "/bulk",
dataType: "text",
type: "POST",
data: body,
success: function( data, textStatus, jQxhr ){
var json = jQuery.parseJSON(data);
makeJsonTable(json, table_data);
},
error: function( jqXhr, textStatus, errorThrown ){
$("#statusTable").append("wat");
}
});
}
function constructPostBody(data) {
var body = "{\n \"pipelines\": [\n";
var end_mark = ""
$.each(data, function(rowIndex, r) {
var dataRow = data[rowIndex];
var id = dataRow[0];
var branch = dataRow[4] || "master";
body += end_mark;
body += " {\n \"pipeline\": {\n";
body += " \"id\": \"" + id + "\",\n";
body += " \"branch\": \"" + branch + "\"\n";
body += " }\n";
body += " }";
end_mark = ",\n";
});
body += "\n ]\n}";
return body;
}
function throttle(force) {
if (force)
return false
var h = new Date().getHours();
return (h > 20 || h < 7);
}
$(document).ready(function() {
var data =
[
["8889bf9929a117249f40a18e7aab5f4b146d5ea6c6a19c1d18", "apple", "", "iOS @ Shopify (master)"],
["95b4f4535e17dd65765f0319675643a76c354a272b236df8ce", "android", "", "Android @ Shopify (master)"],
["ea89cfafb96cd5767c813d22133b876aad9e664823c22bc8ae", "apple", "mosho", "Shopify Mobile"],
["ce900af1a4cde4323abb371ab168d50a1f808069210bde01f5", "android", "mosho", "Shopify Mobile"],
["af5298d75ddcf27626f822534fdbbbed6e318d536b97ca09ee", "apple", "mosho", "Shopify Mobile Hockey Release", "ci-anka-release"],
["8a2d89e731cb5c7f9fd30d1a241391a1bc9b0aca3927627a42", "android", "mosho", "Shopify Mobile Automation"],
["7bf392b052e66b3f25e637f3488d66ef97902715c1d9f2969c", "apple", "mosho", "Shopify Mobile Release", " "],
["09e5e28a6a3a8dd422e986e7e71902cf071f1f6af8d715b9cf", "android", "mosho", "Shopify Mobile Play Store", " "],
["87dc0265f0c58c4796a498e2268490640e1e09f6bdf681da41", "apple", "ping", "Shopify Ping"],
["78ef5f6ee4e4c5ff06f48eb3f90ba8b57305c8ed08b698f5e3", "android", "pos_app", "Point of Sale"],
["c3f24f8e80aa04fa83a1697df7244c17db811b133dc539a37e", "apple", "pos_app", "Point of Sale"],
["325cea36fbbd06bd8ccaecfd786564ae4f4b41e92893885afb", "android", "pos_app", "Point Of Sale Integration Tests"],
["6a22c6cb651c8a796fe5ad2ebb9b0848ccfce56390ccea76e2", "apple", "pos_app", "Point of Sale Hockey Release", "ci-anka-release"],
["8350cdee0e44d7809bd87175c37125cb9edb0e9927bbd913f6", "android", "pos_app", "Point Of Sale SDK"],
["749b1232b503da51bc4689f8e9afa6896630c7764545b143ad", "apple", "foundations", "Foundation"],
["8f0a3de2ce014b0094acf585c4b68348e08fb164dfe4ab610c", "android", "pos_customer","Point Of Sale Customer View"],
["ba62b1540715d540024d7c23d961f0fe677dcb6225fab8f84a", "apple", "", "Merchant Login"],
["c5491521bd3755598efde6c281f9c973149cda9892ac7a8599", "android", "foundations", "Foundation"],
["200d6f13ee86c3a640b219b08c2c1066134f4f0acc48b3ec31", "apple", "polaris", "Polaris"],
["e198140085b657fdf5e1eef0e7b1417b7525c4b4b61c22c82f", "android", "", "Merchant Login"],
["913521705f4c2b66e72408eb2154aa8292d63d1cb925f9ba27", "apple", "testify", "Testify"],
["8d72b5bd96e5ce2166e67e54e3e5981e6f817bcc17f7ba1970", "android", "graphql", "Merchant SDK"],
["b253b897f0c5958a3045f9abce480d99abfe2abcdc8b801e5f", "apple", "rolodex-ios", "Rolodex"],
["e710f641bb12f2677c0f1e366172a9e5178fb5a74d9dfe73b1", "android", "", "Overflow Menu"],
["11a3edc09218415623d5ea0c7a02f03a000c2ac6bb5e53dfa5", "", "rocky", "Rocky"],
["11a3edc09218415623d5ea0c7a02f03a000c2ac6bb5e53dfa5", "", "rocky-linux", "Rocky (Linux)", "linux-playground"],
["74953c3d9a6915475b1589d3b6cb559c0a9422a461253d600d", "android", "polaris", "Polaris"],
["9e191b212fa804d618cb56e54094771cd5a7e0e978d9e0a9e5", "android", "", "Lint Rules"],
["fabd0c22627b7cd7085c5659f6be946fd2d21866a641a43e8f", "android", "", "Smart WebView"],
["4772c1833ed5080364730d65c7e7190bc45a086f558e888594", "android", "testify", "Testify"],
["1affd0422c06e393e0b9e4dd86784fe6bdaaad494669bfac6f", "android", "", "Timeline"],
["606b56053e5b2770da654528256c65a4cc9f846e76a9deb554", "android", "uploadify", "Uploadify"],
["37f24385bd6454d1dbf8963efce4659422c044586362dead36", "android", "rocky", "Rocky Plugin"],
["d7a11d2c0b5b28e423922bf79fa5ce410d96a1bda87f481ded", "android", "relay", "Relay"],
["98bb1bc42d7b21bf4f70b10c8d401ac857545f311c8567476a", "android", "rolodex", "Rolodex"]
]
let params = new URLSearchParams(window.location.search)
$("#timestamp").html(Date());
if (throttle(params.get('force'))) {
var img = $("<img/>")
img.attr("width", "90%")
img.attr("src", "images/night.jpeg")
$("#statusTable").append(img)
return
}
var body = constructPostBody(data);
postStatus(body, data)
});
</script>
</head>
<body onload="startTime()">
<header style="height: 36px;">
<div style="font-size:18pt; text-align: left; padding-left: 74px; float: left" id="timestamp"></div>
<div style="font-size:18pt; text-align: right; padding-right: 74px; float: right" id="timeclock"></div>
</header>
<div id="statusTable"></div>
</body>
</html>