Fix admin activity modal row lookup

Bind activity row click handlers to the rendered row object instead of refinding it by id and type.

Also guard activitySummary against missing rows to avoid runtime crashes in the admin activity modal.
This commit is contained in:
Nicolas Fryder 2026-07-02 23:52:00 +02:00
parent 255d7c7eee
commit a4c53fe09d

View file

@ -720,6 +720,7 @@ async function renderActivity() {
}
function activitySummary(row) {
if (!row) return "—";
const sum = row.summary || {};
if (row.type === "run") {
const parts = [];
@ -758,8 +759,9 @@ async function loadActivity() {
</tbody>
</table>
`;
document.getElementById("a-table").querySelectorAll("tr[data-id]").forEach((tr) => {
tr.addEventListener("click", () => openActivityModal(tr.dataset.type, Number(tr.dataset.id), r.items.find(x => x.type === tr.dataset.type && x.id === Number(tr.dataset.id))));
document.getElementById("a-table").querySelectorAll("tr[data-id]").forEach((tr, index) => {
const row = r.items[index];
tr.addEventListener("click", () => openActivityModal(tr.dataset.type, Number(tr.dataset.id), row));
});
const totalPages = Math.max(1, Math.ceil(s.total / s.pageSize));