This repository has been archived by the owner on Apr 10, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtemplates.go
263 lines (252 loc) · 8.84 KB
/
templates.go
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
252
253
254
255
256
257
258
259
260
261
262
263
// OBSOLETED by templates/*.tmpl
// Templates for webui
package main
import (
"fmt"
"html/template"
)
const menu = `
<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="/">Stream Surfer</a>
<ul class="nav">
<li><a href="/status">Status</a></li>
<li><a href="/ctrl">Control</a></li>
<li class="active"><a href="/rprt">Reports</a></li>
<li><a href="http://streamsurfer.org">Documentation</a></li>
</ul>
</div>
</div>
`
type TestMe struct {
Test int
}
var (
tmpltReportStreamInfo = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Stream Surfer Reports</title>
<meta name="description" content="Creating a table with Twitter Bootstrap. Learn how to use Twitter Bootstrap toolkit to create Tables with examples.">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
</head>
<body>
<h1>Reports are:</h1>
<ul>
{{range $i, $val := .}}
<li><a href="rprt/{{$i}}">{{$val}}</a></li>
{{end}}
</ul>
</body>
<a href="http://streamsurfer.org"><img src="/logo-64.png" /></a><br />
</html>
`
tmpltReportStreamHistory = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Stream Surfer Reports</title>
<meta name="description" content="Creating a table with Twitter Bootstrap. Learn how to use Twitter Bootstrap toolkit to create Tables with examples.">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
</head>
<body>
<h1>Errors per 3 hours for all groups</h1>
<table class="table table-bordered table-condensed">
<thead>
<tr>
</table>
</body>
<a href="http://streamsurfer.org"><img src="/logo-64.png" /></a><br />
</html>
`
)
/// ниже устаревшие шаблоны ///////////////////////////////////////////////////////////////////////////////
/// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
var (
ReportMainPageTemplate = fmt.Sprintf(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Stream Surfer Reports</title>
<meta name="description" content="Creating a table with Twitter Bootstrap. Learn how to use Twitter Bootstrap toolkit to create Tables with examples.">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
</head>
<body>
%s
<h1>Reports are:</h1>
<ul>
<li><a href="rprt/3hours">Errors for all streams for last 3 hours</a></li>
<li><a href="rprt/last">Last streams errors (complete)</a></li>
<li><a href="rprt/last-critical">Last streams errors (critical only)</a></li>
</ul>
</body>
<a href="http://streamsurfer.org"><img src="/logo-64.png" /></a><br />
</html>
`, menu)
Report3HoursTemplate = fmt.Sprintf(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Errors per 3 hours for all groups :: Stream Surfer</title>
<meta name="description" content="Creating a table with Twitter Bootstrap. Learn how to use Twitter Bootstrap toolkit to create Tables with examples.">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
<script src="/js/bootstrap.min.js"></script>
</head>
<body>
%s
<h1>Errors per 3 hours for all groups</h1>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th rowspan="2">Group</th>
<th rowspan="2">Name</th>
<th colspan="6">Last hour</th>
<th colspan="6">Two hours ago</th>
<th colspan="6">Three hours ago</th>
</tr>
<tr>
<th rel="tooltip" title="Slow response">SR</th>
<th rel="tooltip" title="Bad status">BS</th>
<th rel="tooltip" title="Bad URI">BU</th>
<th rel="tooltip" title="Timeout on read">RT</th>
<th rel="tooltip" title="Timeout on connect">CT</th>
<th rel="tooltip" title="Slow response">SR</th>
<th rel="tooltip" title="Bad status">BS</th>
<th rel="tooltip" title="Bad URI">BU</th>
<th rel="tooltip" title="Timeout on read">RT</th>
<th rel="tooltip" title="Timeout on connect">CT</th>
<th rel="tooltip" title="Slow response">SR</th>
<th rel="tooltip" title="Bad status">BS</th>
<th rel="tooltip" title="Bad URI">BU</th>
<th rel="tooltip" title="Timeout on read">RT</th>
<th rel="tooltip" title="Timeout on connect">CT</th>
<th rel="tooltip" title="Connection refused">CR</th>
</tr>
</thead>
<tbody>
{{#TableData}}
<tr>
<td><a href="/rprt/g/{{group}}/3hours">{{group}}</a></td>
<td><a href="{{uri}}">{{name}}</a></td>
<td{{#sw-severity}} class="{{sw-severity}}"{{/sw-severity}} rel="tooltip" title="Slow response">{{sw}}</td>
<td{{#bs-severity}} class="{{bs-severity}}"{{/bs-severity}} rel="tooltip" title="Bad status">{{bs}}</td>
<td{{#bu-severity}} class="{{bu-severity}}"{{/bu-severity}} rel="tooltip" title="Bad URI">{{bu}}</td>
<td{{#rt-severity}} class="{{rt-severity}}"{{/rt-severity}} rel="tooltip" title="Timeout on read">{{rt}}</td>
<td{{#ct-severity}} class="{{ct-severity}}"{{/ct-severity}} rel="tooltip" title="Timeout on connect">{{ct}}</td>
<td{{#cr-severity}} class="{{cr-severity}}"{{/cr-severity}} rel="tooltip" title="Slow response">{{cr}}</td>
<td>{{sw2}}</td>
<td>{{bs2}}</td>
<td>{{bs2}}</td>
<td>{{rt2}}</td>
<td>{{ct2}}</td>
<td>{{cr2}}</td>
<td>{{sw3}}</td>
<td>{{bs3}}</td>
<td>{{bu3}}</td>
<td>{{rt3}}</td>
<td>{{ct3}}</td>
<td>{{cr3}}</td>
</tr>
{{/TableData}}
</tbody>
</table>
<a href="http://streamsurfer.org"><img src="/logo-64.png" /></a><br />
Generated by <a href="http://streamsurfer.org">Stream Surfer</a>
</body>
</html>
`, menu)
ReportLastTemplate = fmt.Sprintf(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>All groups last errors :: Stream Surfer</title>
<meta name="description" content="Creating a table with Twitter Bootstrap. Learn how to use Twitter Bootstrap toolkit to create Tables with examples.">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
<script src="/js/bootstrap.min.js"></script>
</head>
<body>
%s
<h1>Last errors</h1>
<table class="table table-bordered table-condensed">
<thead>
<tr>
<th>Group</th>
<th>Name</th>
<th>Status</th>
<th>Length</th>
<th>Request Duration</th>
<th>Last Checked</th>
<th>Error</th>
<th>Last Hour</th>
</tr>
</thead>
<tbody>
{{#TableData}}
<tr class="{{severity}}">
<td><a href="/rprt/g/{{group}}/{{report}}">{{group}}</a></td>
<td><a href="{{uri}}">{{name}}</a></td>
<td>{{status}}</td>
<td>{{contentlength}}</td>
<td>{{elapsed}}</td>
<td>{{started}}</td>
<td>{{error}}</td>
<td>{{totalerrs}}</td>
</tr>
{{/TableData}}
</tbody>
</table>
<a href="http://streamsurfer.org"><img src="/logo-64.png" /></a><br />
Generated by <a href="http://streamsurfer.org">Stream Surfer</a>
</body>
</html>
`, menu)
ReportGroupLastTemplate = fmt.Sprintf(`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{{#Vars}}{{group}} :: {{/Vars}}Stream Surfer</title>
<meta name="description" content="Creating a table with Twitter Bootstrap. Learn how to use Twitter Bootstrap toolkit to create Tables with examples.">
<link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/custom.css" rel="stylesheet">
<script src="/js/bootstrap.min.js"></script>
</head>
<body>
%s
{{#Vars}}<h1>{{group}} last errors</h1>{{/Vars}}
<table class="table table-bordered table-condensed sortered">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Length</th>
<th>Request Duration</th>
<th>Last Checked</th>
<th>Error</th>
<th>Last Hour</th>
</tr>
</thead>
<tbody>
{{#TableData}}
<tr class="{{severity}}">
<td><a href="{{uri}}">{{name}}</a></td>
<td>{{status}}</td>
<td>{{contentlength}}</td>
<td>{{elapsed}}</td>
<td>{{started}}</td>
<td>{{error}}</td>
<td>{{totalerrs}}</td>
</tr>
{{/TableData}}
</tbody>
</table>
<a href="http://streamsurfer.org"><img src="/logo-64.png" /></a><br />
Generated by <a href="http://streamsurfer.org">Stream Surfer</a>
</body>
</html>`, menu)
)
var IndexPageTemplate = template.Must(template.ParseFiles("html/index.html"))