This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
/
tree.html
150 lines (139 loc) · 6.38 KB
/
tree.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{{tree.tree}} - {{tree.status}}</title>
<link rel="stylesheet" type="text/css" href="/static/style.css" />
</head>
<body>
{% if 'REMOTE_USER' in request.environ: -%}
<script type="text/javascript">
"use strict";
function hasChecked(name) {
var checkboxes = document.getElementsByName(name);
for(var i=0; i < checkboxes.length; i++) {
if (checkboxes[i].checked)
return true;
}
return false;
}
function validateForm() {
var submitButton = document.getElementById("submit");
var status = document.getElementById("status").value;
if (status == "closed" && !hasChecked("tags")) {
submitButton.disabled = true;
submitButton.value = "No reason tags selected!";
return;
}
submitButton.disabled = false;
submitButton.value = "Submit";
}
window.onload = validateForm;
</script>
{% endif -%}
<div id="container">
<div id = "main">
<span class="atRight">
{% if 'REMOTE_USER' in request.environ: -%}
{{request.environ['REMOTE_USER']}}
<a class="loginout" href="/logout">Logout</a>
{% else: -%}
<a class="loginout" href="/login">Login</a>
{% endif -%}
</span>
<h1><a href="/">TreeStatus</a></h1>
<h2>{{tree.tree}} is <span class="{{tree.status.lower().replace(" ", "_")}}">{{tree.status.upper()}}</span></h2><br/>
{% if tree.reason: -%}
<h2>Reason: {{tree.reason|e|linkbugs}}</h2>
{% endif -%}
{% if tree.message_of_the_day -%}
<h3>{{tree.message_of_the_day|e|linkbugs}}</h3>
{% endif -%}
{% if 'REMOTE_USER' in request.environ: -%}
<div id="modify">
<h2>Modify this tree</h2>
<form method="post" action="/{{tree.tree}}">
<input type="hidden" name="token" value="{{token}}" />
<label for="status">New state:
<select name="status" id="status" onclick="validateForm()" onkeyup="validateForm()">
<option value="closed">Closed</option>
<option value="open">Open</option>
<option value="approval required">Approval Required</option>
</select>
</label>
<label for="reason">Reason:</label>
<input type="text" name="reason" size="30" value="{{tree.reason}}"/><br/>
<input type="checkbox" name="tags" value="checkin-compilation" id="checkin-compilation" onclick="validateForm()" />
<label for="checkin-compilation">Check-in compilation failure</label><br/>
<input type="checkbox" name="tags" value="checkin-test" id="checkin-test" onclick="validateForm()" />
<label for="checkin-test">Check-in test failure</label><br/>
<input type="checkbox" name="tags" value="infra" id="infra" onclick="validateForm()" />
<label for="infra">Infrastructure related</label><br/>
<input type="checkbox" name="tags" value="backlog" id="backlog" onclick="validateForm()" />
<label for="backlog">Job backlog</label><br/>
<input type="checkbox" name="tags" value="planned" id="planned" onclick="validateForm()" />
<label for="planned">Planned closure</label><br/>
<input type="checkbox" name="tags" value="other" id="other" onclick="validateForm()" />
<label for="other">Other</label><br/><br/>
<input type="checkbox" name="remember" value="remember" id="remember" checked="checked" />
<label for="remember">Remember previous state</label><br/><br/>
<label for="message">MOTD</label>
<textarea name="message" id="message" cols="70">{{tree.message_of_the_day}}</textarea><br/>
<span class="atRight"><input type="submit" id="submit" value="Submit" /></span>
</form>
</div>
{% endif -%}
<div id="tableWrapper">
<h2 id="previous">Summary</h2>
<table class="history">
<thead>
<tr>
<th class="tableWho">User</th>
<th class="tableWhen">Time</th>
<th class="tableState">Action</th>
<th class="tableReason">Reason</th>
<th class="tableTags">Tags</th>
</tr>
</thead>
<tbody>
{% for log in logs: -%}
<tr>
<td class="tableWho">
{% if 'REMOTE_USER' in request.environ: -%}
{{log.who}}
{% else -%}
{{log.who|obfuscate}}
{% endif -%}
</td>
<td class="tableWhen">
{{log.when}}
</td>
<td class="tableState">
{{log.action}}
</td>
<td class="tableReason">
{{log.reason|e|linkbugs}}
</td>
<td class="tableTags">
{{", ".join(log.tags)}}
</td>
</tr>
{% endfor -%}
</tbody>
</table>
</div>
</div>
<div id="footer">
<span class="footerWrapper">
<a href="/">All trees</a>
<a href="/help">Help</a>
<a href="https://github.com/mozilla/treestatus">Source</a>
{% if 'REMOTE_USER' in request.environ: -%}
<a href="/logout">Logout</a>
{% else: -%}
<a href="/login">Login</a>
{% endif -%}
</span>
</div>
</div>
</body>
</html>