forked from puppetlabs/community_management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
github_action_report.js.erb
68 lines (60 loc) · 2.16 KB
/
github_action_report.js.erb
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
function searchFunction() {
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("inputSearch");
filter = input.value.toUpperCase();
table = document.getElementById("principalTable");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
$(document).ready(function() {
$('[data-toggle="tooltip"]').tooltip();
});
function toggle(id) {
var e = document.getElementById(id)
if (e.style.display == 'none')
e.style.display = 'table-row-group';
else
e.style.display = 'none';
}
// Google Analytics
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-157301458-1', 'auto');
ga('send', 'pageview', { 'page': location.pathname + location.search + location.hash });
ga('set', 'anonymizeIp', true);
// End Google Analytics
google.charts.load("current", { packages: ["corechart"] });
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Job Status', 'Total'],
['Success', <%= result_hash.map { |x| x[:total_successes] }.reduce(0) { |sum, num| sum + num } %>],
['Failure', <%= result_hash.map { |x| x[:total_failures] }.reduce(0) { |sum, num| sum + num } %>]
]);
var options = {
title: 'Runs Overview',
slices: [{ color: 'green' }, { color: 'red' }],
pieHole: 0.4,
};
var chart = new google.visualization.PieChart(document.getElementById('donutchart'));
chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart);