-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (125 loc) · 5.53 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>Active tasks</title>
<link href="style.css" rel="stylesheet" />
<script type="text/javascript" src="graph.js"></script>
<script type="text/javascript" src="vivagraph.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
function main() {
drawGraph();
window.setInterval(function(){
drawGraph();
}, 3600 * 1000);
}
var renderer = null;
function drawGraph() {
$.ajax({
url: "data.json",
cache: false,
dataType: "json",
success: function(content) {
$("svg").remove();
renderer = renderGraph(content, getOptions());
if ('timestamp' in content) {
$('#timestamp').text(content.timestamp);
}
},
error: function (request, status, error) { alert(status + ", " + error); }
});
$('#layout').removeAttr('checked');
}
function getOptions() {
var options = [];
$('#config-form input').each(function (i, checkbox) {
if ($(checkbox).is(':checked') && !$(checkbox).attr("disabled")) {
options.push($(checkbox).attr("id"));
}
});
return options;
}
function redrawOptions() {
if ($('#JIRA').is(':checked')) {
$('#JIRA-all').removeAttr("disabled");
$('#JIRA-all-text').removeClass("disabled");
} else {
$('#JIRA-all').attr("disabled", true);
$('#JIRA-all-text').addClass("disabled");
}
if ($('#branches').is(':checked')) {
$('#merged').removeAttr("disabled");
$('#merged-text').removeClass("disabled");
$('#conflicts').removeAttr("disabled");
$('#conflicts-text').removeClass("disabled");
} else {
$('#merged').attr("disabled", true);
$('#merged-text').addClass("disabled");
$('#conflicts').attr("disabled", true);
$('#conflicts-text').addClass("disabled");
}
}
function stopLayout(isOn) {
if (renderer) {
if (isOn) {
renderer.pause();
} else {
renderer.resume();
}
}
}
</script>
</head>
<body onload='main()'>
<div id="config">
<form id="config-form">
<span title="Show JIRA issues"><input type="checkbox" id="JIRA" checked />JIRA issues</span><br />
<span title="Show inactive tasks"><input type="checkbox" id="JIRA-all" /><span id="JIRA-all-text">Inactive</span></span><br />
<span title="Show branch pull-requests"><input type="checkbox" id="pull" checked />Pull-requests</span><br />
<span title="Show Development branches"><input type="checkbox" id="branches" checked />Branches</span><br />
<span title="Show branches merged in master branch"><input type="checkbox" id="merged" /><span id="merged-text">Merged</span></span><br />
<span title="Show merge conflicts"><input type="checkbox" id="conflicts" checked /><span id="conflicts-text">Conflicts</span></span><br />
<span title="Hide nodes with no connections"><input type="checkbox" id="hide-orphans" />Hide orphans</span>
</form>
<span title="Stops layout processing"><input type="checkbox" id="layout" />Stop positioning</span>
<script type="text/javascript">
$(document).ready(function(){
var queryString = location.search;
if (queryString) {
var index = queryString.indexOf('options=');
if (index != -1) {
var options = queryString.substring(index + 8).split(',');
$('#config-form input').each(function (i, checkbox) {
$(checkbox).prop('checked', (options.indexOf($(checkbox).attr("id")) != -1));
});
}
}
redrawOptions();
// Enable/disable depending checkboxes
$('#JIRA').click(function() {
redrawOptions();
});
$('#branches').click(function () {
redrawOptions();
});
$('#config-form input').click(function () {
var options = "";
var opts = getOptions();
for (var index = 0; index < opts.length; index++) {
if (options.length != 0) {
options += ',';
}
options += opts[index];
}
window.history.pushState(null, "Active tasks", "index.html?options=" + options);
drawGraph();
});
$('#layout').click(function () {
stopLayout($('#layout').is(':checked'));
});
});
</script>
</div>
<div id="footer">Data gathered: <span id="timestamp"></span></div>
</body>
</html>