-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.tmpl
178 lines (142 loc) · 3.52 KB
/
board.tmpl
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>{{ .Title }} - prometheus-explorer</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🧙♀️</text></svg>">
<link href="/static/deps/Chart.min.css" type="stylesheet">
<script defer src="/static/deps/Chart.bundle.min.js"></script>
<script defer src="/static/deps/chartjs-plugin-annotation.min.js"></script>
<!-- from http://davidbau.com/archives/2010/01/30/random_seeds_coded_hints_and_quintillions.html -->
<script defer src="/static/deps/seedrandom.min.js"></script>
<script defer src="/static/deps/js-yaml.min.js"></script>
<script defer src="/static/board.js"></script>
<script defer src="/static/explore.js"></script>
<style>
nav {
display: flex;
}
nav .options {
margin-left: auto;
}
nav .options form {
display: inline-block;
}
#search {
z-index: 1;
}
#search pre {
position: fixed;
overflow-wrap: break-word;
white-space: pre-line;
width: 80%;
max-height: 50%;
overflow-y: scroll;
background-color: white;
padding: 1ex;
border: 1px black solid;
z-index: 1;
display: none;
}
#search pre .name {
font-weight: bold;
}
#overrides {
display: flex;
}
#overrides span {
margin-right: 1ex;
}
/* align time range to the right */
#overrides [data-name=from] { margin-left: auto; }
#overrides [data-name=from], #overrides [data-name=to] {
order: 10;
}
#charts {
display: flex;
flex-wrap: wrap;
}
.chart {
flex-grow: 1;
max-width: 30vw;
margin-right: 1em;
margin-bottom: 1em;
}
h1 {
font-family: monospace;
}
.chart h1 {
font-size: larger;
}
.chart h1 a {
text-decoration: none;
visibility: hidden;
}
.chart:hover h1 a {
visibility: visible;
}
.chart .chart-container {
position: relative;
}
.chart input {
max-width: 45vh;
}
.chart canvas {
margin-top: 1ex;
}
.query, .duration, .error { font-family: monospace; }
.error { color: red; }
textarea {
width: 80%;
min-height: 20em;
}
</style>
</head>
<body>
<nav>
<form id="search">
<input type="search" placeholder="Search for metrics, e.g. node_" size="40" list="metric-names">
<datalist id="metric-names"></datalist>
<span class="duration"></span>
<span class="error"></span>
<pre></pre>
</form>
<div class="options">
<form method="GET" action="/">
{{ $currentBoard := .Title }}
<input type="text" name="board" list="boards" value="{{ $currentBoard }}" />
<datalist id="boards">
{{ range $board := .Boards }}
<option{{ if (eq $board $currentBoard) }} selected{{ end }}>{{ $board }}</option>
{{ end }}
</datalist>
</form>
<a href="https://prometheus.io/docs/prometheus/latest/querying/basics/">Prometheus Docs</a>
</div>
</nav>
<form id="overrides">
<span>Temporary overrides:</span>
</form>
<h1>{{ .Title }}</h1>
<form action="/{{ .Title }}" method="POST">
<details {{ if (or (eq .Title "default") .IsNew) }}open{{ end }}>
<summary>config</summary>
<textarea id="config" name="config">{{ .Config }}</textarea>
<div>
<input type="submit" value="save" />
</div>
</details>
</form>
<div id="global">
<pre id="error" class="error"></pre>
</div>
<div id="charts"></div>
{{ if (ne .Title "shortcuts") }}
<details>
<summary>shortcuts</summary>
<textarea id="shortcuts" disabled>{{ .Shortcuts }}</textarea>
<p>Go to <a href="/shortcuts">/shortcuts</a> to change the global shortcuts.</p>
</details>
{{ end }}
</body>
</html>