Files
jiggablend/web/static/jobs.js
Justin Harms 2deb47e5ad Refactor web build process and update documentation
- Removed Node.js build artifacts from .gitignore and adjusted Makefile to reflect changes in web UI build process, now using server-rendered Go templates instead of React.
- Updated README to clarify the new web UI architecture and output formats, emphasizing the removal of the Node.js build step.
- Added a command to set the number of frames per render task in manager configuration, enhancing user control over rendering settings.
- Improved Gitea workflow by removing unnecessary npm install step, streamlining the CI process.
2026-03-12 19:44:40 -05:00

42 lines
1.2 KiB
JavaScript

(function () {
async function apiRequest(url, method) {
const res = await fetch(url, {
method,
credentials: "include",
headers: { "Content-Type": "application/json" },
});
const data = await res.json().catch(() => ({}));
if (!res.ok) {
throw new Error(data.error || "Request failed");
}
return data;
}
document.body.addEventListener("click", async (e) => {
const cancelBtn = e.target.closest("[data-cancel-job]");
const deleteBtn = e.target.closest("[data-delete-job]");
if (!cancelBtn && !deleteBtn) return;
try {
if (cancelBtn) {
const id = cancelBtn.getAttribute("data-cancel-job");
if (!confirm("Cancel this job?")) return;
await apiRequest(`/api/jobs/${id}`, "DELETE");
}
if (deleteBtn) {
const id = deleteBtn.getAttribute("data-delete-job");
if (!confirm("Delete this job permanently?")) return;
await apiRequest(`/api/jobs/${id}/delete`, "POST");
}
if (window.htmx) {
htmx.trigger("#jobs-fragment", "refresh");
htmx.ajax("GET", "/ui/fragments/jobs", "#jobs-fragment");
} else {
window.location.reload();
}
} catch (err) {
alert(err.message);
}
});
})();