Files
Maven/cmd/mavweb/dash.html
T

36 lines
1.7 KiB
HTML

<!doctype html><meta charset=utf-8>
<title>maven dash</title>
<style>
body{font:14px monospace;background:#111;color:#ddd;margin:1rem}
h2{color:#8cf;margin:1.2rem 0 .3rem}
table{border-collapse:collapse;width:100%}
td,th{border-bottom:1px solid #333;padding:.2rem .5rem;text-align:left}
.pending{color:#fc6}.acted{color:#6c6}.ignored{color:#888}.snoozed{color:#c9f}
.pres{color:#6c6}.away{color:#888}
.updated{color:#666;font-size:.85rem;margin-top:-.5rem;margin-bottom:1rem}
</style>
<h2>presence</h2>
<p><span class={{.Presence.Bucket}}>{{.Presence.Bucket}}</span> — score {{printf "%.2f" .Presence.Score}} ({{ago .Presence.Updated}})</p>
<div class=updated>обновляется каждые 10с</div>
<h2>nudges</h2>
<table id=nudges><tr><th>when<th>rule<th>chan<th>outcome<th>message</tr>
{{range .Nudges}}<tr><td>{{ago .Ts}}<td>{{.Rule}}<td>{{.Channel}}<td class={{.Outcome}}>{{.Outcome}}<td>{{.Message}}</tr>{{end}}
</table>
<h2>facts</h2>
<table id=facts><tr><th>when<th>kind<th>key<th>value<th>source<th>conf</tr>
{{range .Facts}}<tr><td>{{ago .Ts}}<td>{{.Kind}}<td>{{.Key}}<td>{{.Value}}<td>{{.Source}}<td>{{printf "%.2f" .Confidence}}</tr>{{end}}
</table>
<h2>notes</h2>
<table id=notes><tr><th>when<th>source<th>text</tr>
{{range .Notes}}<tr><td>{{ago .Ts}}<td>{{.Source}}<td>{{.Text}}</tr>{{end}}
</table>
<script>
setInterval(() => fetch('/dash').then(r => r.text()).then(html => {
const p = new DOMParser(), d = p.parseFromString(html, 'text/html');
for (const id of ['nudges', 'facts', 'notes']) {
const old = document.getElementById(id), nu = d.getElementById(id);
if (old && nu) old.replaceWith(nu);
}
document.querySelector('h2+div').textContent = 'обновлено ' + new Date().toLocaleTimeString();
}), 10000);
</script>