Export CSV on every table, edit recurring maintenance, runs-on nothing, and run package checks outside the agent sandbox
- Export CSV for the small tables that had none (reads the table as shown) - Servers page shows a skeleton while loading instead of "No servers registered yet" - Recurring maintenance schedules can be edited (PUT /schedules/:id) - A server can be set to run on nothing (servers.no_parent, migration 0028) - Linux agent v3: package-manager question runs in ExecStartPre=-+ outside the sandbox, with --prepare-updates and --check-updates modes - Docs: README, DATABASE, AGENT_UPDATE Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c17e9aa140
commit
540ab704b7
32 files changed
+3003
-66
No files matched your search
@@ -13,3 +13,39 @@ export function downloadCsv(filename: string, headers: string[], rows: unknown[]
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* What a cell says as a person reads it — except times, which give their exact ISO value rather than "5 min ago". A cell, or anything in it,
|
||||
* can say what it should be in a CSV with `data-csv="…"` (for a cell that mixes a badge and a date, say).
|
||||
*/
|
||||
function cellText(cell: Element): string {
|
||||
const own = cell.getAttribute("data-csv");
|
||||
if (own !== null) return own;
|
||||
const clone = cell.cloneNode(true) as Element;
|
||||
clone.querySelectorAll("button, svg, input, select, textarea, .dropdown-menu, .visually-hidden").forEach((n) => n.remove());
|
||||
clone.querySelectorAll("[data-csv]").forEach((n) => n.replaceWith(n.getAttribute("data-csv") ?? ""));
|
||||
clone.querySelectorAll("time[datetime]").forEach((t) => t.replaceWith(t.getAttribute("datetime") ?? ""));
|
||||
// Lines and paragraphs inside a cell are words apart, not run together.
|
||||
clone.querySelectorAll("div, p, li, br").forEach((n) => n.prepend(" "));
|
||||
return (clone.textContent ?? "").replace(/\s+/g, " ").trim();
|
||||
}
|
||||
|
||||
const ACTION_HEADERS = new Set(["", "action", "actions"]);
|
||||
|
||||
/**
|
||||
* Reads a table as it is on screen — the header row, then each body row — for the many small tables that have no export of their own.
|
||||
* Columns with no heading or headed "Actions" are left out, and so are rows that span the table (an empty message, an open detail).
|
||||
*/
|
||||
export function tableToRows(table: HTMLTableElement): { headers: string[]; rows: string[][] } {
|
||||
const headCells = Array.from(table.tHead?.rows[table.tHead.rows.length - 1]?.cells ?? []);
|
||||
const keep = headCells.map((th, i) => (ACTION_HEADERS.has(cellText(th).toLowerCase()) ? -1 : i)).filter((i) => i >= 0);
|
||||
const headers = keep.map((i) => cellText(headCells[i]));
|
||||
const rows: string[][] = [];
|
||||
for (const body of Array.from(table.tBodies)) {
|
||||
for (const tr of Array.from(body.rows)) {
|
||||
if (tr.cells.length !== headCells.length) continue;
|
||||
rows.push(keep.map((i) => cellText(tr.cells[i])));
|
||||
}
|
||||
}
|
||||
return { headers, rows };
|
||||
}
|
||||
Reference in new issue
Block a user