/* The Messages tab: the notice log as a table.
*
* `/api/notices` is the queue's own route (`pipeline/web/jobs.py`) -- the log
* belongs to the queue, the wording belongs to the app, and this page is only
* the reading of it. It redraws on `app:notice` so a failure that happens
* while you are looking at this tab appears without a reload.
*/
(function () {
"use strict";
const host = document.getElementById("notices");
const clearAll = document.getElementById("clear-all");
if (!host) return;
const esc = window.esc;
function when(iso) {
if (!iso) return "";
const d = new Date(iso);
return isNaN(d) ? iso : d.toLocaleString();
}
function row(n) {
const count = n.count > 1 ? `x${n.count}` : "";
return `
${esc(n.text)} ${count}
${esc(n.code)}${n.key ? " / " + esc(n.key) : ""}
-- last said ${esc(when(n.last_at))}
${n.kind === "bug" ? "-- looks like a bug rather than a bad day" : ""}