paths fix

This commit is contained in:
Michal Utľák 2026-05-06 17:00:41 +02:00
parent 44aeb8cf26
commit 5a2f27de45
3 changed files with 22 additions and 22 deletions

View File

@ -44,8 +44,8 @@ function getBackendJobName() {
function getResultURL() { function getResultURL() {
return chosenAlgorithm === "isolation_forest" return chosenAlgorithm === "isolation_forest"
? "/get-isolation-forest-result" ? "get-isolation-forest-result"
: "/get-autoencoder-result"; : "get-autoencoder-result";
} }
function saveActiveJob() { function saveActiveJob() {
@ -173,7 +173,7 @@ function startProgressPolling() {
progressInterval = setInterval(async () => { progressInterval = setInterval(async () => {
try { try {
const res = await fetch("/get-status"); const res = await fetch("get-status");
if (!res.ok) { if (!res.ok) {
throw new Error("Backend status fetch failed"); throw new Error("Backend status fetch failed");
@ -207,7 +207,7 @@ async function restoreRunningJob() {
if (!saved) return; if (!saved) return;
try { try {
const res = await fetch("/get-status"); const res = await fetch("get-status");
const status = await res.json(); const status = await res.json();
applySavedAlgorithm(saved); applySavedAlgorithm(saved);
@ -265,8 +265,8 @@ startBtn.addEventListener("click", () => {
let url = let url =
chosenAlgorithm === "isolation_forest" chosenAlgorithm === "isolation_forest"
? "/start-iforest" ? "start-iforest"
: "/start-autoencoder"; : "start-autoencoder";
const controller = new AbortController(); const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 10000); const timeout = setTimeout(() => controller.abort(), 10000);
@ -426,7 +426,7 @@ function displayResults(data) {
} }
function downloadPDF(results, runtime) { function downloadPDF(results, runtime) {
fetch("/download-pdf", { fetch("download-pdf", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
@ -446,7 +446,7 @@ function downloadPDF(results, runtime) {
} }
function downloadJSON(results, runtime) { function downloadJSON(results, runtime) {
fetch("/download-json", { fetch("download-json", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({

View File

@ -100,7 +100,7 @@ function resetUploadFlow() {
async function isBackendBusy() { async function isBackendBusy() {
try { try {
const res = await fetch("/get-status"); const res = await fetch("get-status");
if (!res.ok) { if (!res.ok) {
showPopup("Backend status could not be checked."); showPopup("Backend status could not be checked.");
@ -153,7 +153,7 @@ fileInput.addEventListener("change", async () => {
let uploadResponse; let uploadResponse;
try { try {
uploadResponse = await fetch("/upload-dataset", { uploadResponse = await fetch("upload-dataset", {
method: "POST", method: "POST",
body: formData body: formData
}); });
@ -412,7 +412,7 @@ btnRun.addEventListener("click", async () => {
let saveResponse; let saveResponse;
try { try {
saveResponse = await fetch("/save-config", { saveResponse = await fetch("save-config", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify(config) body: JSON.stringify(config)

View File

@ -44,9 +44,9 @@ function getBackendJobName() {
function getResultURL() { function getResultURL() {
if (chosenAlgorithm === "iforest_custom") { if (chosenAlgorithm === "iforest_custom") {
return "/get-isolation-forest-result-custom"; return "get-isolation-forest-result-custom";
} }
return "/get-autoencoder-result-custom"; return "get-autoencoder-result-custom";
} }
function saveActiveJob() { function saveActiveJob() {
@ -171,9 +171,9 @@ window.fetch = async function (...args) {
} }
} catch (_) {} } catch (_) {}
if (url.includes("/upload-dataset")) { if (url.includes("upload-dataset")) {
showErrorPopup(message || "Cannot upload a new dataset while an algorithm is running."); showErrorPopup(message || "Cannot upload a new dataset while an algorithm is running.");
} else if (url.includes("/save-config")) { } else if (url.includes("save-config")) {
showErrorPopup(message || "Cannot save config while an algorithm is running."); showErrorPopup(message || "Cannot save config while an algorithm is running.");
} }
} }
@ -224,7 +224,7 @@ function startProgressPolling() {
progressInterval = setInterval(async () => { progressInterval = setInterval(async () => {
try { try {
const res = await fetch("/get-status"); const res = await fetch("get-status");
if (!res.ok) { if (!res.ok) {
throw new Error("Backend status fetch failed"); throw new Error("Backend status fetch failed");
@ -258,7 +258,7 @@ async function restoreRunningJob() {
if (!saved) return; if (!saved) return;
try { try {
const res = await fetch("/get-status"); const res = await fetch("get-status");
const status = await res.json(); const status = await res.json();
if (status.current_job !== saved.backendJob) { if (status.current_job !== saved.backendJob) {
@ -291,7 +291,7 @@ startBtn.addEventListener("click", async () => {
if (!chosenAlgorithm) return; if (!chosenAlgorithm) return;
try { try {
const statusRes = await fetch("/get-status"); const statusRes = await fetch("get-status");
const status = await statusRes.json(); const status = await statusRes.json();
if (status.running) { if (status.running) {
@ -309,9 +309,9 @@ startBtn.addEventListener("click", async () => {
let url; let url;
if (chosenAlgorithm === "iforest_custom") { if (chosenAlgorithm === "iforest_custom") {
url = "/start-iforest-custom"; url = "start-iforest-custom";
} else if (chosenAlgorithm === "autoencoder_custom") { } else if (chosenAlgorithm === "autoencoder_custom") {
url = "/start-autoencoder-custom"; url = "start-autoencoder-custom";
} }
const controller = new AbortController(); const controller = new AbortController();
@ -465,7 +465,7 @@ function displayResults(data) {
} }
function downloadPDF(results, runtime) { function downloadPDF(results, runtime) {
fetch("/download-pdf", { fetch("download-pdf", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
@ -485,7 +485,7 @@ function downloadPDF(results, runtime) {
} }
function downloadJSON(results, runtime) { function downloadJSON(results, runtime) {
fetch("/download-json", { fetch("download-json", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({