Remove full graph node cap
Some checks failed
docker-build / build (push) Has been cancelled

This commit is contained in:
2025-11-20 09:42:14 -05:00
parent 82c334b131
commit b0c9d319ef
2 changed files with 42 additions and 17 deletions

View File

@@ -135,6 +135,7 @@
let currentMaxNodes = sanitizeMaxNodes(maxNodesInput.value);
let currentSimulation = null;
let currentFullGraph = false;
let previousMaxNodesValue = maxNodesInput ? maxNodesInput.value : "200";
function setStatus(message, isError = false) {
if (!statusEl) return;
@@ -165,6 +166,18 @@
if (depthInput) {
depthInput.disabled = enabled;
}
if (maxNodesInput) {
if (enabled) {
previousMaxNodesValue = maxNodesInput.value || previousMaxNodesValue || "200";
maxNodesInput.value = "0";
maxNodesInput.disabled = true;
} else {
if (maxNodesInput.disabled) {
maxNodesInput.value = previousMaxNodesValue || "200";
}
maxNodesInput.disabled = false;
}
}
if (videoInput) {
if (enabled) {
videoInput.removeAttribute("required");
@@ -181,10 +194,11 @@
}
if (fullGraphMode) {
params.set("full_graph", "1");
params.set("max_nodes", "0");
} else {
params.set("depth", String(depth));
params.set("max_nodes", String(maxNodes));
}
params.set("max_nodes", String(maxNodes));
const response = await fetch(`/api/graph?${params.toString()}`);
if (!response.ok) {
const errorPayload = await response.json().catch(() => ({}));
@@ -445,8 +459,8 @@
setStatus("Please enter a video ID.", true);
return;
}
const safeDepth = wantsFull ? 0 : sanitizeDepth(depth);
const safeMaxNodes = sanitizeMaxNodes(maxNodes);
const safeDepth = wantsFull ? currentDepth || 1 : sanitizeDepth(depth);
const safeMaxNodes = wantsFull ? 0 : sanitizeMaxNodes(maxNodes);
if (updateInputs) {
videoInput.value = sanitizedId;
@@ -630,11 +644,12 @@
if (fullGraphMode) {
next.searchParams.set("full_graph", "1");
next.searchParams.delete("depth");
next.searchParams.set("max_nodes", "0");
} else {
next.searchParams.set("depth", String(depth));
next.searchParams.delete("full_graph");
next.searchParams.set("max_nodes", String(maxNodes));
}
next.searchParams.set("max_nodes", String(maxNodes));
if (labelSize && labelSize !== "normal") {
next.searchParams.set("label_size", labelSize);
} else {
@@ -647,7 +662,11 @@
const params = new URLSearchParams(window.location.search);
const videoId = sanitizeId(params.get("video_id"));
const depth = sanitizeDepth(params.get("depth") || "");
const maxNodes = sanitizeMaxNodes(params.get("max_nodes") || "");
const rawMaxNodes = params.get("max_nodes");
let maxNodes = sanitizeMaxNodes(rawMaxNodes || "");
if (rawMaxNodes && rawMaxNodes.trim() === "0") {
maxNodes = 0;
}
const labelSizeParam = params.get("label_size");
const fullGraphParam = params.get("full_graph");
const viewFull =
@@ -656,7 +675,7 @@
videoInput.value = videoId;
}
depthInput.value = String(depth);
maxNodesInput.value = String(maxNodes);
maxNodesInput.value = String(viewFull ? 0 : maxNodes);
if (fullGraphToggle) {
fullGraphToggle.checked = !!viewFull;
}