f8ba396fec
- New /history route displays recent facts in a dedicated page with voided-row styling (line-through + opacity + badge). - Navigation link added to /dash page header. - Handler calls core.RecentFacts(ctx, 200) and renders historyTmpl.
38 lines
1.8 KiB
HTML
38 lines
1.8 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}
|
|
nav a{color:#8cf;margin-right:1rem;font-size:.85rem}
|
|
</style>
|
|
<nav><a href=/history>history</a></nav>
|
|
<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> |