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:
parent
255d7c7eee
commit
a4c53fe09d
1 changed files with 4 additions and 2 deletions
|
|
@ -720,6 +720,7 @@ async function renderActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function activitySummary(row) {
|
function activitySummary(row) {
|
||||||
|
if (!row) return "—";
|
||||||
const sum = row.summary || {};
|
const sum = row.summary || {};
|
||||||
if (row.type === "run") {
|
if (row.type === "run") {
|
||||||
const parts = [];
|
const parts = [];
|
||||||
|
|
@ -758,8 +759,9 @@ async function loadActivity() {
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
`;
|
`;
|
||||||
document.getElementById("a-table").querySelectorAll("tr[data-id]").forEach((tr) => {
|
document.getElementById("a-table").querySelectorAll("tr[data-id]").forEach((tr, index) => {
|
||||||
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))));
|
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));
|
const totalPages = Math.max(1, Math.ceil(s.total / s.pageSize));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue